dovecot-2.2: lib: test-array build warnings on Solaris 10

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 16 08:48:05 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/7c90285a72a6
changeset: 18405:7c90285a72a6
user:      Phil Carmody <phil at dovecot.fi>
date:      Thu Apr 16 11:46:22 2015 +0300
description:
lib: test-array build warnings on Solaris 10
Solaris cc doesn't think I've read N1570 6.7.9p11, 6.5.16.1p2, and 6.3.1.3p2,
and wants to save me from myself.

Reported-by: Juergen Obermann <http://www.dovecot.org/list/dovecot/2015-April/100427.html>
Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/test-array.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 1c17f06d5e52 -r 7c90285a72a6 src/lib/test-array.c
--- a/src/lib/test-array.c	Wed Apr 15 21:01:11 2015 +0300
+++ b/src/lib/test-array.c	Thu Apr 16 11:46:22 2015 +0300
@@ -126,7 +126,7 @@
 static void test_array_cmp(void)
 {
 	static const unsigned short deltas[] = {
-		-32768, -16384, -512, -256, -128, -64, -2, -1,
+		0x8000, 0xc000, 0xfe00, 0xff00, 0xff80, 0xffc0, 0xfffe, 0xffff,
 		0, 1, 2, 64, 128, 256, 512, 16384, 32768
 	};
 
@@ -151,7 +151,8 @@
 
 	for (i = 0; i < 256; i++) {
 		unsigned int j = rand() % NELEMS;
-		unsigned short tmp = *array_idx(&arr2, j);
+		const unsigned short *ptmp = array_idx(&arr2, j);
+		unsigned short tmp = *ptmp;
 		unsigned short repl = tmp + deltas[rand() % N_ELEMENTS(deltas)];
 
 		array_idx_set(&arr2, j, &repl);
@@ -203,7 +204,8 @@
 	test_assert(array_equal_fn(&arr1, &arr2, test_compare_string) == 1); /* therefore value same */
 	for (i = 0; i < 2560; i++) {
 		unsigned int j = rand() % NELEMS;
-		const char *ostr = *array_idx(&arr2, j);
+		const char *const *ostr_p = array_idx(&arr2, j);
+		const char *ostr = *ostr_p;
 		unsigned int olen = strlen(ostr);
 		unsigned int rc = rand() % (olen + 1);
 		char ochar = ostr[rc];


More information about the dovecot-cvs mailing list