[Commits] [SCM] claws branch, master, updated. 3.17.3-105-g3813adc

ticho at claws-mail.org ticho at claws-mail.org
Fri Mar 1 14:28:35 CET 2019


The branch, master has been updated
       via  3813adcf59bc4e4578f9e75535a7296b459626f5 (commit)
      from  79df8adbfee87e42bd4ca6071537619289de85b5 (commit)

Summary of changes:
 src/plugins/pgpcore/pgp_utils.c     |   35 +++--------------------------------
 src/plugins/pgpcore/pgp_utils.h     |    1 -
 src/plugins/pgpcore/plugin.def      |    1 -
 src/plugins/pgpinline/mypgpcore.def |    1 -
 src/plugins/pgpinline/pgpinline.c   |    4 ++--
 src/plugins/smime/mypgpcore.def     |    1 -
 src/plugins/smime/smime.c           |    2 +-
 7 files changed, 6 insertions(+), 39 deletions(-)


- Log -----------------------------------------------------------------
commit 3813adcf59bc4e4578f9e75535a7296b459626f5
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Mar 1 14:27:17 2019 +0100

    Remove pgpcore's fp_read_noconv() in favour of file_read_stream_to_str_no_recode() from file-utils.c

diff --git a/src/plugins/pgpcore/pgp_utils.c b/src/plugins/pgpcore/pgp_utils.c
index f7b2793..fbcf9dc 100644
--- a/src/plugins/pgpcore/pgp_utils.c
+++ b/src/plugins/pgpcore/pgp_utils.c
@@ -32,37 +32,6 @@
 #include "codeconv.h"
 #include "file-utils.h"
 
-gchar *fp_read_noconv(FILE *fp)
-{
-	GByteArray *array;
-	guchar buf[BUFSIZ];
-	gint n_read;
-	gchar *result = NULL;
-
-	if (!fp)
-		return NULL;
-	array = g_byte_array_new();
-
-	while ((n_read = claws_fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
-		if (n_read < sizeof(buf) && claws_ferror(fp))
-			break;
-		g_byte_array_append(array, buf, n_read);
-	}
-
-	if (claws_ferror(fp)) {
-		FILE_OP_ERROR("file stream", "claws_fread");
-		g_byte_array_free(array, TRUE);
-		return NULL;
-	}
-
-	buf[0] = '\0';
-	g_byte_array_append(array, buf, 1);
-	result = (gchar *)array->data;
-	g_byte_array_free(array, FALSE);
-	
-	return result;
-}
-
 gchar *get_part_as_string(MimeInfo *mimeinfo)
 {
 	gchar *textdata = NULL;
@@ -84,10 +53,12 @@ gchar *get_part_as_string(MimeInfo *mimeinfo)
 		fp = claws_fopen(filename,"rb");
 		if (!fp) {
 			g_warning("error opening temporary file '%s'", filename);
+
 			g_free(filename);
 			return NULL;
 		}
-		textdata = fp_read_noconv(fp);
+		textdata = file_read_stream_to_str_no_recode(fp);
+
 		claws_fclose(fp);
 		g_unlink(filename);
 		g_free(filename);
diff --git a/src/plugins/pgpcore/pgp_utils.h b/src/plugins/pgpcore/pgp_utils.h
index a7795f7..0299dae 100644
--- a/src/plugins/pgpcore/pgp_utils.h
+++ b/src/plugins/pgpcore/pgp_utils.h
@@ -27,7 +27,6 @@
 
 #include "procmime.h"
 
-gchar *fp_read_noconv(FILE *fp);
 gchar *get_part_as_string(MimeInfo *mimeinfo);
 gchar *pgp_locate_armor_header(gchar *textdata, const gchar *armor_header);
 
diff --git a/src/plugins/pgpcore/plugin.def b/src/plugins/pgpcore/plugin.def
index 94da174..5c48ea9 100644
--- a/src/plugins/pgpcore/plugin.def
+++ b/src/plugins/pgpcore/plugin.def
@@ -28,6 +28,5 @@ EXPORTS
 	cm_gpgme_data_rewind
 
 	get_part_as_string
-	fp_read_noconv
 	pgp_locate_armor_header
 	prefs_gpg_auto_check_signatures
diff --git a/src/plugins/pgpinline/mypgpcore.def b/src/plugins/pgpinline/mypgpcore.def
index a2f5c66..1e17672 100644
--- a/src/plugins/pgpinline/mypgpcore.def
+++ b/src/plugins/pgpinline/mypgpcore.def
@@ -17,4 +17,3 @@ sgpgme_verify_signature
 get_part_as_string
 pgp_locate_armor_header
 prefs_gpg_auto_check_signatures
-fp_read_noconv
diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index b284e64..4c7c98b 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -508,7 +508,7 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account, const
 	rewind(fp);
 
 	/* read temporary file into memory */
-	textstr = fp_read_noconv(fp);
+	textstr = file_read_stream_to_str_no_recode(fp);
 	
 	claws_fclose(fp);
 		
@@ -702,7 +702,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	rewind(fp);
 
 	/* read temporary file into memory */
-	textstr = fp_read_noconv(fp);
+	textstr = file_read_stream_to_str_no_recode(fp);
 	
 	claws_fclose(fp);
 
diff --git a/src/plugins/smime/mypgpcore.def b/src/plugins/smime/mypgpcore.def
index eeba473..44dd8d2 100644
--- a/src/plugins/smime/mypgpcore.def
+++ b/src/plugins/smime/mypgpcore.def
@@ -17,4 +17,3 @@ sgpgme_sigstat_info_short
 sgpgme_verify_signature
 cm_gpgme_data_rewind
 prefs_gpg_auto_check_signatures
-fp_read_noconv
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index 2546343..f0cd96f 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -816,7 +816,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	g_free(tmpfile);
 
 	/* read temporary file into memory */
-	textstr = fp_read_noconv(fp);
+	textstr = file_read_stream_to_str_no_recode(fp);
 
 	claws_fclose(fp);
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list