2009-04-08 [colin] 3.7.1cvs42
authorColin Leroy <colin@colino.net>
Wed, 8 Apr 2009 16:10:13 +0000 (16:10 +0000)
committerColin Leroy <colin@colino.net>
Wed, 8 Apr 2009 16:10:13 +0000 (16:10 +0000)
* src/procmime.c
fix saving (but not displaying) of UTF-16
files

ChangeLog
PATCHSETS
configure.ac
src/procmime.c

index 6135c2e4b39bbaa060463b5ef25c8a63c65d9a1f..c7b0cc0b9f85b497db34b4a466a35dd918f0cc39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-08 [colin]     3.7.1cvs42
+
+       * src/procmime.c
+               fix saving (but not displaying) of UTF-16
+               files
+
 2009-04-08 [colin]     3.7.1cvs41
 
        * src/gtk/manage_window.c
index b4dddb2b875bbb5eeee44b12e05bec9f4903d13b..e29e30af5bcaedcdb454b86c4af0a7831c2e957f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.100.2.67 -r 1.100.2.68 AUTHORS;  cvs diff -u -r 1.654.2.3846 -r 1.654.2.3847 configure.ac;  diff -u /dev/null po/id.po;  cvs diff -u -r 1.1.2.55 -r 1.1.2.56 src/gtk/authors.h;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 tools/claws.i18n.status.pl;  ) > 3.7.1cvs39.patchset
 ( cvs diff -u -r 1.150.2.114 -r 1.150.2.115 src/procmsg.c;  ) > 3.7.1cvs40.patchset
 ( cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/gtk/manage_window.c;  ) > 3.7.1cvs41.patchset
+( cvs diff -u -r 1.49.2.129 -r 1.49.2.130 src/procmime.c;  ) > 3.7.1cvs42.patchset
index 27ecea825b6a458aa3ed3fc339dd77349f7c2513..c6d40aa75af5f642eb56c7615c57094cb02ed387 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=41
+EXTRA_VERSION=42
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 5c6de3040b50e81e0aa5ae46cdbbd98147f78852..8307a9fbb58585be04577928031df035a1a17a98 100644 (file)
@@ -350,6 +350,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
                gboolean got_error = FALSE;
                gboolean uncanonicalize = FALSE;
                FILE *tmpfp = outfp;
+               gboolean null_bytes = FALSE;
 
                if (mimeinfo->type == MIMETYPE_TEXT ||
                    mimeinfo->type == MIMETYPE_MESSAGE) {
@@ -366,6 +367,10 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
                decoder = base64_decoder_new();
                while ((ftell(infp) < readend) && (fgets(buf, sizeof(buf), infp) != NULL)) {
                        len = base64_decoder_decode(decoder, buf, outbuf);
+                       if (uncanonicalize == TRUE && strlen(outbuf) < len) {
+                               uncanonicalize = FALSE;
+                               null_bytes = TRUE;
+                       }
                        if (len < 0 && !got_error) {
                                g_warning("Bad BASE64 content.\n");
                                if (fwrite(_("[Error decoding BASE64]\n"),
@@ -378,8 +383,14 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
                        } else if (len >= 0) {
                                /* print out the error message only once 
                                 * per block */
-                               if (fwrite(outbuf, sizeof(gchar), len, tmpfp) < len)
-                                       err = TRUE;
+                               if (null_bytes) {
+                                       /* we won't uncanonicalize, output to outfp directly */
+                                       if (fwrite(outbuf, sizeof(gchar), len, outfp) < len)
+                                               err = TRUE;
+                               } else {
+                                       if (fwrite(outbuf, sizeof(gchar), len, tmpfp) < len)
+                                               err = TRUE;
+                               }
                                got_error = FALSE;
                        }
                }