use the gnu format string checker for CtdlLogPrintf; fix associated new warnings...
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 15 Jan 2011 17:47:03 +0000 (18:47 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 15 Jan 2011 17:58:40 +0000 (18:58 +0100)
citadel/context.c
citadel/file_ops.c
citadel/modules/calendar/serv_calendar.c
citadel/modules/expire/serv_expire.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/openid/serv_openid_rp.c
citadel/modules/wiki/serv_wiki.c
citadel/sysdep_decls.h
citadel/threads.c

index ef3e7d935d7fd8d43e648b6fea9818a3c84e134d..5d29ce6f6d2e6fa60469c3d81a34871d61e08680 100644 (file)
@@ -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);
index e4453cbdbdc3b97f055403caa48dc0a467f57e7c..ee2e93a05f2ddae13451f3ca52bad8746b328114 100644 (file)
@@ -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)
                                );
                        }
index f697f3570022c35048a13ed9f69110e56e7c417b..d2bf8d03fc248f0c9f8bf997dd19c0e0e1b594d7 100644 (file)
@@ -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 */
index b08fb974fca7a1054c8d8abcbbdf90acbe09eae7..22442ad1526cc255ff5dfbad339fd39d096fdd6d 100644 (file)
@@ -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;
index d1b6cfca05a94337ffdcea99ecb7a5e5a9543c7e..e71801c3bd003706d051549ed56e3aef6e5b5358 100644 (file)
@@ -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;
        }
 
index 6c2daad63fbedc461613f0078d3365f677b9c5f6..aee397cad8565d4411fe76d63e5a9bdecac0ec17 100644 (file)
@@ -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 */
        }
index e005e8609f071efb2184b769555a0ca3b9bcbd6c..abaa71e1f5db374099f9c3d3c017678110e58e9d 100644 (file)
@@ -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);
                }
index a95afedf27323892e54b332a53d8855bc096b008..663e9b50b0b0108683cd90099af0b94fbf17704f 100644 (file)
@@ -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;
index f1be5a39ac1737806ec93c5a68212dd1b7f8347d..0dcf4c38e8e4c255a98bc23e3cde03cf14a988f7 100644 (file)
@@ -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.