From: Wilfried Goesgens Date: Sat, 15 Jan 2011 17:47:03 +0000 (+0100) Subject: use the gnu format string checker for CtdlLogPrintf; fix associated new warnings... X-Git-Tag: v7.86~17 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=81bb927e00b7041625c1c12e770ed2b590f6eeb5 use the gnu format string checker for CtdlLogPrintf; fix associated new warnings / problems. --- diff --git a/citadel/context.c b/citadel/context.c index 2681d85a8..e6707e679 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -451,7 +451,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 413e32da1..fd55929df 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -591,7 +591,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 e1e02ae54..af2b6a62c 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -1789,7 +1789,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 25c926bf1..45ac70de5 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -842,7 +842,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 8b431c8af..598ce1253 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -549,7 +549,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; } @@ -594,7 +594,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 638a77bdd..bb3c998e9 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -127,11 +127,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); } } @@ -190,7 +190,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 8f306a5dd..959601315 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 3eaccf20f..478a0ba48 100644 --- a/citadel/sysdep_decls.h +++ b/citadel/sysdep_decls.h @@ -48,7 +48,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 b3f13a02e..6e4b9fcdc 100644 --- a/citadel/threads.c +++ b/citadel/threads.c @@ -608,7 +608,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 { @@ -1301,7 +1301,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.