2005-01-14 [colin] 0.9.13cvs33
authorColin Leroy <colin@colino.net>
Fri, 14 Jan 2005 13:03:45 +0000 (13:03 +0000)
committerColin Leroy <colin@colino.net>
Fri, 14 Jan 2005 13:03:45 +0000 (13:03 +0000)
* src/html.c
* src/msgcache.c
Fix coding style issues from the last patch

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

index 71e1437..2e83001 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-14 [colin]     0.9.13cvs33
+
+       * src/html.c
+       * src/msgcache.c
+               Fix coding style issues from the last patch
+
 2005-01-14 [colin]     0.9.13cvs32
 
        * src/msgcache.c
 2005-01-14 [colin]     0.9.13cvs32
 
        * src/msgcache.c
index 33a10bf..70c62fa 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.7 -r 1.8 src/prefs_filtering_action.c; ) > 0.9.13cvs30.patchset
 ( cvs diff -u -r 1.1 -r 1.2 tools/calypso_convert.pl; ) > 0.9.13cvs31.patchset
 ( cvs diff -u -r 1.29 -r 1.30 src/msgcache.c; cvs diff -u -r 1.14 -r 1.15 src/html.c; cvs diff -u -r 1.3 -r 1.4 src/html.h; cvs diff -u -r 1.126 -r 1.127 AUTHORS; ) > 0.9.13cvs32.patchset
 ( cvs diff -u -r 1.7 -r 1.8 src/prefs_filtering_action.c; ) > 0.9.13cvs30.patchset
 ( cvs diff -u -r 1.1 -r 1.2 tools/calypso_convert.pl; ) > 0.9.13cvs31.patchset
 ( cvs diff -u -r 1.29 -r 1.30 src/msgcache.c; cvs diff -u -r 1.14 -r 1.15 src/html.c; cvs diff -u -r 1.3 -r 1.4 src/html.h; cvs diff -u -r 1.126 -r 1.127 AUTHORS; ) > 0.9.13cvs32.patchset
+( cvs diff -u -r 1.15 -r 1.16 src/html.c; cvs diff -u -r 1.30 -r 1.31 src/msgcache.c; ) > 0.9.13cvs33.patchset
index 9d18879..9bf240c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=32
+EXTRA_VERSION=33
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index fa32337..70407d5 100644 (file)
@@ -413,8 +413,9 @@ gchar *html_parse(HTMLParser *parser)
                         * see the end anchor tag
                         */
                        if (HTML_HREF_BEG == st || HTML_HREF == st)
                         * see the end anchor tag
                         */
                        if (HTML_HREF_BEG == st || HTML_HREF == st)
-                           return parser->str->str;
-                       } break;
+                               return parser->str->str;
+                       } 
+                       break;
                case '&':
                        html_parse_special(parser);
                        break;
                case '&':
                        html_parse_special(parser);
                        break;
@@ -734,68 +735,88 @@ static void html_parse_special(HTMLParser *parser)
                        parser->state = HTML_NORMAL;
                        return;
                } else {
                        parser->state = HTML_NORMAL;
                        return;
                } else {
-                   char *symb = NULL;
-                   switch (ch) {
-                   /* http://www.w3schools.com/html/html_entitiesref.asp */
-                   case 338:   /* capital ligature OE  &OElig;  */
-                       symb = "OE";  break;
-                   case 339:   /* small ligature OE    &oelig;  */
-                       symb = "oe";  break;
-                   case 352:   /* capital S w/caron    &Scaron; */
-                   case 353:   /* small S w/caron      &scaron; */
-                   case 376:   /* cap Y w/ diaeres     &Yuml;   */
-                       break;
-                   case 710:   /* circumflex accent    &circ;   */
-                       symb = "^";  break;
-                   case 732:   /* small tilde          &tilde;  */
-                       symb = "~";  break;
-                   case 8194:  /* en space             &ensp;   */
-                   case 8195:  /* em space             &emsp;   */
-                   case 8201:  /* thin space           &thinsp; */
-                       symb = " ";  break;
-                   case 8204:  /* zero width non-joiner &zwnj;  */
-                   case 8205:  /* zero width joiner    &zwj;    */
-                   case 8206:  /* l-t-r mark           &lrm;    */
-                   case 8207:  /* r-t-l mark           &rlm     */
-                       break;
-                   case 8211:  /* en dash              &ndash;  */
-                       symb = "-";  break;
-                   case 8212:  /* em dash              &mdash;  */
-                       symb = "--";  break;
-                   case 8216:  /* l single quot mark   &lsquo;  */
-                       symb = "`";  break;
-                   case 8217:  /* r single quot mark   &rsquo;  */
-                       symb = "'";  break;
-                   case 8218:  /* single low-9 quot    &sbquo;  */
-                       symb = ",";  break;
-                   case 8220:  /* l double quot mark   &ldquo;  */
-                       symb = "``";  break;
-                   case 8221:  /* r double quot mark   &rdquo;  */
-                       symb = "''";  break;
-                   case 8222:  /* double low-9 quot    &bdquo;  */
-                       symb = ",,";  break;
-                   case 8224:  /* dagger               &dagger; */
-                   case 8225:  /* double dagger        &Dagger; */
-                       break;
-                   case 8230:  /* horizontal ellipsis  &hellip; */
-                       symb = "...";  break;
-                   case 8240:  /* per mile             &permil; */
-                       symb = "\%o";  break;
-                   case 8249:  /* l-pointing angle quot &lsaquo; */
-                       symb = "<";  break;
-                   case 8250:  /* r-pointing angle quot &rsaquo; */
-                       symb = ">";  break;
-                   case 8364:  /* euro                 &euro;   */
-                       symb = "&euro";  break;
-                   case 8482:  /* trademark            &trade;  */
-                       symb  = "(TM)";  break;
-                   default: break;
-                   }
-                   if (symb) {
-                       html_append_str(parser, symb, -1);
-                       parser->state = HTML_NORMAL;
-                       return;
-                   }
+                       char *symb = NULL;
+                       switch (ch) {
+                       /* http://www.w3schools.com/html/html_entitiesref.asp */
+                       case 338:       /* capital ligature OE  &OElig;  */
+                               symb = "OE";  
+                               break;
+                       case 339:       /* small ligature OE    &oelig;  */
+                               symb = "oe";  
+                               break;
+                       case 352:       /* capital S w/caron    &Scaron; */
+                       case 353:       /* small S w/caron      &scaron; */
+                       case 376:       /* cap Y w/ diaeres     &Yuml;   */
+                               break;
+                       case 710:       /* circumflex accent    &circ;   */
+                               symb = "^";  
+                               break;
+                       case 732:       /* small tilde          &tilde;  */
+                               symb = "~";  
+                               break;
+                       case 8194:      /* en space             &ensp;   */
+                       case 8195:      /* em space             &emsp;   */
+                       case 8201:      /* thin space           &thinsp; */
+                               symb = " ";  
+                               break;
+                       case 8204:      /* zero width non-joiner &zwnj;  */
+                       case 8205:      /* zero width joiner    &zwj;   */
+                       case 8206:      /* l-t-r mark           &lrm;   */
+                       case 8207:      /* r-t-l mark           &rlm     */
+                               break;
+                       case 8211:      /* en dash              &ndash;  */
+                               symb = "-";  
+                               break;
+                       case 8212:      /* em dash              &mdash;  */
+                               symb = "--";  
+                               break;
+                       case 8216:      /* l single quot mark   &lsquo;  */
+                               symb = "`";  
+                               break;
+                       case 8217:      /* r single quot mark   &rsquo;  */
+                               symb = "'";  
+                               break;
+                       case 8218:      /* single low-9 quot    &sbquo;  */
+                               symb = ",";  
+                               break;
+                       case 8220:      /* l double quot mark   &ldquo;  */
+                               symb = "``";  
+                               break;
+                       case 8221:      /* r double quot mark   &rdquo;  */
+                               symb = "''";  
+                               break;
+                       case 8222:      /* double low-9 quot    &bdquo;  */
+                               symb = ",,";  
+                               break;
+                       case 8224:      /* dagger               &dagger; */
+                       case 8225:      /* double dagger        &Dagger; */
+                               break;
+                       case 8230:      /* horizontal ellipsis  &hellip; */
+                               symb = "...";  
+                               break;
+                       case 8240:      /* per mile             &permil; */
+                               symb = "\%o";  
+                               break;
+                       case 8249:      /* l-pointing angle quot &lsaquo; */
+                               symb = "<";  
+                               break;
+                       case 8250:      /* r-pointing angle quot &rsaquo; */
+                               symb = ">";  
+                               break;
+                       case 8364:      /* euro                 &euro;   */
+                               symb = "EUR";  
+                               break;
+                       case 8482:      /* trademark            &trade;  */
+                               symb  = "(TM)";  
+                               break;
+                       default: 
+                               break;
+                       }
+                       if (symb) {
+                               html_append_str(parser, symb, -1);
+                               parser->state = HTML_NORMAL;
+                               return;
+                       }
                }
        }
 
                }
        }
 
index 1c7229a..f47a951 100644 (file)
@@ -239,8 +239,9 @@ gint msgcache_get_memory_usage(MsgCache *cache)
        guint32 idata; \
        size_t ni; \
  \
        guint32 idata; \
        size_t ni; \
  \
-       if (sizeof(idata) != (ni = fread(&idata, 1, sizeof(idata), fp))) { \
-               g_warning("read_int: Cache data corrupted, read %d of %d at offset %d\n", ni, sizeof(idata), ftell(fp)); \
+       if ((ni = fread(&idata, 1, sizeof(idata), fp)) != sizeof(idata)) { \
+               g_warning("read_int: Cache data corrupted, read %d of %d at " \
+                         "offset %d\n", ni, sizeof(idata), ftell(fp)); \
                procmsg_msginfo_free(msginfo); \
                error = TRUE; \
                break; \
                procmsg_msginfo_free(msginfo); \
                error = TRUE; \
                break; \
@@ -323,39 +324,43 @@ static FILE *msgcache_open_data_file(const gchar *file, gint version,
        return fp;
 }
 
        return fp;
 }
 
-static gint 
-msgcache_read_cache_data_str(FILE *fp, gchar **str, StringConverter *conv)
+static gint msgcache_read_cache_data_str(FILE *fp, gchar **str, 
+                                        StringConverter *conv)
 {
 {
-    gchar *tmpstr = NULL;
-    size_t ni;
-    guint32 len;
-
-    *str = NULL;
-    if (sizeof(len) != (ni = fread(&len, 1, sizeof(len), fp))
-       || len > G_MAXINT) {
-       g_warning("read_data_str: Cache data (len) corrupted, read %d of %d bytes at offset %d\n", 
-               ni, sizeof(len), ftell(fp));
-       return -1;
-    }
-    if (0 == len)
+       gchar *tmpstr = NULL;
+       size_t ni;
+       guint32 len;
+
+       *str = NULL;
+       if ((ni = fread(&len, 1, sizeof(len), fp) != sizeof(len)) ||
+           len > G_MAXINT) {
+               g_warning("read_data_str: Cache data (len) corrupted, read %d "
+                         "of %d bytes at offset %d\n", ni, sizeof(len), 
+                         ftell(fp));
+               return -1;
+       }
+
+       if (len == 0)
+               return 0;
+
+       tmpstr = g_malloc(len + 1);
+
+       if ((ni = fread(tmpstr, 1, len, fp)) != len) {
+               g_warning("read_data_str: Cache data corrupted, read %d of %d "
+                         "bytes at offset %d\n", 
+                         ni, len, ftell(fp));
+               g_free(tmpstr);
+               return -1;
+       }
+       tmpstr[len] = 0;
+
+       if (conv != NULL) {
+               *str = conv->convert(conv, tmpstr);
+               g_free(tmpstr);
+       } else 
+               *str = tmpstr;
+
        return 0;
        return 0;
-    tmpstr = g_malloc(len + 1);
-
-    if (len != (ni = fread(tmpstr, 1, len, fp))) {
-       g_warning("read_data_str: Cache data corrupted, read %d of %d bytes at offset %d\n", 
-               ni, len, ftell(fp));
-       g_free(tmpstr);
-       return -1;
-    }
-    tmpstr[len] = 0;
-
-    if (conv != NULL) {
-           *str = conv->convert(conv, tmpstr);
-           g_free(tmpstr);
-    } else 
-           *str = tmpstr;
-
-    return 0;
 }
 
 gchar *strconv_strdup_convert(StringConverter *conv, gchar *srcstr)
 }
 
 gchar *strconv_strdup_convert(StringConverter *conv, gchar *srcstr)