Fix printf formats for size_t and goffset arguments.
[claws.git] / src / plugins / tnef_parse / tnef_parse.c
index a9f926f3b6778f0184d30c231e9d4875f24f76a4..82a8f9e81ab5aaff737a9db3c9c975828e3bd4b5 100644 (file)
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+
+#ifdef YTNEF_H_SUBDIR
+#include <libytnef/tnef-types.h>
+#include <libytnef/ytnef.h>
+#include <libytnef/mapi.h>
+#include <libytnef/mapidefs.h>
+#else
+#include <tnef-types.h>
+#include <ytnef.h>
+#include <mapi.h>
+#include <mapidefs.h>
+#endif
+
 #include "common/claws.h"
 #include "common/version.h"
 #include "main.h"
 #include "plugin.h"
 #include "procmime.h"
 #include "utils.h"
-
-#include <tnef-types.h>
-#include <ytnef.h>
-#include <mapi.h>
-#include <mapidefs.h>
+#include "file-utils.h"
 
 #include "tnef_dump.h"
 
@@ -66,7 +75,7 @@ static MimeInfo *tnef_broken_mimeinfo(const gchar *reason)
                        "Claws Mail TNEF parser:\n\n"
                        "%s\n"), reason?reason:_("Unknown error"));
 
-       fclose(fp);
+       claws_fclose(fp);
        if (g_stat(tmpfilename, &statbuf) < 0) {
                claws_unlink(tmpfilename);
                procmime_mimeinfo_free_all(&sub_info);
@@ -114,14 +123,14 @@ static MimeInfo *tnef_dump_file(const gchar *filename, char *data, size_t size)
                }
        } 
 
-       if (fwrite(data, 1, size, fp) < size) {
-               FILE_OP_ERROR(tmpfilename, "fwrite");
-               fclose(fp);
+       if (claws_fwrite(data, 1, size, fp) < size) {
+               FILE_OP_ERROR(tmpfilename, "claws_fwrite");
+               claws_fclose(fp);
                claws_unlink(tmpfilename);
                procmime_mimeinfo_free_all(&sub_info);
                return tnef_broken_mimeinfo(_("Failed to write the part data."));
        }
-       fclose(fp);
+       claws_fclose(fp);
 
        if (g_stat(tmpfilename, &statbuf) < 0) {
                claws_unlink(tmpfilename);
@@ -158,7 +167,7 @@ MimeInfo *tnef_parse_vcal(TNEFStruct *tnef)
 
        result = SaveVCalendar(fp, tnef);
 
-       fclose(fp);
+       claws_fclose(fp);
 
        if (g_stat(tmpfilename, &statbuf) < 0) {
                result = FALSE;
@@ -198,7 +207,7 @@ MimeInfo *tnef_parse_vtask(TNEFStruct *tnef)
 
        result = SaveVTask(fp, tnef);
 
-       fclose(fp);
+       claws_fclose(fp);
 
        if (g_stat(tmpfilename, &statbuf) < 0) {
                result = FALSE;
@@ -252,7 +261,7 @@ MimeInfo *tnef_parse_vcard(TNEFStruct *tnef)
        
        result = SaveVCard(fp, tnef);
        
-       fclose(fp);
+       claws_fclose(fp);
 
        ret = g_stat(tmpfilename, &statbuf);
        if (ret == -1) {
@@ -288,7 +297,7 @@ static gboolean tnef_parse (MimeParser *parser, MimeInfo *mimeinfo)
        if (mimeinfo->content == MIMECONTENT_FILE)
                debug_print("content: %s\n", mimeinfo->data.filename);
        else 
-               debug_print("contents in memory (len %zd)\n", 
+               debug_print("contents in memory (len %"G_GSIZE_FORMAT")\n", 
                        strlen(mimeinfo->data.mem));
        
        tnef = g_new0(TNEFStruct, 1);