~ubuntu-dev/ubuntu/lucid/mutt/lucid-201002110857

« back to all changes in this revision

Viewing changes to snprintf.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-06-07 17:30:03 UTC
  • mto: (16.2.1 experimental) (2.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090607173003-rg37ui3h2bbv7wl0
Tags: upstream-1.5.19
ImportĀ upstreamĀ versionĀ 1.5.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
#define DP_F_UNSIGNED   (1 << 6)
121
121
 
122
122
/* Conversion Flags */
123
 
#define DP_C_SHORT   1
124
 
#define DP_C_LONG    2
125
 
#define DP_C_LDOUBLE 3
 
123
#define DP_C_SHORT    1
 
124
#define DP_C_LONG     2
 
125
#define DP_C_LONGLONG 3
 
126
#define DP_C_LDOUBLE  4
126
127
 
127
128
#define char_to_int(p) (p - '0')
128
129
#undef MAX
230
231
        state = DP_S_MOD;
231
232
      break;
232
233
    case DP_S_MOD:
233
 
      /* Currently, we don't support Long Long, bummer */
234
234
      switch (ch) 
235
235
      {
236
236
      case 'h':
240
240
      case 'l':
241
241
        cflags = DP_C_LONG;
242
242
        ch = *format++;
 
243
        if (ch == 'l')
 
244
        {
 
245
          cflags = DP_C_LONGLONG;
 
246
          ch = *format++;
 
247
        }
243
248
        break;
244
249
      case 'L':
245
250
        cflags = DP_C_LDOUBLE;
259
264
          value = va_arg (args, short int);
260
265
        else if (cflags == DP_C_LONG)
261
266
          value = va_arg (args, long int);
 
267
        else if (cflags == DP_C_LONGLONG)
 
268
          value = va_arg (args, long long int);
262
269
        else
263
270
          value = va_arg (args, int);
264
271
        fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
269
276
          value = va_arg (args, unsigned short int);
270
277
        else if (cflags == DP_C_LONG)
271
278
          value = va_arg (args, unsigned long int);
 
279
        else if (cflags == DP_C_LONGLONG)
 
280
          value = va_arg (args, unsigned long long int);
272
281
        else
273
282
          value = va_arg (args, unsigned int);
274
283
        fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
279
288
          value = va_arg (args, unsigned short int);
280
289
        else if (cflags == DP_C_LONG)
281
290
          value = va_arg (args, unsigned long int);
 
291
        else if (cflags == DP_C_LONGLONG)
 
292
          value = va_arg (args, unsigned long long int);
282
293
        else
283
294
          value = va_arg (args, unsigned int);
284
295
        fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
291
302
          value = va_arg (args, unsigned short int);
292
303
        else if (cflags == DP_C_LONG)
293
304
          value = va_arg (args, unsigned long int);
 
305
        else if (cflags == DP_C_LONGLONG)
 
306
          value = va_arg (args, unsigned long long int);
294
307
        else
295
308
          value = va_arg (args, unsigned int);
296
309
        fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
343
356
          num = va_arg (args, long int *);
344
357
          *num = currlen;
345
358
        } 
 
359
        else if (cflags == DP_C_LONGLONG) 
 
360
        {
 
361
          long long int *num;
 
362
          num = va_arg (args, long long int *);
 
363
          *num = currlen;
 
364
        } 
346
365
        else 
347
366
        {
348
367
          int *num;
387
406
  int padlen, strln;     /* amount to pad */
388
407
  int cnt = 0;
389
408
  
390
 
  if (value == 0)
 
409
  if (!value)
391
410
  {
392
411
    value = "<NULL>";
393
412
  }