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 384e7a6..a0c4e96 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 1d0578d..f37c0e9 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 c1c82d1..9976da7 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 fa17f7b..ca8b842 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 342b28f..922ad4e 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 40328a0..7a4aabe 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 a78c2dd..b02ee76 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 5867514..1f11f26 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 de0ce34..0b0e123 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++;