diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.ja | 6 | ||||
-rw-r--r-- | src/codeconv.c | 14 | ||||
-rw-r--r-- | src/procheader.c | 13 |
4 files changed, 31 insertions, 8 deletions
@@ -1,3 +1,9 @@ +2005-03-07 + + * src/codeconv.c: conv_unmime_header(): use fixed size of buffer. + * src/procheader.c: procheader_scan_date_string(): support header + like: "[Tue,] 01 Feb 2005 09:57[:00]". + 2005-03-04 * src/unmime.[ch]: use GString for a buffer for header MIME decoding diff --git a/ChangeLog.ja b/ChangeLog.ja index 99253fd7..8dc69327 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,9 @@ +2005-03-07 + + * src/codeconv.c: conv_unmime_header(): 固定サイズのバッファを使用。 + * src/procheader.c: procheader_scan_date_string(): + "[Tue,] 01 Feb 2005 09:57[:00]" のようなヘッダに対応。 + 2005-03-04 * src/unmime.[ch]: 効率を上げるために、ヘッダの MIME デコードの diff --git a/src/codeconv.c b/src/codeconv.c index 8371486d..cf41cdea 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -1543,13 +1543,14 @@ const gchar *conv_get_current_locale(void) gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding) { - gchar *utf8_buf; - gint buflen; + gchar buf[BUFFSIZE]; if (is_ascii_str(str)) return unmime_header(str); if (default_encoding) { + gchar *utf8_buf; + utf8_buf = conv_codeset_strdup (str, default_encoding, CS_INTERNAL); if (utf8_buf) { @@ -1561,15 +1562,12 @@ gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding) } } - buflen = MIN(strlen(str) * 6 + 1, BUFFSIZE); - Xalloca(utf8_buf, buflen, return NULL); - if (conv_get_locale_charset() == C_EUC_JP) - conv_anytodisp(utf8_buf, buflen, str); + conv_anytodisp(buf, sizeof(buf), str); else - conv_localetodisp(utf8_buf, buflen, str); + conv_localetodisp(buf, sizeof(buf), str); - return unmime_header(utf8_buf); + return unmime_header(buf); } #define MAX_LINELEN 76 diff --git a/src/procheader.c b/src/procheader.c index 99acdd79..f88396cb 100644 --- a/src/procheader.c +++ b/src/procheader.c @@ -688,6 +688,10 @@ static gint procheader_scan_date_string(const gchar *str, weekday, day, month, year, hh, mm, ss); if (result == 7) return 0; + result = sscanf(str, "%d %9s %d %2d:%2d:%2d", + day, month, year, hh, mm, ss); + if (result == 6) return 0; + *ss = 0; result = sscanf(str, "%10s %d %9s %d %2d:%2d %5s", weekday, day, month, year, hh, mm, zone); @@ -697,6 +701,15 @@ static gint procheader_scan_date_string(const gchar *str, day, month, year, hh, mm, zone); if (result == 6) return 0; + *zone = '\0'; + result = sscanf(str, "%10s %d %9s %d %2d:%2d", + weekday, day, month, year, hh, mm); + if (result == 6) return 0; + + result = sscanf(str, "%d %9s %d %2d:%2d", + day, month, year, hh, mm); + if (result == 5) return 0; + return -1; } |