From 93365331b1bfba9d559ca30854f6af6793cde14f Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 15 Jan 2011 18:47:03 +0100 Subject: [PATCH] use the gnu format string checker for CtdlLogPrintf; fix associated new warnings / problems. --- citadel/context.c | 2 +- citadel/file_ops.c | 2 +- citadel/modules/calendar/serv_calendar.c | 2 +- citadel/modules/expire/serv_expire.c | 2 +- citadel/modules/migrate/serv_migrate.c | 4 ++-- citadel/modules/openid/serv_openid_rp.c | 6 +++--- citadel/modules/wiki/serv_wiki.c | 2 +- citadel/sysdep_decls.h | 2 +- citadel/threads.c | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/citadel/context.c b/citadel/context.c index ef3e7d935..5d29ce6f6 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -468,7 +468,7 @@ void CtdlFillSystemContext(CitContext *context, char *name) if (context->user.usernum == 0) { /* old system user with number 0, upgrade it */ context->user.usernum = get_new_user_number(); - CtdlLogPrintf(CTDL_DEBUG, "Upgrading system user \"%s\" from user number 0 to user number %d\n", context->user.fullname, context->user.usernum); + CtdlLogPrintf(CTDL_DEBUG, "Upgrading system user \"%s\" from user number 0 to user number %ld\n", context->user.fullname, context->user.usernum); /* add user to the database */ CtdlPutUser(&(context->user)); cdb_store(CDB_USERSBYNUMBER, &(context->user.usernum), sizeof(long), context->user.fullname, strlen(context->user.fullname)+1); diff --git a/citadel/file_ops.c b/citadel/file_ops.c index e4453cbdb..ee2e93a05 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -601,7 +601,7 @@ void cmd_ucls(char *cmd) unlink(CC->upl_path); } else { - CtdlLogPrintf(CTDL_ALERT, "Cannot link %d to %d: %s\n", + CtdlLogPrintf(CTDL_ALERT, "Cannot link %s to %s: %s\n", CC->upl_path, final_filename, strerror(errno) ); } diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index f697f3570..d2bf8d03f 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -1787,7 +1787,7 @@ void ical_putics(void) HashPos = GetNewHashPos(tzidlist, 0); while (GetNextHashPos(tzidlist, HashPos, &len, &Key, &Value)) { - CtdlLogPrintf(CTDL_DEBUG, "Attaching timezone '%s'\n", Value); + CtdlLogPrintf(CTDL_DEBUG, "Attaching timezone '%s'\n", (char*) Value); icaltimezone *t = NULL; /* First look for a timezone attached to the original calendar */ diff --git a/citadel/modules/expire/serv_expire.c b/citadel/modules/expire/serv_expire.c index b08fb974f..22442ad15 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -840,7 +840,7 @@ int PurgeStaleOpenIDassociations(void) { HashPos = GetNewHashPos(keys, 0); while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0) { - CtdlLogPrintf(CTDL_DEBUG, "Deleting associated OpenID <%s>\n", Value); + CtdlLogPrintf(CTDL_DEBUG, "Deleting associated OpenID <%s>\n", (char*)Value); cdb_delete(CDB_OPENID, Value, strlen(Value)); /* note: don't free(Value) -- deleting the hash list will handle this for us */ ++num_deleted; diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index d1b6cfca0..e71801c3b 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -547,7 +547,7 @@ void migr_xml_start(void *data, const char *el, const char **attr) { } if (citadel_migrate_data != 1) { - CtdlLogPrintf(CTDL_ALERT, "Out-of-sequence tag <%s> detected. Warning: ODD-DATA!\n"); + CtdlLogPrintf(CTDL_ALERT, "Out-of-sequence tag <%s> detected. Warning: ODD-DATA!\n", el); return; } @@ -592,7 +592,7 @@ void migr_xml_end(void *data, const char *el) { } if (citadel_migrate_data != 1) { - CtdlLogPrintf(CTDL_ALERT, "Out-of-sequence tag <%s> detected. Warning: ODD-DATA!\n"); + CtdlLogPrintf(CTDL_ALERT, "Out-of-sequence tag <%s> detected. Warning: ODD-DATA!\n", el); return; } diff --git a/citadel/modules/openid/serv_openid_rp.c b/citadel/modules/openid/serv_openid_rp.c index 6c2daad63..aee397cad 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -125,11 +125,11 @@ int attach_openid(struct ctdluser *who, StrBuf *claimed_id) cdb_free(cdboi); if (fetched_usernum == who->usernum) { - CtdlLogPrintf(CTDL_INFO, "%s already associated; no action is taken\n", claimed_id); + CtdlLogPrintf(CTDL_INFO, "%s already associated; no action is taken\n", ChrPtr(claimed_id)); return(0); } else { - CtdlLogPrintf(CTDL_INFO, "%s already belongs to another user\n", claimed_id); + CtdlLogPrintf(CTDL_INFO, "%s already belongs to another user\n", ChrPtr(claimed_id)); return(3); } } @@ -188,7 +188,7 @@ void openid_purge(struct ctdluser *usbuf) { HashPos = GetNewHashPos(keys, 0); while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0) { - CtdlLogPrintf(CTDL_DEBUG, "Deleting associated OpenID <%s>\n", Value); + CtdlLogPrintf(CTDL_DEBUG, "Deleting associated OpenID <%s>\n", (char*)Value); cdb_delete(CDB_OPENID, Value, strlen(Value)); /* note: don't free(Value) -- deleting the hash list will handle this for us */ } diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index e005e8609..abaa71e1f 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -572,7 +572,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) fseek(fp, 0L, SEEK_SET); msg->cm_fields['M'] = malloc(len + 1); rv = fread(msg->cm_fields['M'], len, 1, fp); - CtdlLogPrintf(CTDL_DEBUG, "did %d blocks of %d bytes\n", rv, len); + CtdlLogPrintf(CTDL_DEBUG, "did %d blocks of %ld bytes\n", rv, len); msg->cm_fields['M'][len] = 0; fclose(fp); } diff --git a/citadel/sysdep_decls.h b/citadel/sysdep_decls.h index a95afedf2..663e9b50b 100644 --- a/citadel/sysdep_decls.h +++ b/citadel/sysdep_decls.h @@ -47,7 +47,7 @@ void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2) void cprintf (const char *format, ...); #endif -void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...); +void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...) __attribute__((__format__(__printf__,2,3))); void vCtdlLogPrintf (enum LogLevel loglevel, const char *format, va_list arg_ptr); extern int enable_syslog; diff --git a/citadel/threads.c b/citadel/threads.c index f1be5a39a..0dcf4c38e 100644 --- a/citadel/threads.c +++ b/citadel/threads.c @@ -623,7 +623,7 @@ static void ctdl_internal_thread_cleanup(void *arg) const char *name = CT->name; const pid_t tid = CT->tid; - CtdlLogPrintf(CTDL_NOTICE, "Thread \"%s\" (0x%08lx) exited.\n", name, tid); + CtdlLogPrintf(CTDL_NOTICE, "Thread \"%s\" (0x%08lx) exited.\n", name, (unsigned long) tid); } else { @@ -1257,7 +1257,7 @@ void go_threading(void) /* * This thread is now used for garbage collection of other threads in the thread list */ - CtdlLogPrintf(CTDL_INFO, "Startup thread %d becoming garbage collector,\n", citthread_self()); + CtdlLogPrintf(CTDL_INFO, "Startup thread %ld becoming garbage collector,\n", (long) citthread_self()); /* * We do a lot of locking and unlocking of the thread list in here. -- 2.30.2