~ubuntu-branches/ubuntu/trusty/curl/trusty-security

« back to all changes in this revision

Viewing changes to lib/mprintf.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2014-01-31 08:42:28 UTC
  • mfrom: (3.4.45 sid)
  • Revision ID: package-import@ubuntu.com-20140131084228-rnste9wj6fqiy9zl
Tags: 7.35.0-1ubuntu1
* Resynchronize on Debian, remaining changes:
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from binary package Depends.
  - Add new libcurl3-udeb package.
  - Add new curl-udeb package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
#endif
74
74
 
75
75
/*
 
76
 * Non-ANSI integer extensions
 
77
 */
 
78
 
 
79
#if (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) || \
 
80
    (defined(__WATCOMC__) && defined(__386__)) || \
 
81
    (defined(__POCC__) && defined(_MSC_VER)) || \
 
82
    (defined(_WIN32_WCE)) || \
 
83
    (defined(__MINGW32__)) || \
 
84
    (defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64))
 
85
#  define MP_HAVE_INT_EXTENSIONS
 
86
#endif
 
87
 
 
88
/*
76
89
 * Max integer data types that mprintf.c is capable
77
90
 */
78
91
 
189
202
  return 0;
190
203
}
191
204
 
192
 
static int dprintf_IsQualifierNoDollar(char c)
 
205
static bool dprintf_IsQualifierNoDollar(const char *fmt)
193
206
{
194
 
  switch (c) {
 
207
#if defined(MP_HAVE_INT_EXTENSIONS)
 
208
  if(!strncmp(fmt, "I32", 3) || !strncmp(fmt, "I64", 3)) {
 
209
    return TRUE;
 
210
  }
 
211
#endif
 
212
 
 
213
  switch(*fmt) {
195
214
  case '-': case '+': case ' ': case '#': case '.':
196
215
  case '0': case '1': case '2': case '3': case '4':
197
216
  case '5': case '6': case '7': case '8': case '9':
198
217
  case 'h': case 'l': case 'L': case 'z': case 'q':
199
218
  case '*': case 'O':
200
 
    return 1; /* true */
 
219
#if defined(MP_HAVE_INT_EXTENSIONS)
 
220
  case 'I':
 
221
#endif
 
222
    return TRUE;
 
223
 
201
224
  default:
202
 
    return 0; /* false */
 
225
    return FALSE;
203
226
  }
204
227
}
205
228
 
255
278
 
256
279
      /* Handle the flags */
257
280
 
258
 
      while(dprintf_IsQualifierNoDollar(*fmt)) {
259
 
        switch (*fmt++) {
 
281
      while(dprintf_IsQualifierNoDollar(fmt)) {
 
282
#if defined(MP_HAVE_INT_EXTENSIONS)
 
283
        if(!strncmp(fmt, "I32", 3)) {
 
284
          flags |= FLAGS_LONG;
 
285
          fmt += 3;
 
286
        }
 
287
        else if(!strncmp(fmt, "I64", 3)) {
 
288
          flags |= FLAGS_LONGLONG;
 
289
          fmt += 3;
 
290
        }
 
291
        else
 
292
#endif
 
293
 
 
294
        switch(*fmt++) {
260
295
        case ' ':
261
296
          flags |= FLAGS_SPACE;
262
297
          break;
296
331
        case 'h':
297
332
          flags |= FLAGS_SHORT;
298
333
          break;
 
334
#if defined(MP_HAVE_INT_EXTENSIONS)
 
335
        case 'I':
 
336
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
 
337
          flags |= FLAGS_LONGLONG;
 
338
#else
 
339
          flags |= FLAGS_LONG;
 
340
#endif
 
341
          break;
 
342
#endif
299
343
        case 'l':
300
344
          if(flags & FLAGS_LONG)
301
345
            flags |= FLAGS_LONGLONG;