Minor changes to the iconv code so that it does the check in the return
authorJeffrey Stedfast <fejj@ximian.com>
Fri, 3 Aug 2001 20:36:24 +0000 (20:36 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Fri, 3 Aug 2001 20:36:24 +0000 (20:36 +0000)
2001-08-03  Jeffrey Stedfast  <fejj@ximian.com>

* camel-pgp-context.c (pgp_verify): Minor changes to the iconv
code so that it does the check in the return value of iconv() just
like the code in camel-mime-utils.c in case this fixes Bo Rosen's
gpg bugs (but I doubt this will change anything?).

camel/ChangeLog
camel/camel-pgp-context.c

index e969917..7b95db4 100644 (file)
@@ -1,5 +1,12 @@
 2001-08-03  Jeffrey Stedfast  <fejj@ximian.com>
 
+       * camel-pgp-context.c (pgp_verify): Minor changes to the iconv
+       code so that it does the check in the return value of iconv() just
+       like the code in camel-mime-utils.c in case this fixes Bo Rosen's
+       gpg bugs (but I doubt this will change anything?).
+
+2001-08-03  Jeffrey Stedfast  <fejj@ximian.com>
+
        * providers/smtp/camel-smtp-transport.c (smtp_connect): First
        check to make sure that service->url->authmech is non-NULL before
        passing it into strcmp to avoid a segfault.
index 292279b..d92fa93 100644 (file)
@@ -998,15 +998,21 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream,
                cd = iconv_open ("UTF-8", locale);
                if (cd != (iconv_t) -1) {
                        const char *inbuf;
+                       int ret;
                        
                        inbuf = diagnostics;
-                       iconv (cd, &inbuf, &inlen, &outbuf, &outlen);
+                       ret = iconv (cd, &inbuf, &inlen, &outbuf, &outlen);
+                       if (ret >= 0) {
+                               iconv (cd, NULL, 0, &outbuf, &outlen);
+                       }
                        iconv_close (cd);
                        
                        *outbuf = '\0';
                } else {
                        const char *inptr, *inend;
                        
+                       g_warning ("CamelPgpContext::pgp_verify: cannot convert from %s to UTF-8", locale);
+                       
                        inptr = diagnostics;
                        inend = inptr + inlen;