apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/strings apr_snprintf.c
Date Wed, 01 Oct 2003 21:08:17 GMT
jorton      2003/10/01 14:08:17

  Modified:    .        configure.in
               include  apr.h.in apr.hnw apr.hw
               strings  apr_snprintf.c
  Log:
  * configure.in, include/apr.h.in, include/apr.hw, include/apr.hnw:
  Remove definitions of APR_INT64_T_FMT_LEN, APR_UINT64_T_FMT_LEN and
  APR_UINT64_T_HEX_FMT_LEN.  Die at configure-time if a 64-bit integer
  type is not found rather than placing "#error"s in apr.h.
  
  * strings/apr_snprintf.c (apr_vformatter): Rework to use sizeof()
  rather than APR_INT64_T_FMT_LEN.  One (intensional) functional change,
  for the sizeof(int) == 8 case: previously the first if condition would
  always be true since strncmp(a, b, 0) == 0; now the condition will
  always be false.
  
  Revision  Changes    Path
  1.543     +1 -18     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.542
  retrieving revision 1.543
  diff -u -u -r1.542 -r1.543
  --- configure.in	1 Oct 2003 17:36:37 -0000	1.542
  +++ configure.in	1 Oct 2003 21:08:16 -0000	1.543
  @@ -1048,9 +1048,7 @@
   if test "$ac_cv_sizeof_int" = "8"; then
       int64_literal='#define APR_INT64_C(val) (val)'
       int64_t_fmt='#define APR_INT64_T_FMT "d"'
  -    int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 1'
       uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
  -    uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 1'
       uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
       int64_value="int"
       long_value=int
  @@ -1058,9 +1056,7 @@
   elif test "$ac_cv_sizeof_long" = "8"; then
       int64_literal='#define APR_INT64_C(val) (val##L)'
       int64_t_fmt='#define APR_INT64_T_FMT "ld"'
  -    int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2'
       uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
  -    uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2'
       uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
       int64_value="long"
       long_value=long
  @@ -1072,9 +1068,7 @@
       # doesn't support 'q'.  Solaris wins.  Exceptions can
       # go to the OS-dependent section.
       int64_t_fmt='#define APR_INT64_T_FMT "lld"'
  -    int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 3'
       uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
  -    uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 3'
       uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
       int64_value="long long"
       long_value="long long"
  @@ -1082,9 +1076,7 @@
   elif test "$ac_cv_sizeof_long_double" = "8"; then
       int64_literal='#define APR_INT64_C(val) (val##LD)'
       int64_t_fmt='#define APR_INT64_T_FMT "Ld"'
  -    int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2'
       uint64_t_fmt='#define APR_UINT64_T_FMT "Lu"'
  -    uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2'
       uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "Lx"'
       int64_value="long double"
       long_value="long double"
  @@ -1092,9 +1084,7 @@
   elif test "$ac_cv_sizeof_longlong" = "8"; then
       int64_literal='#define APR_INT64_C(val) (val##LL)'
       int64_t_fmt='#define APR_INT64_T_FMT "qd"'
  -    int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2'
       uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
  -    uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2'
       uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
       int64_value="__int64"
       long_value="__int64"
  @@ -1102,12 +1092,7 @@
   else
       # int64_literal may be overriden if your compiler thinks you have
       # a 64-bit value but APR does not agree.
  -    int64_literal='#error Can not determine the proper size for apr_int64_t'
  -    int64_t_fmt='#error Can not determine the proper size for apr_int64_t'
  -    int64_t_fmt_len='#error Can not determine the proper size for apr_int64_t'
  -    uint64_t_fmt='#error Can not determine the proper size for apr_int64_t'
  -    uint64_t_fmt_len='#error Can not determine the proper size for apr_int64_t'
  -    uint64_t_hex_fmt='#error Can not determine the proper size for apr_uint64_t'
  +    AC_ERROR([could not detect a 64-bit integer type])
   fi
   
   # If present, allow the C99 macro INT64_C to override our conversion.
  @@ -1245,9 +1230,7 @@
   AC_SUBST(ssize_t_value)
   AC_SUBST(socklen_t_value)
   AC_SUBST(int64_t_fmt) 
  -AC_SUBST(int64_t_fmt_len) 
   AC_SUBST(uint64_t_fmt) 
  -AC_SUBST(uint64_t_fmt_len) 
   AC_SUBST(uint64_t_hex_fmt) 
   AC_SUBST(ssize_t_fmt) 
   AC_SUBST(size_t_fmt)
  
  
  
  1.127     +0 -3      apr/include/apr.h.in
  
  Index: apr.h.in
  ===================================================================
  RCS file: /home/cvs/apr/include/apr.h.in,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -u -r1.126 -r1.127
  --- apr.h.in	1 Oct 2003 13:19:43 -0000	1.126
  +++ apr.h.in	1 Oct 2003 21:08:16 -0000	1.127
  @@ -384,15 +384,12 @@
   
   /* And APR_INT64_T_FMT */
   @int64_t_fmt@
  -@int64_t_fmt_len@
   
   /* And APR_UINT64_T_FMT */
   @uint64_t_fmt@
  -@uint64_t_fmt_len@
   
   /* And APR_UINT64_T_HEX_FMT */
   @uint64_t_hex_fmt@
  -#define APR_UINT64_T_HEX_FMT_LEN  (sizeof(APR_UINT64_T_HEX_FMT) - 1)
   
   /* Deal with atoi64 variables ... these should move to apr_private.h */
   #define APR_HAVE_INT64_STRFN  @have_int64_strfn@
  
  
  
  1.36      +0 -3      apr/include/apr.hnw
  
  Index: apr.hnw
  ===================================================================
  RCS file: /home/cvs/apr/include/apr.hnw,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -u -r1.35 -r1.36
  --- apr.hnw	1 Oct 2003 13:19:43 -0000	1.35
  +++ apr.hnw	1 Oct 2003 21:08:16 -0000	1.36
  @@ -354,11 +354,8 @@
   #define APR_PATH_MAX PATH_MAX
   
   #define APR_INT64_T_FMT          "lld"
  -#define APR_INT64_T_FMT_LEN      3
   #define APR_UINT64_T_FMT         "llu"
  -#define APR_UINT64_T_FMT_LEN     3
   #define APR_UINT64_T_HEX_FMT     "llx"
  -#define APR_UINT64_T_HEX_FMT_LEN (sizeof(APR_UINT64_T_HEX_FMT) - 1)
   #define APR_TIME_T_FMT APR_INT64_T_FMT
   
   /* Deal with atoi64 variables ... these should move to apr_private.h */
  
  
  
  1.117     +0 -3      apr/include/apr.hw
  
  Index: apr.hw
  ===================================================================
  RCS file: /home/cvs/apr/include/apr.hw,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -u -r1.116 -r1.117
  --- apr.hw	1 Oct 2003 13:19:43 -0000	1.116
  +++ apr.hw	1 Oct 2003 21:08:16 -0000	1.117
  @@ -495,11 +495,8 @@
   #define APR_PID_T_FMT            "d"
   
   #define APR_INT64_T_FMT          "I64d"
  -#define APR_INT64_T_FMT_LEN      4
   #define APR_UINT64_T_FMT         "I64u"
  -#define APR_UINT64_T_FMT_LEN     4
   #define APR_UINT64_T_HEX_FMT     "I64x"
  -#define APR_UINT64_T_HEX_FMT_LEN (sizeof(APR_UINT64_T_HEX_FMT) - 1)
   
   /* Deal with atoi64 variables ... these should move to apr_private.h */
   /* MSVC 7.0 introduced _strtoui64 */
  
  
  
  1.36      +10 -10    apr/strings/apr_snprintf.c
  
  Index: apr_snprintf.c
  ===================================================================
  RCS file: /home/cvs/apr/strings/apr_snprintf.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -u -r1.35 -r1.36
  --- apr_snprintf.c	20 Jun 2003 12:56:52 -0000	1.35
  +++ apr_snprintf.c	1 Oct 2003 21:08:17 -0000	1.36
  @@ -838,17 +838,17 @@
                   adjust_precision = adjust_width = NO;
   
               /*
  -             * Modifier check
  +             * Modifier check.  Note that if APR_INT64_T_FMT is "d",
  +             * the first if condition is never true.
                */
  -#if defined(APR_INT64_T_FMT_LEN) && (APR_INT64_T_FMT_LEN == 3)
  -            if ((*fmt == APR_INT64_T_FMT[0]) &&
  -                (fmt[1] == APR_INT64_T_FMT[1])) {
  -#elif defined(APR_INT64_T_FMT_LEN) && (APR_INT64_T_FMT_LEN == 2)
  -            if (*fmt == APR_INT64_T_FMT[0]) {
  -#else
  -            if (strncmp(fmt, APR_INT64_T_FMT, 
  -                             sizeof(APR_INT64_T_FMT) - 2) == 0) {
  -#endif
  +            if ((sizeof(APR_INT64_T_FMT) == 4 &&
  +                 fmt[0] == APR_INT64_T_FMT[0] &&
  +                 fmt[1] == APR_INT64_T_FMT[1]) ||
  +                (sizeof(APR_INT64_T_FMT) == 3 &&
  +                 fmt[0] == APR_INT64_T_FMT[0]) ||
  +                (sizeof(APR_INT64_T_FMT) > 4 &&
  +                 strncmp(fmt, APR_INT64_T_FMT, 
  +                         sizeof(APR_INT64_T_FMT) - 2) == 0)) {
                   /* Need to account for trailing 'd' and null in sizeof() */
                   var_type = IS_QUAD;
                   fmt += (sizeof(APR_INT64_T_FMT) - 2);
  
  
  

Mime
View raw message