2007-08-08 [colin] 2.10.0cvs100
authorColin Leroy <colin@colino.net>
Wed, 8 Aug 2007 16:01:54 +0000 (16:01 +0000)
committerColin Leroy <colin@colino.net>
Wed, 8 Aug 2007 16:01:54 +0000 (16:01 +0000)
* src/html.c
Complete symbol table, thanks to wwp.
Fixes bug 1284, 'The html -> text
converter ignores entities'
* src/msgcache.c
Fix possible fd leak

ChangeLog
PATCHSETS
configure.ac
src/html.c
src/msgcache.c

index 5216910b0493a83641b345f7f7481eca4e7d46f4..e03ca727557c8ce76d341d46460c0c4498e2514b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-08-08 [colin]     2.10.0cvs100
+
+       * src/html.c
+               Complete symbol table, thanks to wwp.
+               Fixes bug 1284, 'The html -> text 
+               converter ignores entities'
+       * src/msgcache.c
+               Fix possible fd leak
+
 2007-08-08 [colin]     2.10.0cvs99
 
        * src/imap.c
index 9e6a6836aed5f1de80cad408ccee07e85d236590..932c662b128bed612e85563573a03c75814756d7 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 manual/account.xml;  cvs diff -u -r 1.1.2.39 -r 1.1.2.40 manual/advanced.xml;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 manual/fr/account.xml;  cvs diff -u -r 1.1.2.15 -r 1.1.2.16 manual/fr/advanced.xml;  ) > 2.10.0cvs97.patchset
 ( cvs diff -u -r 1.179.2.177 -r 1.179.2.178 src/imap.c;  cvs diff -u -r 1.94.2.143 -r 1.94.2.144 src/messageview.c;  cvs diff -u -r 1.16.2.53 -r 1.16.2.54 src/msgcache.c;  ) > 2.10.0cvs98.patchset
 ( cvs diff -u -r 1.179.2.178 -r 1.179.2.179 src/imap.c;  ) > 2.10.0cvs99.patchset
+( cvs diff -u -r 1.12.2.21 -r 1.12.2.22 src/html.c;  cvs diff -u -r 1.16.2.54 -r 1.16.2.55 src/msgcache.c;  ) > 2.10.0cvs100.patchset
index 0076fdca0d69da06182814515e390f2e5ab00294..a7bdb2f6b3f523aab19c6746ebba6b7981763b94 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=99
+EXTRA_VERSION=100
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 49a6e25ce8ec99159b85c11f54c062dd8e4ed14c..e124c6b3d18434f36fc2b4cf1b9adc186b5ed9fa 100644 (file)
@@ -38,94 +38,265 @@ struct _SC_HTMLSymbol
 };
 
 static SC_HTMLSymbol symbol_list[] = {
-       {"&lt;", "\74"},
-       {"&gt;", "\76"},
-       {"&amp;", "\46"},
-       {"&quot;", "\42"},
-       {"&lsquo;", "\47"},
-       {"&rsquo;", "\47"},
-       {"&ldquo;", "\42"},
-       {"&rdquo;", "\42"},
-       {"&laquo;", "\302\253"},
-       {"&raquo;", "\302\273"},
-       {"&nbsp;", "\40"},
-       {"&trade;", "\50\124\115\51"},
-       {"&hellip;", "\56\56\56"},
-       {"&bull;", "\52"},
-       {"&ndash;", "\55"},
-       {"&mdash;", "\55\55"},
-       {"&euro;", "\105\125\122"},
-       {"&cent;", "\302\242"},
-       {"&pound;", "\302\243"},
-       {"&curren;", "\302\244"},
-       {"&yen;", "\302\245"},
-       {"&copy;", "\302\251"},
-       {"&reg;", "\302\256"},
-       {"&iquest;", "\302\277"},
-       {"&iexcl;", "\302\241"}
-};
-
-static SC_HTMLSymbol ascii_symbol_list[] = {
-       {"&iexcl;" , "\302\241"},
-       {"&brvbar;", "\302\246"},
-       {"&copy;"  , "\302\251"},
-       {"&laquo;" , "\302\253"},
-       {"&reg;"   , "\302\256"},
-
-       {"&sup2;"  , "\302\262"},
-       {"&sup3;"  , "\302\263"},
-       {"&acute;" , "\302\264"},
-       {"&cedil;" , "\302\270"},
-       {"&sup1;"  , "\302\271"},
-       {"&raquo;" , "\302\273"},
-       {"&frac14;", "\302\274"},
-       {"&frac12;", "\302\275"},
-       {"&frac34;", "\302\276"},
-       {"&iquest;", "\302\277"},
-
-       {"&Agrave;", "\303\200"},
-       {"&Aacute;", "\303\201"},
-       {"&Acirc;" , "\303\202"},
-       {"&Atilde;", "\303\203"},
-       {"&AElig;" , "\303\206"},
-       {"&Egrave;", "\303\210"},
-       {"&Eacute;", "\303\211"},
-       {"&Ecirc;" , "\303\212"},
-       {"&Igrave;", "\303\214"},
-       {"&Iacute;", "\303\215"},
-       {"&Icirc;" , "\303\216"},
-
-       {"&Ntilde;", "\303\221"},
-       {"&Ograve;", "\303\222"},
-       {"&Oacute;", "\303\223"},
-       {"&Ocirc;" , "\303\224"},
-       {"&Otilde;", "\303\225"},
-       {"&Ugrave;", "\303\231"},
-       {"&Uacute;", "\303\232"},
-       {"&Ucirc;" , "\303\233"},
-       {"&Yacute;", "\303\235"},
-
-       {"&agrave;", "\303\240"},
-       {"&aacute;", "\303\241"},
-       {"&acirc;" , "\303\242"},
-       {"&atilde;", "\303\243"},
-       {"&aelig;" , "\303\246"},
-       {"&egrave;", "\303\250"},
-       {"&eacute;", "\303\251"},
-       {"&ecirc;" , "\303\252"},
-       {"&igrave;", "\303\254"},
-       {"&iacute;", "\303\255"},
-       {"&icirc;" , "\303\256"},
-
-       {"&ntilde;", "\303\261"},
-       {"&ograve;", "\303\262"},
-       {"&oacute;", "\303\263"},
-       {"&ocirc;" , "\303\264"},
-       {"&otilde;", "\303\265"},
-       {"&ugrave;", "\303\271"},
-       {"&uacute;", "\303\272"},
-       {"&ucirc;" , "\303\273"},
-       {"&yacute;", "\303\275"}
+ {"&#34;", "\42"},
+ {"&#38;", "\46"},
+ {"&#39;", "\47"},
+ {"&#60;", "\74"},
+ {"&#62;", "\76"},
+ {"&#146;", "\47"},
+ {"&#153;", "\342\204\242"},
+ {"&#160;", "\40"},
+ {"&#161;", "\302\241"},
+ {"&#162;", "\302\242"},
+ {"&#163;", "\302\243"},
+ {"&#164;", "\302\244"},
+ {"&#165;", "\302\245"},
+ {"&#166;", "\302\246"},
+ {"&#167;", "\302\247"},
+ {"&#168;", "\302\250"},
+ {"&#169;", "\302\251"},
+ {"&#170;", "\302\252"},
+ {"&#171;", "\302\253"},
+ {"&#172;", "\302\254"},
+ {"&#173;", "\302\255"},
+ {"&#174;", "\302\256"},
+ {"&#175;", "\302\257"},
+ {"&#176;", "\302\260"},
+ {"&#177;", "\302\261"},
+ {"&#178;", "\302\262"},
+ {"&#179;", "\302\263"},
+ {"&#180;", "\302\264"},
+ {"&#181;", "\302\265"},
+ {"&#182;", "\302\266"},
+ {"&#183;", "\302\267"},
+ {"&#184;", "\302\270"},
+ {"&#185;", "\302\271"},
+ {"&#186;", "\302\272"},
+ {"&#187;", "\302\273"},
+ {"&#188;", "\302\274"},
+ {"&#189;", "\302\275"},
+ {"&#190;", "\302\276"},
+ {"&#191;", "\302\277"},
+ {"&#192;", "\303\200"},
+ {"&#193;", "\303\201"},
+ {"&#194;", "\303\202"},
+ {"&#195;", "\303\203"},
+ {"&#196;", "\303\204"},
+ {"&#197;", "\303\205"},
+ {"&#198;", "\303\206"},
+ {"&#199;", "\303\207"},
+ {"&#200;", "\303\210"},
+ {"&#201;", "\303\211"},
+ {"&#202;", "\303\212"},
+ {"&#203;", "\303\213"},
+ {"&#204;", "\303\214"},
+ {"&#205;", "\303\215"},
+ {"&#206;", "\303\216"},
+ {"&#207;", "\303\217"},
+ {"&#208;", "\303\220"},
+ {"&#209;", "\303\221"},
+ {"&#210;", "\303\222"},
+ {"&#211;", "\303\223"},
+ {"&#212;", "\303\224"},
+ {"&#213;", "\303\225"},
+ {"&#214;", "\303\226"},
+ {"&#215;", "\303\227"},
+ {"&#216;", "\303\230"},
+ {"&#217;", "\303\231"},
+ {"&#218;", "\303\232"},
+ {"&#219;", "\303\233"},
+ {"&#220;", "\303\234"},
+ {"&#221;", "\303\235"},
+ {"&#222;", "\303\236"},
+ {"&#223;", "\303\237"},
+ {"&#224;", "\303\240"},
+ {"&#225;", "\303\241"},
+ {"&#226;", "\303\242"},
+ {"&#227;", "\303\243"},
+ {"&#228;", "\303\244"},
+ {"&#229;", "\303\245"},
+ {"&#230;", "\303\246"},
+ {"&#231;", "\303\247"},
+ {"&#232;", "\303\250"},
+ {"&#233;", "\303\251"},
+ {"&#234;", "\303\252"},
+ {"&#235;", "\303\253"},
+ {"&#236;", "\303\254"},
+ {"&#237;", "\303\255"},
+ {"&#238;", "\303\256"},
+ {"&#239;", "\303\257"},
+ {"&#240;", "\303\260"},
+ {"&#241;", "\303\261"},
+ {"&#242;", "\303\262"},
+ {"&#243;", "\303\263"},
+ {"&#244;", "\303\264"},
+ {"&#245;", "\303\265"},
+ {"&#246;", "\303\266"},
+ {"&#247;", "\303\267"},
+ {"&#248;", "\303\270"},
+ {"&#249;", "\303\271"},
+ {"&#250;", "\303\272"},
+ {"&#251;", "\303\273"},
+ {"&#252;", "\303\274"},
+ {"&#253;", "\303\275"},
+ {"&#254;", "\303\276"},
+ {"&#255;", "\303\277"},
+ {"&#338;", "\305\222"},
+ {"&#339;", "\305\223"},
+ {"&#352;", "\305\240"},
+ {"&#353;", "\305\241"},
+ {"&#376;", "\305\270"},
+ {"&#710;", "\313\206"},
+ {"&#732;", "\313\234"},
+ {"&#8194;", "\342\200\202"},
+ {"&#8195;", "\342\200\203"},
+ {"&#8201;", "\342\200\211"},
+ {"&#8211;", "\342\200\223"},
+ {"&#8212;", "\342\200\224"},
+ {"&#8216;", "\342\200\230"},
+ {"&#8217;", "\342\200\231"},
+ {"&#8218;", "\342\200\232"},
+ {"&#8220;", "\342\200\234"},
+ {"&#8221;", "\342\200\235"},
+ {"&#8222;", "\342\200\236"},
+ {"&#8224;", "\342\200\240"},
+ {"&#8225;", "\342\200\241"},
+ {"&#8226;", "\342\200\242"},
+ {"&#8230;", "\342\200\246"},
+ {"&#8240;", "\342\200\260"},
+ {"&#8249;", "\342\200\271"},
+ {"&#8250;", "\342\200\272"},
+ {"&#8364;", "\342\202\254"},
+ {"&#8482;", "\342\204\242"},
+ {"&quot;", "\42"},
+ {"&amp;", "\46"},
+ {"&apos;", "\47"},
+ {"&lt;", "\74"},
+ {"&gt;", "\76"},
+ {"&squot;", "\47"},
+ {"&nbsp;", "\40"},
+ {"&iexcl;", "\302\241"},
+ {"&cent;", "\302\242"},
+ {"&pound;", "\302\243"},
+ {"&curren;", "\302\244"},
+ {"&yen;", "\302\245"},
+ {"&brvbar;", "\302\246"},
+ {"&sect;", "\302\247"},
+ {"&uml;", "\302\250"},
+ {"&copy;", "\302\251"},
+ {"&ordf;", "\302\252"},
+ {"&laquo;", "\302\253"},
+ {"&not;", "\302\254"},
+ {"&shy;", "\302\255"},
+ {"&reg;", "\302\256"},
+ {"&macr;", "\302\257"},
+ {"&deg;", "\302\260"},
+ {"&plusmn;", "\302\261"},
+ {"&sup2;", "\302\262"},
+ {"&sup3;", "\302\263"},
+ {"&acute;", "\302\264"},
+ {"&micro;", "\302\265"},
+ {"&para;", "\302\266"},
+ {"&middot;", "\302\267"},
+ {"&cedil;", "\302\270"},
+ {"&sup1;", "\302\271"},
+ {"&ordm;", "\302\272"},
+ {"&raquo;", "\302\273"},
+ {"&frac14;", "\302\274"},
+ {"&frac12;", "\302\275"},
+ {"&frac34;", "\302\276"},
+ {"&iquest;", "\302\277"},
+ {"&Agrave;", "\303\200"},
+ {"&Aacute;", "\303\201"},
+ {"&Acirc;", "\303\202"},
+ {"&Atilde;", "\303\203"},
+ {"&Auml;", "\303\204"},
+ {"&Aring;", "\303\205"},
+ {"&AElig;", "\303\206"},
+ {"&Ccedil;", "\303\207"},
+ {"&Egrave;", "\303\210"},
+ {"&Eacute;", "\303\211"},
+ {"&Ecirc;", "\303\212"},
+ {"&Euml;", "\303\213"},
+ {"&Igrave;", "\303\214"},
+ {"&Iacute;", "\303\215"},
+ {"&Icirc;", "\303\216"},
+ {"&Iuml;", "\303\217"},
+ {"&ETH;", "\303\220"},
+ {"&Ntilde;", "\303\221"},
+ {"&Ograve;", "\303\222"},
+ {"&Oacute;", "\303\223"},
+ {"&Ocirc;", "\303\224"},
+ {"&Otilde;", "\303\225"},
+ {"&Ouml;", "\303\226"},
+ {"&times;", "\303\227"},
+ {"&Oslash;", "\303\230"},
+ {"&Ugrave;", "\303\231"},
+ {"&Uacute;", "\303\232"},
+ {"&Ucirc;", "\303\233"},
+ {"&Uuml;", "\303\234"},
+ {"&Yacute;", "\303\235"},
+ {"&THORN;", "\303\236"},
+ {"&szlig;", "\303\237"},
+ {"&agrave;", "\303\240"},
+ {"&aacute;", "\303\241"},
+ {"&acirc;", "\303\242"},
+ {"&atilde;", "\303\243"},
+ {"&auml;", "\303\244"},
+ {"&aring;", "\303\245"},
+ {"&aelig;", "\303\246"},
+ {"&ccedil;", "\303\247"},
+ {"&egrave;", "\303\250"},
+ {"&eacute;", "\303\251"},
+ {"&ecirc;", "\303\252"},
+ {"&euml;", "\303\253"},
+ {"&igrave;", "\303\254"},
+ {"&iacute;", "\303\255"},
+ {"&icirc;", "\303\256"},
+ {"&iuml;", "\303\257"},
+ {"&eth;", "\303\260"},
+ {"&ntilde;", "\303\261"},
+ {"&ograve;", "\303\262"},
+ {"&oacute;", "\303\263"},
+ {"&ocirc;", "\303\264"},
+ {"&otilde;", "\303\265"},
+ {"&ouml;", "\303\266"},
+ {"&divide;", "\303\267"},
+ {"&oslash;", "\303\270"},
+ {"&ugrave;", "\303\271"},
+ {"&uacute;", "\303\272"},
+ {"&ucirc;", "\303\273"},
+ {"&uuml;", "\303\274"},
+ {"&yacute;", "\303\275"},
+ {"&thorn;", "\303\276"},
+ {"&yuml;", "\303\277"},
+ {"&OElig;", "\305\222"},
+ {"&oelig;", "\305\223"},
+ {"&Scaron;", "\305\240"},
+ {"&scaron;", "\305\241"},
+ {"&Yuml;", "\305\270"},
+ {"&circ;", "\313\206"},
+ {"&tilde;", "\313\234"},
+ {"&ensp;", "\342\200\202"},
+ {"&emsp;", "\342\200\203"},
+ {"&thinsp;", "\342\200\211"},
+ {"&ndash;", "\342\200\223"},
+ {"&mdash;", "\342\200\224"},
+ {"&lsquo;", "\342\200\230"},
+ {"&rsquo;", "\342\200\231"},
+ {"&sbquo;", "\342\200\232"},
+ {"&ldquo;", "\342\200\234"},
+ {"&rdquo;", "\342\200\235"},
+ {"&bdquo;", "\342\200\236"},
+ {"&dagger;", "\342\200\240"},
+ {"&Dagger;", "\342\200\241"},
+ {"&bull;", "\342\200\242"},
+ {"&hellip;", "\342\200\246"},
+ {"&permil;", "\342\200\260"},
+ {"&lsaquo;", "\342\200\271"},
+ {"&rsaquo;", "\342\200\272"},
+ {"&euro;", "\342\202\254"},
+ {"&trade;", "\342\204\242"}
 };
 
 typedef struct _SC_HTMLAltSymbol       SC_HTMLAltSymbol;
@@ -136,53 +307,7 @@ struct _SC_HTMLAltSymbol
        gchar *const val;
 };
 
-/* http://www.w3schools.com/html/html_entitiesref.asp */
-static SC_HTMLAltSymbol alternate_symbol_list[] = {
-       {  96, "\140"},                    /* backtick */
-       { 153, "\50\124\115\51"},  /* trademark */
-       { 161, "\302\241"},        /* inverted exclamation mark &iexcl */
-       { 162, "\302\242"},        /* cent (currency) &cent */
-       { 163, "\302\243"},        /* pound (currency) &pound */
-       { 164, "\342\202\254"},    /* currency sign &curren */
-       { 165, "\302\245"},        /* yen (currency) &yen */
-       { 169, "\302\251"},        /* copyright sign &copy */
-       { 174, "\302\256"},        /* registered sign &reg */
-       { 191, "\302\277"},        /* inverted question mark &iquest */
-       { 338, "\117\105"},        /* capital ligature OE &OElig */
-       { 339, "\157\145"},        /* small ligature OE &oelig */
-       { 352, NULL},                      /* capital S w/caron &Scaron */
-       { 353, NULL},                      /* small S w/caron &scaron */
-       { 376, NULL},                      /* cap Y w/ diaeres &Yuml */
-       { 710, "\136"},                    /* circumflex accent &circ */
-       { 732, "\176"},                    /* small tilde &tilde */
-       {8194, "\40"},                     /* en space &ensp */
-       {8195, "\40"},                     /* em space &emsp */
-       {8201, "\40"},                     /* thin space &thinsp */
-       {8204, NULL},                      /* zero width non-joiner &zwnj */
-       {8205, NULL},                      /* zero width joiner &zwj */
-       {8206, NULL},                      /* l-t-r mark &lrm */
-       {8207, NULL},                      /* r-t-l mark &rlm */
-       {8211, "\55"},                     /* en dash &ndash */
-       {8212, "\55\55"},                  /* em dash &mdash */
-       {8216, "\47"},                     /* l single quot mark &lsquo */
-       {8217, "\47"},                     /* r single quot mark &rsquo */
-       {8218, "\54"},                     /* single low-9 quot &sbquo */
-       {8220, "\134"},                    /* l double quot mark &ldquo */
-       {8221, "\134"},                    /* r double quot mark &rdquo */
-       {8222, "\42"},                     /* double low-9 quot &bdquo */
-       {8224, NULL},                      /* dagger &dagger */
-       {8225, NULL},                      /* double dagger &Dagger */
-       {8226, "\52"},                     /* bullet &bull */
-       {8230, "\56\56\56"},       /* horizontal ellipsis &hellip */
-       {8240, "\45\157"},                 /* per mile &permil */
-       {8249, "\74"},                     /* l-pointing angle quot &lsaquo */
-       {8250, "\76"},                     /* r-pointing angle quot &rsaquo */
-       {8364, "\105\125\122"},    /* euro &euro */
-       {8482, "\50\124\115\51"}   /* trademark &trade */
-};
-
 static GHashTable *default_symbol_table;
-static GHashTable *alternate_symbol_table;
 
 static SC_HTMLState sc_html_read_line  (SC_HTMLParser  *parser);
 static void sc_html_append_char                        (SC_HTMLParser  *parser,
@@ -236,19 +361,12 @@ SC_HTMLParser *sc_html_parser_new(FILE *fp, CodeConverter *conv)
                default_symbol_table =
                        g_hash_table_new(g_str_hash, g_str_equal);
                SYMBOL_TABLE_ADD(default_symbol_table, symbol_list);
-               SYMBOL_TABLE_ADD(default_symbol_table, ascii_symbol_list);
-       }
-       if (!alternate_symbol_table) {
-               alternate_symbol_table =
-                       g_hash_table_new(g_int_hash, g_int_equal);
-               SYMBOL_TABLE_REF_ADD(alternate_symbol_table, alternate_symbol_list);
        }
 
 #undef SYMBOL_TABLE_ADD
 #undef SYMBOL_TABLE_REF_ADD
 
        parser->symbol_table = default_symbol_table;
-       parser->alt_symbol_table = alternate_symbol_table;
 
        return parser;
 }
@@ -598,25 +716,7 @@ static void sc_html_parse_special(SC_HTMLParser *parser)
                sc_html_append_str(parser, val, -1);
                parser->state = SC_HTML_NORMAL;
                return;
-       } else if (symbol_name[1] == '#' && g_ascii_isdigit(symbol_name[2])) {
-               gint ch;
-
-               ch = atoi(symbol_name + 2);
-               if ((ch > 0 && ch <= 127) ||
-                   (ch >= 128 && ch <= 255 &&
-                    parser->conv->charset == C_ISO_8859_1)) {
-                       sc_html_append_char(parser, ch);
-                       parser->state = SC_HTML_NORMAL;
-                       return;
-               } else {
-                       const gchar *symb = g_hash_table_lookup(parser->alt_symbol_table, &ch);
-                       if (symb) {
-                               sc_html_append_str(parser, symb, -1);
-                               parser->state = SC_HTML_NORMAL;
-                               return;
-                       }
-               }
-       }
+       } 
 
        sc_html_append_str(parser, symbol_name, -1);
 }
index 4ab562ce6cf31f066d2713b2576945edb48827cf..b35346deb49c09df99dd1bc723a47422cadfa2b2 100644 (file)
@@ -596,8 +596,10 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
                tmp_flags |= MSG_DRAFT;
        }
 
-       if (msgcache_read_cache_data_str(fp, &srccharset, NULL) < 0)
+       if (msgcache_read_cache_data_str(fp, &srccharset, NULL) < 0) {
+               fclose(fp);
                return NULL;
+       }
        dstcharset = CS_UTF_8;
        if (srccharset == NULL || dstcharset == NULL) {
                conv = NULL;