trawick 2003/04/15 14:45:58
Modified: . CHANGES configure.in
include apr.h.in apr.hnw apr.hw
test testfmt.c
Log:
implement APR_UINT64_T_HEX_FMT
Reviewed by: Bill Rowe
Revision Changes Path
1.399 +2 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.398
retrieving revision 1.399
diff -u -r1.398 -r1.399
--- CHANGES 11 Apr 2003 20:27:37 -0000 1.398
+++ CHANGES 15 Apr 2003 21:45:57 -0000 1.399
@@ -1,5 +1,7 @@
Changes with APR 0.9.4
+ *) Add APR_UINT64_T_HEX_FMT. [Jeff Trawick]
+
*) Add parameter to APR_SUBDIR_CONFIG to drop options passed to configure
before the subdir's configure is invoked.
[Jeff Trawick, Justin Erenkrantz]
1.525 +7 -0 apr/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.524
retrieving revision 1.525
diff -u -r1.524 -r1.525
--- configure.in 4 Apr 2003 04:15:59 -0000 1.524
+++ configure.in 15 Apr 2003 21:45:57 -0000 1.525
@@ -1079,6 +1079,7 @@
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
int64_strfn="strtoi"
@@ -1088,6 +1089,7 @@
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
int64_strfn="strtol"
@@ -1101,6 +1103,7 @@
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"
int64_strfn="strtoll"
@@ -1110,6 +1113,7 @@
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"
int64_strfn="strtoll"
@@ -1119,6 +1123,7 @@
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"
int64_strfn="strtoll"
@@ -1130,6 +1135,7 @@
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'
fi
# If present, allow the C99 macro INT64_C to override our conversion.
@@ -1270,6 +1276,7 @@
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)
AC_SUBST(off_t_fmt)
1.123 +4 -0 apr/include/apr.h.in
Index: apr.h.in
===================================================================
RCS file: /home/cvs/apr/include/apr.h.in,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -r1.122 -r1.123
--- apr.h.in 23 Mar 2003 02:25:02 -0000 1.122
+++ apr.h.in 15 Apr 2003 21:45:58 -0000 1.123
@@ -396,6 +396,10 @@
@uint64_t_fmt@
@uint64_t_fmt_len@
+/* And APR_UINT64_T_HEX_FMT */
[EMAIL PROTECTED]@
+#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@
#define APR_INT64_STRFN @int64_strfn@
1.34 +2 -0 apr/include/apr.hnw
Index: apr.hnw
===================================================================
RCS file: /home/cvs/apr/include/apr.hnw,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- apr.hnw 23 Mar 2003 02:25:02 -0000 1.33
+++ apr.hnw 15 Apr 2003 21:45:58 -0000 1.34
@@ -362,6 +362,8 @@
#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.114 +2 -0 apr/include/apr.hw
Index: apr.hw
===================================================================
RCS file: /home/cvs/apr/include/apr.hw,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -r1.113 -r1.114
--- apr.hw 23 Mar 2003 02:25:02 -0000 1.113
+++ apr.hw 15 Apr 2003 21:45:58 -0000 1.114
@@ -495,6 +495,8 @@
#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.9 +20 -0 apr/test/testfmt.c
Index: testfmt.c
===================================================================
RCS file: /home/cvs/apr/test/testfmt.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- testfmt.c 1 Jan 2003 00:01:56 -0000 1.8
+++ testfmt.c 15 Apr 2003 21:45:58 -0000 1.9
@@ -102,6 +102,24 @@
CuAssertStrEquals(tc, buf, "0");
}
+static void uint64_t_fmt(CuTest *tc)
+{
+ char buf[100];
+ apr_uint64_t var = 14000000;
+
+ sprintf(buf, "%" APR_UINT64_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "14000000");
+}
+
+static void uint64_t_hex_fmt(CuTest *tc)
+{
+ char buf[100];
+ apr_uint64_t var = 14000000;
+
+ sprintf(buf, "%" APR_UINT64_T_HEX_FMT, var);
+ CuAssertStrEquals(tc, buf, "d59f80");
+}
+
CuSuite *testfmt(void)
{
CuSuite *suite = CuSuiteNew("Formats");
@@ -111,6 +129,8 @@
SUITE_ADD_TEST(suite, off_t_fmt);
SUITE_ADD_TEST(suite, pid_t_fmt);
SUITE_ADD_TEST(suite, int64_t_fmt);
+ SUITE_ADD_TEST(suite, uint64_t_fmt);
+ SUITE_ADD_TEST(suite, uint64_t_hex_fmt);
return suite;
}