changeset 2103:16e52ecf20a8

Eliminated a pack of 22 compiler warnings (gcc-4.6.1 amd64)
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 21 Jun 2011 21:06:38 -0400
parents e1973d1962c5
children 3e7e5395f0bc
files dpi/downloads.cc dpid/misc_new.c dpip/dpip.c dw/fltkui.cc dw/style.cc src/cssparser.cc src/html.cc src/nav.c src/table.cc src/ui.cc test/dw_anchors_test.cc
diffstat 11 files changed, 31 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/dpi/downloads.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/dpi/downloads.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -599,13 +599,11 @@
    const int BufLen = 4096;
    char Buf[BufLen];
    ssize_t st;
-   int ret = -1;
 
    do {
       st = read(fd_in, Buf, BufLen);
       if (st < 0) {
          if (errno == EAGAIN) {
-            ret = 1;
             break;
          }
          perror("read, ");
@@ -614,7 +612,6 @@
          close(fd_in);
          Fl::remove_fd(fd_in, 1);
          dl_item->log_done(1);
-         ret = 0;
          break;
       } else {
          dl_item->log_text_add(Buf, st);
--- a/dpid/misc_new.c	Tue Jun 21 00:15:55 2011 +0000
+++ b/dpid/misc_new.c	Tue Jun 21 21:06:38 2011 -0400
@@ -71,14 +71,12 @@
  */
 char *a_Misc_readtag(int sock)
 {
-   char *tag, c, buf[10];
-   size_t buflen, i;
+   char *tag, c;
+   size_t i;
    size_t taglen = 0, tagmem = 10;
    ssize_t rdln = 1;
 
    tag = NULL;
-   buf[0] = '\0';
-   buflen = sizeof(buf) / sizeof(buf[0]);
    // new start
    tag = (char *) dMalloc(tagmem + 1);
    for (i = 0; (rdln = read(sock, &c, 1)) != 0; i++) {
--- a/dpip/dpip.c	Tue Jun 21 00:15:55 2011 +0000
+++ b/dpip/dpip.c	Tue Jun 21 21:06:38 2011 -0400
@@ -214,11 +214,13 @@
       MSG_ERR("[a_Dpip_check_auth] empty file: %s\n", fname);
    } else {
       port = strtol(rcline, &tail, 10);
-      for (i = 0; *tail && isxdigit(tail[i+1]); ++i)
-         SharedSecret[i] = tail[i+1];
-      SharedSecret[i] = 0;
-      if (strcmp(msg, SharedSecret) == 0)
-         ret = 1;
+      if (tail && port != 0) {
+         for (i = 0; *tail && isxdigit(tail[i+1]); ++i)
+            SharedSecret[i] = tail[i+1];
+         SharedSecret[i] = 0;
+         if (strcmp(msg, SharedSecret) == 0)
+            ret = 1;
+      }
    }
    if (In)
       fclose(In);
@@ -376,7 +378,7 @@
 static void Dpip_dsh_read(Dsh *dsh, int blocking)
 {
    char buf[RBUF_SZ];
-   int req_mode, old_flags = 0, st, ret = -3, nb = !blocking;
+   int req_mode, old_flags = 0, st, nb = !blocking;
 
    dReturn_if (dsh->status == DPIP_ERROR || dsh->status == DPIP_EOF);
 
@@ -395,7 +397,6 @@
             continue;
          } else if (errno == EAGAIN) {
             dsh->status = DPIP_EAGAIN;
-            ret = -1;
             break;
          } else {
             MSG_ERR("[Dpip_dsh_read] %s\n", dStrerror(errno));
--- a/dw/fltkui.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/dw/fltkui.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -1126,7 +1126,7 @@
 
    enabled &= parent->is_active();
    item->activate(enabled);
-   item->user_data((void *)index);
+   item->user_data((void*)(long)index);
    itemsSelected.increase ();
    itemsSelected.set (itemsSelected.size() - 1, selected);
 
--- a/dw/style.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/dw/style.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -815,8 +815,7 @@
                  Style *style, bool inverse)
 {
    /** \todo a lot! */
-   Color::Shading dark, light, normal;
-   int xb1, yb1, xb2, yb2, xp1, yp1, xp2, yp2;
+   int xb1, yb1, xb2, yb2;
 
    // top left and bottom right point of outer border boundary
    xb1 = x + style->margin.left;
@@ -824,15 +823,17 @@
    xb2 = x + (width > 0 ? width - 1 : 0) - style->margin.right;
    yb2 = y + (height > 0 ? height - 1 : 0) - style->margin.bottom;
 
-   // top left and bottom right point of inner border boundary
-   xp1 = xb1 + style->borderWidth.left;
-   yp1 = yb1 + style->borderWidth.top;
-   xp2 = xb2 - style->borderWidth.right;
-   yp2 = yb2 - style->borderWidth.bottom;
-
-   light = inverse ? Color::SHADING_DARK : Color::SHADING_LIGHT;
-   dark = inverse ? Color::SHADING_LIGHT : Color::SHADING_DARK;
-   normal = inverse ? Color::SHADING_INVERSE : Color::SHADING_NORMAL;
+   /*
+      // top left and bottom right point of inner border boundary
+      xp1 = xb1 + style->borderWidth.left;
+      yp1 = yb1 + style->borderWidth.top;
+      xp2 = xb2 - style->borderWidth.right;
+      yp2 = yb2 - style->borderWidth.bottom;
+   
+      light = inverse ? Color::SHADING_DARK : Color::SHADING_LIGHT;
+      dark = inverse ? Color::SHADING_LIGHT : Color::SHADING_DARK;
+      normal = inverse ? Color::SHADING_INVERSE : Color::SHADING_NORMAL;
+   */
 
    drawBorderRight(view, style, xb2, yb1, xb2, yb2);
    drawBorderLeft(view, style, xb1, yb1, xb1, yb2);
--- a/src/cssparser.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/src/cssparser.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -1049,7 +1049,7 @@
                                  CssPropertyList * importantProps)
 {
    CssPropertyInfo pi = {NULL, {CSS_TYPE_UNUSED}, NULL}, *pip;
-   CssShorthandInfo si, *sip;
+   CssShorthandInfo *sip;
    CssValueType type = CSS_TYPE_UNUSED;
 
    CssPropertyName prop;
@@ -1087,7 +1087,6 @@
          }
       } else {
          /* Try shorthands. */
-         si.symbol = tval;
          sip =
              (CssShorthandInfo *) bsearch(&pi, Css_shorthand_info,
                                           CSS_SHORTHAND_NUM,
--- a/src/html.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/src/html.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -1718,7 +1718,6 @@
 static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
 {
    const char *attrbuf;
-   Textblock *textblock;
    int32_t color;
    int tag_index_a = a_Html_tag_index ("a");
    style::Color *bgColor;
@@ -1736,8 +1735,6 @@
       BUG_MSG("unclosed HEAD element\n");
    }
 
-   textblock = HT2TB(html);
-
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
       color = a_Html_color_parse(html, attrbuf, -1);
       if (color != -1)
@@ -2165,7 +2162,6 @@
 {
    DilloImage *Image;
    DilloUrl *url, *usemap_url;
-   Textblock *textblock;
    const char *attrbuf;
 
    /* This avoids loading images. Useful for viewing suspicious HTML email. */
@@ -2176,8 +2172,6 @@
        !(url = a_Html_url_new(html, attrbuf, NULL, 0)))
       return;
 
-   textblock = HT2TB(html);
-
    usemap_url = NULL;
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "usemap")))
       /* TODO: usemap URLs outside of the document are not used. */
@@ -2254,12 +2248,11 @@
 static
 misc::SimpleVector<int> *Html_read_coords(DilloHtml *html, const char *str)
 {
-   int i, coord;
+   int coord;
    const char *tail = str;
    char *newtail = NULL;
    misc::SimpleVector<int> *coords = new misc::SimpleVector<int> (4);
 
-   i = 0;
    while (1) {
       coord = strtol(tail, &newtail, 10);
       if (coord == 0 && newtail == tail)
@@ -2959,14 +2952,13 @@
 
             if (endq && (endq - data <= 51)) {
                /* IANA limits charset names to 40 characters */
-               const char *ignored;
                char *content_type;
 
                *endq = '\0';
                content_type = dStrconcat("text/css; charset=", data+10, NULL);
                *endq = '"';
                a_Capi_unref_buf(url);
-               ignored = a_Capi_set_content_type(url, content_type, "meta");
+               a_Capi_set_content_type(url, content_type, "meta");
                dFree(content_type);
                a_Capi_get_buf(url, &data, &len);
             }
--- a/src/nav.c	Tue Jun 21 00:15:55 2011 +0000
+++ b/src/nav.c	Tue Jun 21 21:06:38 2011 -0400
@@ -195,13 +195,12 @@
                          const DilloUrl *requester, int offset)
 {
    const DilloUrl *old_url;
-   bool_t MustLoad, ForceReload, Repush, IgnoreScroll;
+   bool_t MustLoad, ForceReload, IgnoreScroll;
    int x, y, idx, ClientKey;
    DilloWeb *Web;
 
    MSG("Nav_open_url: new url='%s'\n", URL_STR_(url));
 
-   Repush = (URL_FLAGS(url) & URL_ReloadFromCache) != 0;
    ForceReload = (URL_FLAGS(url) & (URL_E2EQuery + URL_ReloadFromCache)) != 0;
    IgnoreScroll = (URL_FLAGS(url) & URL_IgnoreScroll) != 0;
 
--- a/src/table.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/src/table.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -151,7 +151,6 @@
 {
    const char *attrbuf;
    int32_t bgcolor = -1;
-   bool new_style = false;
 
    html->styleEngine->inheritNonCssHints ();
 
@@ -183,10 +182,8 @@
       if (bgcolor != -1) {
          html->styleEngine->setNonCssHint(CSS_PROPERTY_BACKGROUND_COLOR,
                                           CSS_TYPE_COLOR, bgcolor);
-         new_style = true;
       }
-      if (a_Html_tag_set_valign_attr (html, tag, tagsize))
-         new_style = true;
+      a_Html_tag_set_valign_attr (html, tag, tagsize);
       break;
    default:
       break;
@@ -318,7 +315,6 @@
    int colspan = 1, rowspan = 1;
    const char *attrbuf;
    int32_t bgcolor;
-   bool_t new_style;
 
    html->styleEngine->inheritNonCssHints ();
 
@@ -363,8 +359,7 @@
                                            a_Html_parse_length (html, attrbuf));
       }
 
-      if (a_Html_tag_set_valign_attr (html, tag, tagsize))
-         new_style = TRUE;
+      a_Html_tag_set_valign_attr (html, tag, tagsize);
 
       if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
          bgcolor = a_Html_color_parse(html, attrbuf, -1);
--- a/src/ui.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/src/ui.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -425,7 +425,7 @@
       b->image(img);
    if (deimg)
       b->deimage(deimg);
-   b->callback(b1_cb, (void *)b_n);
+   b->callback(b1_cb, INT2VOIDP(b_n));
    b->clear_visible_focus();
    b->labelsize(12);
    b->box(FL_FLAT_BOX);
--- a/test/dw_anchors_test.cc	Tue Jun 21 00:15:55 2011 +0000
+++ b/test/dw_anchors_test.cc	Tue Jun 21 21:06:38 2011 -0400
@@ -112,7 +112,7 @@
       buf[0] = toupper (buf[0]);
       buttonLabel[i] = strdup(buf);
       Fl_Button *button = new Fl_Button(0, 20 * i, 50, 20, buttonLabel[i]);
-      button->callback (anchorCallback, (void*)i);
+      button->callback (anchorCallback, (void*)(long)i);
       button->when (FL_WHEN_RELEASE);
    }