[Commits] [SCM] claws branch, master, updated. 4.2.0-97-g0da1365a3
wwp at claws-mail.org
wwp at claws-mail.org
Tue May 14 05:33:55 UTC 2024
The branch, master has been updated
via 0da1365a38e19c619215d919598a3704d49936e3 (commit)
from ce4baa225a17648a19c3806dac4f57cbd938b3ef (commit)
Summary of changes:
src/procmime.c | 45 +++++----------------------------------------
1 file changed, 5 insertions(+), 40 deletions(-)
- Log -----------------------------------------------------------------
commit 0da1365a38e19c619215d919598a3704d49936e3
Author: wwp <subscript at free.fr>
Date: Tue May 14 07:29:41 2024 +0200
Sync procmime.c with gtk2 branch, use my_tmpfile instead of old scheme:
this, in addition to previous commit (ce4baa225a17648a19c3806dac4f57cbd938b3ef), is mostly
a backport the sequence of 414b08d658d56f25052aab18ab75d7e321d97e3b, cb3f6bfba779f53100a9b21c09cb9489ad7469d0
and 77f9a0f030366ec10579134c255ef1781c1e55ab from master (when master was gtk2) that was only half-merged
to the gtk3 branc.
diff --git a/src/procmime.c b/src/procmime.c
index 75e61637c..d2524cba4 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -438,8 +438,9 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
err = TRUE;
}
}
- if (tmpfp != outfp)
+ if (tmpfp != outfp) {
claws_fclose(tmpfp);
+ }
} else if (encoding == ENC_X_UUENCODE) {
gchar outbuf[BUFFSIZE];
gint len;
@@ -758,7 +759,6 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
gchar buf[BUFFSIZE];
gchar *str;
gboolean scan_ret = FALSE;
- gchar *tmpfile = NULL;
int r;
cm_return_val_if_fail(mimeinfo != NULL, TRUE);
@@ -767,27 +767,15 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
if (!procmime_decode_content(mimeinfo))
return TRUE;
-#if HAVE_FMEMOPEN
- tmpfp = fmemopen(NULL, mimeinfo->length * 2, "w+");
-#else
- tmpfile = procmime_get_tmp_file_name(mimeinfo);
- if (tmpfile == NULL) {
- g_warning("no filename");
- return TRUE;
- }
-
- tmpfp = claws_fopen(tmpfile, "w+");
-#endif
+ tmpfp = my_tmpfile();
if (tmpfp == NULL) {
- FILE_OP_ERROR(tmpfile, "open");
- g_free(tmpfile);
+ FILE_OP_ERROR("tmpfile", "open");
return TRUE;
}
if ((r = procmime_get_part_to_stream(tmpfp, mimeinfo)) < 0) {
g_warning("procmime_get_part_to_stream error %d", r);
- g_free(tmpfile);
return TRUE;
}
@@ -853,11 +841,6 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
claws_fclose(tmpfp);
-#if !HAVE_FMEMOPEN
- claws_unlink(tmpfile);
- g_free(tmpfile);
-#endif
-
return scan_ret;
}
@@ -893,31 +876,13 @@ FILE *procmime_get_text_content(MimeInfo *mimeinfo)
FILE *procmime_get_binary_content(MimeInfo *mimeinfo)
{
FILE *outfp;
-#if !HAVE_FMEMOPEN
- gchar *tmpfile = NULL;
-#endif
cm_return_val_if_fail(mimeinfo != NULL, NULL);
if (!procmime_decode_content(mimeinfo))
return NULL;
-#if HAVE_FMEMOPEN
- outfp = fmemopen(NULL, mimeinfo->length * 2, "w+");
-#else
- tmpfile = procmime_get_tmp_file_name(mimeinfo);
- if (tmpfile == NULL) {
- g_warning("no filename");
- return NULL;
- }
-
- outfp = claws_fopen(tmpfile, "w+");
-
- if (tmpfile != NULL) {
- g_unlink(tmpfile);
- g_free(tmpfile);
- }
-#endif
+ outfp = my_tmpfile();
if (procmime_get_part_to_stream(outfp, mimeinfo) < 0) {
return NULL;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list