[gmime] Use g_set_error_literal() when appropriate



commit 2794ab6d03775ebfb4950c6046b6bb9d9ae842a0
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Fri Mar 10 10:01:21 2017 -0500

    Use g_set_error_literal() when appropriate

 gmime/gmime-gpg-context.c   |   12 ++++++------
 gmime/gmime-pkcs7-context.c |   17 +++++++++--------
 2 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index de73a02..ec14f60 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -356,7 +356,7 @@ gpg_sign (GMimeCryptoContext *context, gboolean detach, const char *userid, GMim
        
        return (GMimeDigestAlgo) result->signatures->hash_algo;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -422,7 +422,7 @@ gpg_verify (GMimeCryptoContext *context, GMimeVerifyFlags flags, GMimeStream *is
        /* get/return the gpg signatures */
        return g_mime_gpgme_get_signatures (gpg->ctx, TRUE);
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return NULL;
 #endif /* ENABLE_CRYPTO */
@@ -496,7 +496,7 @@ gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, GMi
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -556,7 +556,7 @@ gpg_decrypt (GMimeCryptoContext *context, GMimeDecryptFlags flags, const char *s
        
        return g_mime_gpgme_get_decrypt_result (gpg->ctx);
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return NULL;
 #endif /* ENABLE_CRYPTO */
@@ -587,7 +587,7 @@ gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -618,7 +618,7 @@ gpg_export_keys (GMimeCryptoContext *context, const char *keys[], GMimeStream *o
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index db5a805..44a8e77 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -438,7 +438,7 @@ pkcs7_sign (GMimeCryptoContext *context, gboolean detach, const char *userid, GM
        
        return (GMimeDigestAlgo) result->signatures->hash_algo;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -482,6 +482,7 @@ pkcs7_verify (GMimeCryptoContext *context, GMimeVerifyFlags flags, GMimeStream *
                
                signed_text = NULL;
        } else {
+               g_set_error_literal (err, GMIME_GPGME_ERROR, error, _("Missing signature stream or output 
stream"));
                return NULL;
        }
        
@@ -506,7 +507,7 @@ pkcs7_verify (GMimeCryptoContext *context, GMimeVerifyFlags flags, GMimeStream *
        /* get/return the pkcs7 signatures */
        return g_mime_gpgme_get_signatures (pkcs7->ctx, TRUE);
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return NULL;
 #endif /* ENABLE_CRYPTO */
@@ -542,8 +543,8 @@ pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, G
        guint i;
        
        if (sign) {
-               g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
-                            _("Cannot sign and encrypt a stream at the same time using pkcs7"));
+               g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
+                                    _("Cannot sign and encrypt a stream at the same time using pkcs7"));
                return -1;
        }
        
@@ -587,7 +588,7 @@ pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, G
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -647,7 +648,7 @@ pkcs7_decrypt (GMimeCryptoContext *context, GMimeDecryptFlags flags, const char
        
        return g_mime_gpgme_get_decrypt_result (pkcs7->ctx);
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return NULL;
 #endif /* ENABLE_CRYPTO */
@@ -677,7 +678,7 @@ pkcs7_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **e
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */
@@ -708,7 +709,7 @@ pkcs7_export_keys (GMimeCryptoContext *context, const char *keys[], GMimeStream
        
        return 0;
 #else
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
+       g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in 
this build"));
        
        return -1;
 #endif /* ENABLE_CRYPTO */


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