From 1d9b64837473823cbdc739725da673819c9b1210 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 11 Sep 2007 20:00:18 +0000 Subject: [PATCH] * 64 bit cleanness: format size_t properly in printf() --- citadel/configure.ac | 2 ++ citadel/modules/funambol/serv_funambol.c | 2 +- citadel/modules/imap/imap_fetch.c | 17 ++++++++++------- citadel/sysdep_decls.h | 6 ++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/citadel/configure.ac b/citadel/configure.ac index 82aeece2d..929a3978c 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -284,6 +284,7 @@ AC_MSG_CHECKING([how to create dependancy checks]) fi AC_SUBST(DEPEND_FLAG) + AC_PROG_INSTALL AC_PROG_YACC missing_dir=`cd $ac_aux_dir && pwd` @@ -297,6 +298,7 @@ AC_CHECK_SIZEOF(char, 0) AC_CHECK_SIZEOF(short, 0) AC_CHECK_SIZEOF(int, 0) AC_CHECK_SIZEOF(long, 0) +AC_CHECK_SIZEOF(size_t, 0) dnl AC_CHECK_SIZEOF(long long, 0) dnl Checks for libraries. diff --git a/citadel/modules/funambol/serv_funambol.c b/citadel/modules/funambol/serv_funambol.c index 827bdb717..3ea217105 100644 --- a/citadel/modules/funambol/serv_funambol.c +++ b/citadel/modules/funambol/serv_funambol.c @@ -189,7 +189,7 @@ void notify_funambol(long msgnum, void *userdata) { ); strcat(SOAPHeader,buf); strcat(SOAPHeader,"Pragma: no-cache\r\nSOAPAction: \"\"\r\n"); - sprintf(buf, "Content-Length: %d\r\n", + sprintf(buf, "Content-Length: " SIZE_T_FMT "\r\n", strlen(SOAPData)); strcat(SOAPHeader, buf); sprintf(buf, "Authorization: Basic %s\r\n\r\n", diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 216568812..ae24522d1 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -219,11 +219,14 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) { text_size = 0; } - lprintf(CTDL_DEBUG, "RFC822: headers=%d, text=%d, total=%d\n", + lprintf(CTDL_DEBUG, + "RFC822: headers=" SIZE_T_FMT + ", text=" SIZE_T_FMT + ", total=" SIZE_T_FMT "\n", headers_size, text_size, total_size); if (!strcasecmp(whichfmt, "RFC822.SIZE")) { - cprintf("RFC822.SIZE %d", total_size); + cprintf("RFC822.SIZE " SIZE_T_FMT, total_size); return; } @@ -242,7 +245,7 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) { bytes_to_send = text_size; } - cprintf("%s {%d}\r\n", whichfmt, bytes_to_send); + cprintf("%s {" SIZE_T_FMT "}\r\n", whichfmt, bytes_to_send); client_write(ptr, bytes_to_send); } @@ -694,16 +697,16 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) { } if (is_partial == 0) { - cprintf("BODY[%s] {%d}\r\n", section, IMAP->cached_body_len); + cprintf("BODY[%s] {" SIZE_T_FMT "}\r\n", section, IMAP->cached_body_len); pstart = 0; pbytes = IMAP->cached_body_len; } else { - sscanf(partial, "%d.%d", &pstart, &pbytes); + sscanf(partial, SIZE_T_FMT "." SIZE_T_FMT, &pstart, &pbytes); if (pbytes > (IMAP->cached_body_len - pstart)) { pbytes = IMAP->cached_body_len - pstart; } - cprintf("BODY[%s]<%d> {%d}\r\n", section, pstart, pbytes); + cprintf("BODY[%s]<" SIZE_T_FMT "> {" SIZE_T_FMT "}\r\n", section, pstart, pbytes); } /* Here we go -- output it */ @@ -934,7 +937,7 @@ void imap_fetch_bodystructure (long msgnum, char *item, cprintf("BODYSTRUCTURE (\"TEXT\" \"PLAIN\" " "(\"CHARSET\" \"US-ASCII\") NIL NIL " - "\"7BIT\" %d %d)", rfc822_body_len, lines); + "\"7BIT\" " SIZE_T_FMT " %d)", rfc822_body_len, lines); return; } diff --git a/citadel/sysdep_decls.h b/citadel/sysdep_decls.h index 99a29e68e..b880d09ac 100644 --- a/citadel/sysdep_decls.h +++ b/citadel/sysdep_decls.h @@ -15,6 +15,12 @@ #include "sysdep.h" #include "server.h" +#if SIZEOF_SIZE_T == 8 +#define SIZE_T_FMT "%ld" +#else +#define SIZE_T_FMT "%d" +#endif + /* Logging levels - correspond to syslog(3) */ enum LogLevel { -- 2.30.2