[gmime] Fixed to use g_set_error_literal



commit bf881a0797150eb3b293590b163982e80f0810d2
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Tue Apr 13 09:20:13 2010 -0400

    Fixed to use g_set_error_literal
    
    2010-04-13  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-gpg-context.c: Use g_set_error_literal() when no
    	printf-style arguments are needed. Fixes bug #615594. Thanks to
    	Tobias Mueller and Christian Persch.

 ChangeLog                 |    4 ++++
 gmime/gmime-gpg-context.c |   38 ++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e1a21af..9b918e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-13  Jeffrey Stedfast  <fejj novell com>
 
+	* gmime/gmime-gpg-context.c: Use g_set_error_literal() when no
+	printf-style arguments are needed. Fixes bug #615594. Thanks to
+	Tobias Mueller and Christian Persch.
+
 	* Applied patch by pier11 operamail com to fix the build for
 	MingW. Fixes bug #615068.
 
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index de3bafd..d72801e 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -951,8 +951,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		
 		status = next_token (status, &hint);
 		if (!hint) {
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
-				     _("Failed to parse gpg userid hint."));
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
+					     _("Failed to parse gpg userid hint."));
 			return -1;
 		}
 		
@@ -975,8 +975,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		
 		status = next_token (status, &userid);
 		if (!userid) {
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
-				     _("Failed to parse gpg passphrase request."));
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
+					     _("Failed to parse gpg passphrase request."));
 			return -1;
 		}
 		
@@ -989,8 +989,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		
 		status = next_token (status, &userid);
 		if (!userid) {
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
-				     _("Failed to parse gpg passphrase request."));
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
+					     _("Failed to parse gpg passphrase request."));
 			return -1;
 		}
 		
@@ -1010,7 +1010,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		ctx = (GMimeCipherContext *) gpg->ctx;
 		if (!ctx->request_passwd) {
 			/* can't ask for a passwd w/o a way to request it from the user... */
-			g_set_error (err, GMIME_ERROR, ECANCELED, _("Canceled."));
+			g_set_error_literal (err, GMIME_ERROR, ECANCELED, _("Canceled."));
 			return -1;
 		}
 		
@@ -1067,8 +1067,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		gpg->bad_passwds++;
 		
 		if (gpg->bad_passwds == 3) {
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_BAD_PASSWORD,
-				     _("Failed to unlock secret key: 3 bad passphrases given."));
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_BAD_PASSWORD,
+					     _("Failed to unlock secret key: 3 bad passphrases given."));
 			return -1;
 		}
 	} else if (!strncmp (status, "UNEXPECTED ", 11)) {
@@ -1092,11 +1092,9 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 		
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		if (diagnostics && *diagnostics)
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_GENERAL,
-				     "%s", diagnostics);
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_GENERAL, diagnostics);
 		else
-			g_set_error (err, GMIME_ERROR, GMIME_ERROR_GENERAL,
-				     _("No data provided"));
+			g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_GENERAL, _("No data provided"));
 		
 		gpg->nodata = TRUE;
 		
@@ -1140,8 +1138,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 			} else if (!strncmp (status, "END_ENCRYPTION", 14)) {
 				/* nothing to do, but we know the end is near? */
 			} else if (!strncmp (status, "NO_RECP", 7)) {
-				g_set_error (err, GMIME_ERROR, GMIME_ERROR_NO_VALID_RECIPIENTS,
-					     _("Failed to encrypt: No valid recipients specified."));
+				g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NO_VALID_RECIPIENTS,
+						     _("Failed to encrypt: No valid recipients specified."));
 				return -1;
 			}
 			break;
@@ -1636,7 +1634,7 @@ gpg_sign (GMimeCipherContext *context, const char *userid, GMimeCipherHash hash,
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		errno = save;
 		
-		g_set_error (err, GMIME_ERROR, errno, diagnostics);
+		g_set_error_literal (err, GMIME_ERROR, errno, diagnostics);
 		gpg_ctx_free (gpg);
 		
 		return -1;
@@ -1816,7 +1814,7 @@ gpg_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		errno = save;
 		
-		g_set_error (err, GMIME_ERROR, errno, diagnostics);
+		g_set_error_literal (err, GMIME_ERROR, errno, diagnostics);
 		gpg_ctx_free (gpg);
 		
 		return -1;
@@ -1866,7 +1864,7 @@ gpg_decrypt (GMimeCipherContext *context, GMimeStream *istream,
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		errno = save;
 		
-		g_set_error (err, GMIME_ERROR, errno, diagnostics);
+		g_set_error_literal (err, GMIME_ERROR, errno, diagnostics);
 		gpg_ctx_free (gpg);
 		
 		return NULL;
@@ -1935,7 +1933,7 @@ gpg_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **err
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		errno = save;
 		
-		g_set_error (err, GMIME_ERROR, errno, diagnostics);
+		g_set_error_literal (err, GMIME_ERROR, errno, diagnostics);
 		gpg_ctx_free (gpg);
 		
 		return -1;
@@ -1988,7 +1986,7 @@ gpg_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *ostr
 		diagnostics = gpg_ctx_get_diagnostics (gpg);
 		errno = save;
 		
-		g_set_error (err, GMIME_ERROR, errno, diagnostics);
+		g_set_error_literal (err, GMIME_ERROR, errno, diagnostics);
 		gpg_ctx_free (gpg);
 		
 		return -1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]