dovecot-2.2: lib: strnum: Fixed test suite failure on 32 bit sys...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 8 10:32:37 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/e4438e342208
changeset: 19129:e4438e342208
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Sep 08 13:26:38 2015 +0300
description:
lib: strnum: Fixed test suite failure on 32 bit systems.

diffstat:

 src/lib/test-strnum.c |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r 500e8dd7a389 -r e4438e342208 src/lib/test-strnum.c
--- a/src/lib/test-strnum.c	Tue Sep 08 13:18:58 2015 +0300
+++ b/src/lib/test-strnum.c	Tue Sep 08 13:26:38 2015 +0300
@@ -10,15 +10,16 @@
 /* always pads with leading zeros to a size of 9 digits */
 static int crappy_uintmax_to_str(char *into, uintmax_t val)
 {
-#define BIGBASE 1000000000u
+#define BIGBASE 1000000000ull
 #define STRINGIFY(s) #s
 #define STRINGIFY2(s) STRINGIFY(s)
 	int len = 0;
 	if(val >= BIGBASE) {
 		len = crappy_uintmax_to_str(into, val/BIGBASE);
 	}
-	i_snprintf(into + len, 10, "%09lu", (unsigned long)(val % BIGBASE));
-	return len + strlen(STRINGIFY2(BIGBASE))-2;
+	i_snprintf(into + len, 10, "%09llu",
+		(unsigned long long)(val % BIGBASE));
+	return len + strlen(STRINGIFY2(BIGBASE))-4;
 #undef STRINGIFY2
 #undef STRINGIFY
 #undef BIGBASE
@@ -82,15 +83,16 @@
 /* always pads with leading zeros to a size of 9 digits */
 static int crappy_uintmax_to_str_hex(char *into, uintmax_t val)
 {
-#define BIGBASE 0x1000000000
+#define BIGBASE 0x1000000000ull
 #define STRINGIFY(s) #s
 #define STRINGIFY2(s) STRINGIFY(s)
 	int len = 0;
 	if(val >= BIGBASE) {
 		len = crappy_uintmax_to_str_hex(into, val/BIGBASE);
 	}
-	i_snprintf(into + len, 10, "%09lx", (unsigned long)(val % BIGBASE));
-	return len + strlen(STRINGIFY2(BIGBASE))-3;
+	i_snprintf(into + len, 10, "%09llx",
+		(unsigned long long)(val % BIGBASE));
+	return len + strlen(STRINGIFY2(BIGBASE))-6;
 #undef STRINGIFY2
 #undef STRINGIFY
 #undef BIGBASE
@@ -156,15 +158,16 @@
 /* always pads with leading zeros to a size of 9 digits */
 static int crappy_uintmax_to_str_oct(char *into, uintmax_t val)
 {
-#define BIGBASE 01000000000
+#define BIGBASE 01000000000ull
 #define STRINGIFY(s) #s
 #define STRINGIFY2(s) STRINGIFY(s)
 	int len = 0;
 	if(val >= BIGBASE) {
 		len = crappy_uintmax_to_str_oct(into, val/BIGBASE);
 	}
-	i_snprintf(into + len, 10, "%09lo", (unsigned long)(val % BIGBASE));
-	return len + strlen(STRINGIFY2(BIGBASE))-2;
+	i_snprintf(into + len, 10, "%09llo",
+		(unsigned long long)(val % BIGBASE));
+	return len + strlen(STRINGIFY2(BIGBASE))-5;
 #undef STRINGIFY2
 #undef STRINGIFY
 #undef BIGBASE


More information about the dovecot-cvs mailing list