gmime r1559 - in trunk: . gmime
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1559 - in trunk: . gmime
- Date: Sun, 5 Apr 2009 18:53:37 +0000 (UTC)
Author: fejj
Date: Sun Apr 5 18:53:36 2009
New Revision: 1559
URL: http://svn.gnome.org/viewvc/gmime?rev=1559&view=rev
Log:
2009-04-05 Jeffrey Stedfast <fejj novell com>
* gmime/gmime-utils.c (mktime_utc): Fixed the Windows code-path.
(charset_convert): In the Windows case, fake the E2BIG error condition
if outleft <= inleft on any error as errno doesn't seem to get
properly set in this case.
Modified:
trunk/ChangeLog
trunk/gmime/gmime-utils.c
Modified: trunk/gmime/gmime-utils.c
==============================================================================
--- trunk/gmime/gmime-utils.c (original)
+++ trunk/gmime/gmime-utils.c Sun Apr 5 18:53:36 2009
@@ -455,6 +455,12 @@
#if defined (G_OS_WIN32)
_get_timezone (&tz);
+ if (tm->tm_isdst > 0) {
+ int dst;
+
+ _get_dstbias (&dst);
+ tz += dst;
+ }
#elif defined (HAVE_TM_GMTOFF)
tz = -tm->tm_gmtoff;
#elif defined (HAVE_TIMEZONE)
@@ -1496,6 +1502,13 @@
break;
}
+#ifdef G_OS_WIN32
+ /* seems that GnuWin32's libiconv 1.9 does not set errno in
+ * the E2BIG case, so we have to fake it */
+ if (outleft <= inleft)
+ errno = E2BIG;
+#endif
+
if (errno == E2BIG) {
/* need to grow the output buffer */
outlen += (inleft * 2) + 16;
@@ -1713,14 +1726,21 @@
case 'B':
case 'b':
inptr += 2;
- decoded = g_alloca (inend - inptr);
- declen = g_mime_encoding_base64_decode_step (inptr, inend - inptr, decoded, &state, &save);
+ len = (size_t) (inend - inptr);
+ decoded = g_alloca (len);
+ declen = g_mime_encoding_base64_decode_step (inptr, len, decoded, &state, &save);
+
+ if (declen == -1) {
+ d(fprintf (stderr, "encountered broken 'Q' encoding\n"));
+ return NULL;
+ }
break;
case 'Q':
case 'q':
inptr += 2;
- decoded = g_alloca (inend - inptr);
- declen = quoted_decode (inptr, inend - inptr, decoded);
+ len = (size_t) (inend - inptr);
+ decoded = g_alloca (len);
+ declen = quoted_decode (inptr, len, decoded);
if (declen == -1) {
d(fprintf (stderr, "encountered broken 'Q' encoding\n"));
@@ -1754,10 +1774,10 @@
p = (char *) decoded;
len = declen;
- while (!g_utf8_validate (p, len, (const char **) &p)) {
- len = declen - (p - (char *) decoded);
- *p = '?';
- }
+ //while (!g_utf8_validate (p, len, (const char **) &p)) {
+ // len = declen - (p - (char *) decoded);
+ // *p = '?';
+ //}
return g_strndup ((char *) decoded, declen);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]