From: Jeremy Harris Date: Sat, 2 Apr 2016 19:22:00 +0000 (+0100) Subject: Fix build on systems where size_t is (non-long) uint X-Git-Tag: exim-4_87^0 X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/74d8288d7a8fa83989968647149ae47ba10194f8 Fix build on systems where size_t is (non-long) uint The exemplar was Ubuntu 14.04 LTS 32-bit - but probably many 32-bit systems would be affected --- diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c index 4c1a72d51..27e73142f 100644 --- a/src/src/buildconfig.c +++ b/src/src/buildconfig.c @@ -105,8 +105,10 @@ time_t test_time_t = 0; size_t test_size_t = 0; ssize_t test_ssize_t = 0; unsigned long test_ulong_t = 0L; +unsigned int test_uint_t = 0; #endif long test_long_t = 0; +int test_int_t = 0; FILE *base; FILE *new; int last_initial = 'A'; @@ -190,12 +192,17 @@ fprintf(new, "#define SSIZE_T_FMT \"%%zd\"\n"); #else if (sizeof(test_size_t) > sizeof (test_ulong_t)) fprintf(new, "#define SIZE_T_FMT \"%%llu\"\n"); -else +else if (sizeof(test_size_t) > sizeof (test_uint_t)) fprintf(new, "#define SIZE_T_FMT \"%%lu\"\n"); +else + fprintf(new, "#define SIZE_T_FMT \"%%u\"\n"); + if (sizeof(test_ssize_t) > sizeof(test_long_t)) fprintf(new, "#define SSIZE_T_FMT \"%%lld\"\n"); -else +else if (sizeof(test_ssize_t) > sizeof(test_int_t)) fprintf(new, "#define SSIZE_T_FMT \"%%ld\"\n"); +else + fprintf(new, "#define SSIZE_T_FMT \"%%d\"\n"); #endif /* Now search the makefile for certain settings */