[gmime] Fixed up error handling in gpg context.



commit 807e4f3769e13af8234c58e2f12030f2d5243590
Author: Jeffrey Stedfast <jeff xamarin com>
Date:   Thu Jan 5 10:40:26 2012 -0500

    Fixed up error handling in gpg context.
    
    2012-01-05  Jeffrey Stedfast  <fejj gnome org>
    
    	* gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Fixed returns
    	without a return value. Also fixed up some error-handling.

 ChangeLog                 |    5 +++++
 gmime/gmime-gpg-context.c |   28 ++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b791a64..dd1f4d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-01-05  Jeffrey Stedfast  <fejj gnome org>
 
+	* gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Fixed returns
+	without a return value. Also fixed up some error-handling.
+
+2012-01-05  Jeffrey Stedfast  <fejj gnome org>
+
 	* gmime/gmime-utils.c (rfc2047_decode_tokens): Fixed a memory leak.
 
 2011-12-23  Jeffrey Stedfast  <fejj gnome org>
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index affd0d0..439b023 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -906,15 +906,19 @@ gpg_ctx_parse_signer_info (struct _GpgCtx *gpg, char *status)
 		
 		/* the second token is the public-key algorithm id */
 		sig->cert->pubkey_algo = strtoul (status, &inend, 10);
-		if (inend == status || *inend != ' ')
+		if (inend == status || *inend != ' ') {
+			sig->cert->pubkey_algo = 0;
 			return;
+		}
 		
 		status = inend + 1;
 		
 		/* the third token is the digest algorithm id */
 		sig->cert->digest_algo = strtoul (status, &inend, 10);
-		if (inend == status || *inend != ' ')
+		if (inend == status || *inend != ' ') {
+			sig->cert->digest_algo = 0;
 			return;
+		}
 		
 		status = inend + 1;
 		
@@ -987,15 +991,19 @@ gpg_ctx_parse_signer_info (struct _GpgCtx *gpg, char *status)
 		
 		/* the seventh token is the public-key algorithm id */
 		sig->cert->pubkey_algo = strtoul (status, &inend, 10);
-		if (inend == status || *inend != ' ')
+		if (inend == status || *inend != ' ') {
+			sig->cert->pubkey_algo = 0;
 			return;
+		}
 		
 		status = inend + 1;
 		
 		/* the eighth token is the digest algorithm id */
 		sig->cert->digest_algo = strtoul (status, &inend, 10);
-		if (inend == status || *inend != ' ')
+		if (inend == status || *inend != ' ') {
+			sig->cert->digest_algo = 0;
 			return;
+		}
 		
 		status = inend + 1;
 		
@@ -1268,8 +1276,10 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 				
 				/* first token is the mdc algorithm (or 0 if not used) */
 				gpg->digest = strtoul (status, &inend, 10);
-				if (inend == status || *inend != ' ')
-					return;
+				if (inend == status || *inend != ' ') {
+					gpg->digest = 0;
+					break;
+				}
 				
 				status = inend + 1;
 				
@@ -1296,8 +1306,10 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
 				
 				/* second token is the recipient's pubkey algo */
 				cert->pubkey_algo = strtoul (status, &inend, 10);
-				if (inend == status || *inend != ' ')
-					return;
+				if (inend == status || *inend != ' ') {
+					cert->pubkey_algo = 0;
+					break;
+				}
 				
 				status = inend + 1;
 				



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