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 18:00:12 +0000 (19:00 +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 2681d85a80b986ac868bcf7dbbbb989797413ddd..e6707e679f2ab83185c83dad9158470690c4cd82 100644 (file)
@@ -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);
index 413e32da1aa6f62f6fc41fc6f0d4b3916c6f0466..fd55929df6bb76a1ae5b48740d991818d49e41bc 100644 (file)
@@ -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)
                                );
                        }
index e1e02ae544b0caf6c73704ec66cb2675e51d1422..af2b6a62c17c5ebc5502f7ecdd4956bf12058ea0 100644 (file)
@@ -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 */
index 25c926bf1b31d86acabe359ab338c947ed10fa14..45ac70de5ac03d946ff611b542a4533e4f6a962b 100644 (file)
@@ -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;
index 8b431c8afbfdf021b9f290da5c5746ad85688e08..598ce1253f6c96bcf52c6f1998bea72b38b21a96 100644 (file)
@@ -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;
        }
 
index 638a77bdd5dc031505a5ca696c293c8f87077afd..bb3c998e9e06301bc69fbf7c8e03875968d72a8e 100644 (file)
@@ -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 */
        }
index 8f306a5dd70d7be96c0e985cad0888ce8308e628..9596013153091a307a6e794b8822082ad2825d04 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 3eaccf20f5762dbbf1355c289431251f3a4337e7..478a0ba4897df85c82cd064992867c9e5533caaa 100644 (file)
@@ -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;
index b3f13a02e37e850f305e1b01c2412c5f7c36acc9..6e4b9fcdcd9af14fe80e1c1b83d214301676391b 100644 (file)
@@ -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.