~ubuntu-branches/ubuntu/lucid/mpop/lucid

« back to all changes in this revision

Viewing changes to gnulib/printf-parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Louis
  • Date: 2007-04-22 11:10:07 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070422111007-zxauoipdhkj9lasp
Tags: 1.0.9-1
New upstream release which include a fix for for CVE2007-1558.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Formatted output to strings.
2
 
   Copyright (C) 1999-2000, 2002-2003, 2006 Free Software Foundation, Inc.
 
2
   Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software; you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
28
28
#include <stddef.h>
29
29
 
30
30
/* Get intmax_t.  */
31
 
#if HAVE_STDINT_H_WITH_UINTMAX
 
31
#ifdef IN_LIBINTL
 
32
# if HAVE_STDINT_H_WITH_UINTMAX
 
33
#  include <stdint.h>
 
34
# endif
 
35
# if HAVE_INTTYPES_H_WITH_UINTMAX
 
36
#  include <inttypes.h>
 
37
# endif
 
38
#else
32
39
# include <stdint.h>
33
40
#endif
34
 
#if HAVE_INTTYPES_H_WITH_UINTMAX
35
 
# include <inttypes.h>
36
 
#endif
37
41
 
38
42
/* malloc(), realloc(), free().  */
39
43
#include <stdlib.h>
326
330
                      flags += 8;
327
331
                      cp++;
328
332
                    }
329
 
#ifdef HAVE_INTMAX_T
330
333
                  else if (*cp == 'j')
331
334
                    {
332
335
                      if (sizeof (intmax_t) > sizeof (long))
341
344
                        }
342
345
                      cp++;
343
346
                    }
344
 
#endif
345
347
                  else if (*cp == 'z' || *cp == 'Z')
346
348
                    {
347
349
                      /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
382
384
              switch (c)
383
385
                {
384
386
                case 'd': case 'i':
385
 
#ifdef HAVE_LONG_LONG_INT
 
387
#if HAVE_LONG_LONG_INT
386
388
                  /* If 'long long' exists and is larger than 'long':  */
387
389
                  if (flags >= 16 || (flags & 4))
388
390
                    type = TYPE_LONGLONGINT;
400
402
                    type = TYPE_INT;
401
403
                  break;
402
404
                case 'o': case 'u': case 'x': case 'X':
403
 
#ifdef HAVE_LONG_LONG_INT
 
405
#if HAVE_LONG_LONG_INT
404
406
                  /* If 'long long' exists and is larger than 'long':  */
405
407
                  if (flags >= 16 || (flags & 4))
406
408
                    type = TYPE_ULONGLONGINT;
419
421
                  break;
420
422
                case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
421
423
                case 'a': case 'A':
422
 
#ifdef HAVE_LONG_DOUBLE
423
424
                  if (flags >= 16 || (flags & 4))
424
425
                    type = TYPE_LONGDOUBLE;
425
426
                  else
426
 
#endif
427
 
                  type = TYPE_DOUBLE;
 
427
                    type = TYPE_DOUBLE;
428
428
                  break;
429
429
                case 'c':
430
430
                  if (flags >= 8)
431
 
#ifdef HAVE_WINT_T
 
431
#if HAVE_WINT_T
432
432
                    type = TYPE_WIDE_CHAR;
433
433
#else
434
434
                    goto error;
436
436
                  else
437
437
                    type = TYPE_CHAR;
438
438
                  break;
439
 
#ifdef HAVE_WINT_T
 
439
#if HAVE_WINT_T
440
440
                case 'C':
441
441
                  type = TYPE_WIDE_CHAR;
442
442
                  c = 'c';
444
444
#endif
445
445
                case 's':
446
446
                  if (flags >= 8)
447
 
#ifdef HAVE_WCHAR_T
 
447
#if HAVE_WCHAR_T
448
448
                    type = TYPE_WIDE_STRING;
449
449
#else
450
450
                    goto error;
452
452
                  else
453
453
                    type = TYPE_STRING;
454
454
                  break;
455
 
#ifdef HAVE_WCHAR_T
 
455
#if HAVE_WCHAR_T
456
456
                case 'S':
457
457
                  type = TYPE_WIDE_STRING;
458
458
                  c = 's';
462
462
                  type = TYPE_POINTER;
463
463
                  break;
464
464
                case 'n':
465
 
#ifdef HAVE_LONG_LONG_INT
 
465
#if HAVE_LONG_LONG_INT
466
466
                  /* If 'long long' exists and is larger than 'long':  */
467
467
                  if (flags >= 16 || (flags & 4))
468
468
                    type = TYPE_COUNT_LONGLONGINT_POINTER;