fix format warnings and some OpenBSD specific fixes
authorPaul <paul@claws-mail.org>
Wed, 14 Oct 2015 17:14:17 +0000 (18:14 +0100)
committerPaul <paul@claws-mail.org>
Wed, 14 Oct 2015 17:14:17 +0000 (18:14 +0100)
Patch by Daniel Jakots.

src/plugins/mailmbox/mailimf_types_helper.c
src/plugins/mailmbox/mailmbox.c
src/plugins/managesieve/sieve_prefs.c
src/plugins/rssyl/parse822.c
src/plugins/rssyl/rssyl_add_item.c
src/plugins/rssyl/rssyl_deleted.c
src/plugins/vcalendar/vcal_folder.c
src/plugins/vcalendar/vcal_manager.c
src/plugins/vcalendar/vcal_meeting_gtk.c

index 384e7a6e11929fda58bb816db24a9742d3921b11..a0c4e960f9e032cb7a61813d67a2182473b21fcb 100644 (file)
@@ -1267,8 +1267,8 @@ char * mailimf_get_message_id(void)
   value = random();
 
   gethostname(name, MAX_MESSAGE_ID);
-  snprintf(id, MAX_MESSAGE_ID, "etPan.%lx.%lx.%x@%s",
-          now, value, getpid(), name);
+  snprintf(id, MAX_MESSAGE_ID, "etPan.%llx.%lx.%x@%s",
+          (long long)now, value, getpid(), name);
 
   return strdup(id);
 }
index 1d0578d89a6c5f38b41afee69c97236c04293adb..f37c0e907a704288ac9ab380775e5c4b253c9b3e 100644 (file)
@@ -154,7 +154,7 @@ int claws_mailmbox_map(struct claws_mailmbox_folder * folder)
                        MAP_SHARED, folder->mb_fd, 0);
   if (str == MAP_FAILED) {
     perror("mmap");
-    debug_print("map of %lu bytes failed\n", buf.st_size);
+    debug_print("map of %lld bytes failed\n", (long long)buf.st_size);
     res = MAILMBOX_ERROR_FILE;
     goto err;
   }
index c1c82d172f75b620affde3f64b2365b8cdd914ba..9976da7d4e70bd7c4ace17993ca269c19022327c 100644 (file)
@@ -464,7 +464,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
        gchar enc_userid[256], enc_passwd[256];
        gchar enable, use_host, use_port;
        gsize len;
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) || defined(__OpenBSD__)
        /* Windows sscanf() does not understand the %ms format yet, so we
         * have to do the allocation of target buffer ourselves before
         * calling sscanf(), and copy the host string to config->host.
@@ -489,13 +489,13 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
        if (confstr == NULL)
                return config;
 
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) || defined(__OpenBSD__)
        sscanf(confstr, "%c%c %255s %c%hu %hhu %hhu %hhu %255s %255s",
 #else
        sscanf(confstr, "%c%c %ms %c%hu %hhu %hhu %hhu %255s %255s",
 #endif
                        &enable, &use_host,
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) || defined(__OpenBSD__)
                        tmphost,
 #else
                        &config->host,
@@ -507,7 +507,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
                        enc_userid,
                        enc_passwd);
 
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) || defined(__OpenBSD__)
        config->host = g_strndup(tmphost, 255);
 #endif
 
index fa17f7b4418d54eefc1b3b8b9235429111847e97..ca8b8420db59fc617fd058f60d40d26c1944fc53 100644 (file)
@@ -135,7 +135,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
                                /* Last-Seen timestamp */
                                if( !strcmp(line[0], "X-RSSyl-Last-Seen") ) {
                                        ctx->last_seen = atol(line[1]);
-                                       debug_print("RSSyl: got last_seen timestamp %ld\n", ctx->last_seen);
+                                       debug_print("RSSyl: got last_seen timestamp %lld\n", (long long)ctx->last_seen);
                                }
 
                                /* ID */
index 342b28f0f7d9cf500aa7dd495228eb23fd036e9b..922ad4eadec0995eb81b12f67c782b0ec78ba5ee 100644 (file)
@@ -463,7 +463,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
                fprintf(f, "X-RSSyl-URL: %s\n", tmpurl);
 
        if( ritem->last_update > 0) {
-               fprintf(f, "X-RSSyl-Last-Seen: %ld\n", ritem->last_update);
+               fprintf(f, "X-RSSyl-Last-Seen: %lld\n", (long long)ritem->last_update);
        }
 
        /* Message-ID */
index 40328a0e4015db436f75846e5482899865c29b57..7a4aabebf55bc95608664ecab6ca53b846084e9f 100644 (file)
@@ -160,10 +160,11 @@ static void _store_one_deleted_item(gpointer data, gpointer user_data)
        err |= (fprintf(f,
                        "ID: %s\n"
                        "TITLE: %s\n"
-                       "DPUB: %ld\n"
-                       "DMOD: %ld\n",
+                       "DPUB: %lld\n"
+                       "DMOD: %lld\n",
                        ditem->id, ditem->title,
-                       ditem->date_published, ditem->date_modified) < 0);
+                       (long long)ditem->date_published,
+                       (long long)ditem->date_modified) < 0);
 
        if (err)
                debug_print("RSSyl: Error during writing deletion file.\n");
index a78c2dd5f9b740eebc7310f908d04407c0345ec7..b02ee7646f26484948f109688348f12f82931244 100644 (file)
@@ -1161,7 +1161,8 @@ static void vcal_set_mtime(Folder *folder, FolderItem *item)
        }
 
        item->mtime = s.st_mtime;
-       debug_print("VCAL: forced mtime of %s to %ld\n", item->name?item->name:"(null)", item->mtime);
+       debug_print("VCAL: forced mtime of %s to %lld\n",
+                       item->name?item->name:"(null)", (long long)item->mtime);
        g_free(path);
 }
 
index 58675143dddb7eabfcbcfa2ef29dea894183f6e9..1f11f26f448eb1307e304c24adda106b13d9120a 100644 (file)
@@ -920,7 +920,7 @@ void vcal_manager_save_event (VCalEvent *event, gboolean export_after)
        xml_tag_add_attr(tag, xml_attr_new("type", tmp));
        g_free(tmp);
        
-       tmp = g_strdup_printf("%lu", event->postponed);
+       tmp = g_strdup_printf("%lld", (long long)event->postponed);
        xml_tag_add_attr(tag, xml_attr_new("postponed", tmp));
        g_free(tmp);
        
index de0ce34fb9d74cb0ab3ef6c5cbc53e1770835b36..0b0e12358098304049705db4187c1584c13fc414 100644 (file)
@@ -1962,7 +1962,8 @@ void multisync_export(void)
        list = vcal_folder_get_waiting_events();
        for (cur = list; cur; cur = cur->next) {
                VCalEvent *event = (VCalEvent *)cur->data;
-               file = g_strdup_printf("multisync%lu-%d", time(NULL), i);
+               file = g_strdup_printf("multisync%lld-%d",
+                               (long long)time(NULL), i);
 
                i++;