~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to lib/string/bsd_vsnprintf.c

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-06-20 15:59:51 UTC
  • mfrom: (1.4.8)
  • Revision ID: package-import@ubuntu.com-20120620155951-6rupmpb0f70b52zr
Tags: 2012.05.21-724730-0ubuntu1
* Merging upstream version 2012.05.21-724730.
  - Fixes building against the current Quantal kernel. (LP: #1000344)
  - Fixes Quantal installation issues. (LP: #1019031)

* Sync with Debian
  - Updating to debhelper version 9.
  - Updating to standards version 3.9.3.
  - Updating copyright file machine-readable format version 1.0.
  - Building without multiarch paths for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
#include "convertutf.h"
74
74
#include "str.h"
75
75
 
 
76
 
 
77
#if defined __ANDROID__
 
78
/*
 
79
 * Android doesn't support dtoa() or ldtoa().
 
80
 */
 
81
#define NO_DTOA
 
82
#define NO_LDTOA
 
83
#endif
 
84
 
76
85
static char   *__ultoa(u_long, char *, int, int, const char *, int, char,
77
86
                       const char *);
78
87
static void   __find_arguments(const char *, va_list, union arg **);
453
462
    * D:   expchar holds this character; '\0' if no exponent, e.g. %f
454
463
    * F:   at least two digits for decimal, at least one digit for hex
455
464
    */
 
465
#if defined __ANDROID__
 
466
   static char dp = '.';
 
467
#endif
456
468
   int signflag;      /* true if float is negative */
457
469
   union {         /* floating point arguments %[aAeEfFgG] */
458
470
      double dbl;
615
627
   convbuf = NULL;
616
628
#if !defined(NO_FLOATING_POINT)
617
629
   dtoaresult = NULL;
 
630
#if !defined __ANDROID__
 
631
   decimal_point = localeconv()->decimal_point;
 
632
#else
 
633
   /*
 
634
    * Struct lconv is not working! For decimal_point,
 
635
    * using '.' instead is a workaround.
 
636
    */
 
637
   decimal_point = &dp;
 
638
#endif
618
639
#endif
619
640
 
620
641
   fmt = (char *)fmt0;
733
754
         goto rflag;
734
755
      case '\'':
735
756
         flags |= GROUPING;
 
757
#if !defined __ANDROID__
736
758
         thousands_sep = thousands_sepIn;
737
759
         grouping = groupingIn;
738
 
 
 
760
#else
 
761
         /*
 
762
          * Struct lconv is not working! The code below is a workaround.
 
763
          */
 
764
         thousands_sep = ',';
 
765
#endif
739
766
         /*
740
767
          * Grouping should not begin with 0, but it nevertheless does (see
741
768
          * bug 281072) and makes the formatting code behave badly, so we
901
928
         }
902
929
         if (flags & LLONGINT) {
903
930
            fparg.ldbl = GETARG(long double);
 
931
#if defined NO_LDTOA
 
932
            dtoaresult = NULL;
 
933
            /*
 
934
             * Below is to keep compiler happy
 
935
             */
 
936
            signflag = -1;
 
937
            expt = 0;
 
938
            dtoaend = NULL;
 
939
#else
904
940
            dtoaresult = cp = ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec,
905
941
                                     &expt, &signflag, &dtoaend);
 
942
#endif
906
943
         } else {
907
944
            fparg.dbl = GETARG(double);
 
945
#if defined NO_DTOA
 
946
            dtoaresult = NULL;
 
947
            /*
 
948
             * Below is to keep compiler happy
 
949
             */
 
950
            signflag = -1;
 
951
            expt = 0;
 
952
            dtoaend = NULL;
 
953
#else
908
954
            dtoaresult = cp = dtoa(fparg.dbl, expchar ? 2 : 3, prec,
909
955
                                   &expt, &signflag, &dtoaend);
 
956
#endif
910
957
         }
911
958
 
912
959
         /* Our dtoa / ldtoa call strdup(), which can fail. PR319844 */