~ubuntu-branches/ubuntu/trusty/psqlodbc/trusty-proposed

« back to all changes in this revision

Viewing changes to misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2011-04-05 14:48:23 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110405144823-n77supsa1hjj0ik6
Tags: 1:09.00.0200-1
* New upstream release.
* Fix installing {A,W}/usr/lib/odbc.  Closes: #618210.
* Convert to 3.0 (quilt).
* Remove psqlodbc-580878.diff: implemented upstream.
* Remove psqlodbc-585476.diff: was caused by #519006 which is now closed.
* Update description, suggested by Martin Eberhard Schauer.
  Closes: #565611.
* New maintainer.  Closes: #472818.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
 *      The SQL_NTS length is considered.
149
149
 *------
150
150
 */
151
 
char *
152
 
make_lstring_ifneeded(ConnectionClass *conn, const char *s, ssize_t len, BOOL ifallupper)
 
151
SQLCHAR *
 
152
make_lstring_ifneeded(ConnectionClass *conn, const SQLCHAR *s, ssize_t len, BOOL ifallupper)
153
153
{
154
154
        ssize_t length = len;
155
155
        char       *str = NULL;
 
156
        const char *ccs = (const char *) s;
156
157
 
157
 
        if (s && (len > 0 || (len == SQL_NTS && (length = strlen(s)) > 0)))
 
158
        if (s && (len > 0 || (len == SQL_NTS && (length = strlen(ccs)) > 0)))
158
159
        {
159
160
                int     i;
160
161
                const char *ptr;
161
162
                encoded_str encstr;
162
163
 
163
 
                make_encoded_str(&encstr, conn, s);
164
 
                for (i = 0, ptr = s; i < length; i++, ptr++)
 
164
                make_encoded_str(&encstr, conn, ccs);
 
165
                for (i = 0, ptr = ccs; i < length; i++, ptr++)
165
166
                {
166
167
                        encoded_nextchar(&encstr);
167
168
                        if (ENCODE_STATUS(encstr) != 0)
188
189
                }
189
190
        }
190
191
 
191
 
        return str;
 
192
        return (SQLCHAR *) str;
192
193
}
193
194
 
194
195
 
246
247
 
247
248
 
248
249
char *
249
 
trim(char *s)
 
250
my_trim(char *s)
250
251
{
251
252
        size_t          i;
252
253
 
330
331
        va_end(arglist);
331
332
        return len;
332
333
}
 
334
 
 
335
#ifndef HAVE_STRLCAT
 
336
size_t
 
337
strlcat(char *dst, const char *src, size_t size)
 
338
{
 
339
        size_t ttllen;
 
340
        char    *pd = dst;
 
341
        const char *ps= src;
 
342
        
 
343
        for (ttllen = 0; ttllen < size; ttllen++, pd++)
 
344
        {
 
345
                if (0 == *pd)
 
346
                        break; 
 
347
        }
 
348
        if (ttllen >= size - 1)
 
349
                return ttllen + strlen(src);
 
350
        for (; ttllen < size - 1; ttllen++, pd++, ps++)
 
351
        {
 
352
                if (0 == (*pd = *ps))
 
353
                        return ttllen;
 
354
        }
 
355
        *pd = 0;
 
356
        for (; *ps; ttllen++, ps++)
 
357
                ;
 
358
        return ttllen;
 
359
}
 
360
#endif /* HAVE_STRLCAT */