changeset 90:4580d53cefff

More warning fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 00:25:21 +0300
parents 99242b34e6dc
children c9a76fd021bf
files src/entry2.cc src/gfx.cc src/gfx3.cc src/menu.cc src/wads2.cc src/x_hover.cc src/yadex.cc
diffstat 7 files changed, 31 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/entry2.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/entry2.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -587,9 +587,7 @@
                     ;                // FIXME
                 }
             }
-            else;                // FIXME
         }
-        else;                        // To be implemented later
     }
     return 0;
 }
--- a/src/gfx.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/gfx.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -1024,7 +1024,7 @@
  */
 void DrawScreenMeter(int scrx1, int scry1, int scrx2, int scry2, float value)
 {
-#if defined Y_BGI
+#if defined(Y_BGI)
     if (value < 0.0)
         value = 0.0;
     if (value > 1.0)
@@ -1035,8 +1035,13 @@
     setfillstyle(1, TranslateToDoomColor(LIGHTGREEN));
     bar(scrx1 + 1, scry1 + 1, scrx1 + 1 + (int) ((scrx2 - scrx1 - 2) * value),
         scry2 - 1);
-#elif defined Y_X11
+#elif defined(Y_X11)
     // FIXME
+    (void) scrx1;
+    (void) scry1;
+    (void) scrx2;
+    (void) scry2;
+    (void) value;
 #endif
 }
 
--- a/src/gfx3.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/gfx3.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -41,16 +41,19 @@
  *        Grab a rectangle from the window or screen into an
  *        Rgbbmp, in a portable fashion.
  */
-void window_to_rgbbmp(int x, int y, int width, int height, Rgbbmp & b)
+void window_to_rgbbmp(int x0, int y0, int width, int height, Rgbbmp & b)
 {
     b.resize(width, height);
+
     // FIXME
     for (int y = 0; y < b.height(); y++)
         for (int x = 0; x < b.width(); x++)
             b.set_r(x, y, 255 * (b.height() - y) / b.height());
+
     for (int y = 0; y < b.height(); y++)
         for (int x = 0; x < b.width(); x++)
             b.set_g(x, y, 255 * (b.width() - x) / b.width());
+
     for (int y = 0; y < b.height(); y++)
         for (int x = 0; x < b.width(); x++)
             b.set_b(x, y, 255 * (x + y) / (b.width() + b.height()));
@@ -73,9 +76,11 @@
         fflush(stderr);
         return 1;
     }
+
     fprintf(fd, "P6\n"
             "# Created by Yadex %s\n"
             "%d %d\n" "255\n", yadex_version, b.width(), b.height());
+
     for (int y = 0; y < b.height(); y++)
         for (int x = 0; x < b.width(); x++)
         {
@@ -83,6 +88,7 @@
             putc(b.get_g(x, y), fd);
             putc(b.get_b(x, y), fd);
         }
+
     if (fclose(fd))
     {
         fflush(stdout);
--- a/src/menu.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/menu.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -988,9 +988,9 @@
         geom();
 
     // Do we need to redraw everything from scratch ?
-    if (visible && !visible_disp
-        || ox0 != ox0_disp
-        || oy0 != oy0_disp || width != width_disp || height != height_disp)
+    if ((visible && !visible_disp) ||
+        ox0 != ox0_disp || oy0 != oy0_disp ||
+        width != width_disp || height != height_disp)
         from_scratch = true;
 
     // Display the static part of the menu
--- a/src/wads2.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/wads2.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -461,8 +461,7 @@
         bool e = file_read_bytes(wf->fp, wf->type, 4);
         e |= file_read_i32(wf->fp, &wf->dirsize);
         e |= file_read_i32(wf->fp, &wf->dirstart);
-        if (e || memcmp(wf->type, "IWAD", 4) != 0
-            && memcmp(wf->type, "PWAD", 4) != 0)
+        if (e || (memcmp(wf->type, "IWAD", 4) != 0 && memcmp(wf->type, "PWAD", 4) != 0))
         {
             printf("%.128s: not a wad (bad header)\n", filename);
             fail = true;
--- a/src/x_hover.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/x_hover.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -178,9 +178,10 @@
         /* Skip all lines of which all points are more than <mapslack>
            units away from (x,y). In a typical level, this test will
            filter out all the linedefs but a handful. */
-        if (x0 < xmin && x1 < xmin
-            || x0 > xmax && x1 > xmax
-            || y0 < ymin && y1 < ymin || y0 > ymax && y1 > ymax)
+        if ((x0 < xmin && x1 < xmin) ||
+            (x0 > xmax && x1 > xmax) ||
+            (y0 < ymin && y1 < ymin) ||
+            (y0 > ymax && y1 > ymax))
             continue;
 
         /* This is where it gets ugly. We're trying to calculate the
@@ -209,7 +210,8 @@
                rightmost end or between the two ? */
             if (x < (dx > 0 ? x0 : x1))
                 dist = hypot(x - (dx > 0 ? x0 : x1), y - (dx > 0 ? y0 : y1));
-            else if (x > (dx > 0 ? x1 : x0))
+            else
+            if (x > (dx > 0 ? x1 : x0))
                 dist = hypot(x - (dx > 0 ? x1 : x0), y - (dx > 0 ? y1 : y0));
             else
                 dist = fabs(y0 + ((double) dy) / dx * (x - x0) - y);
@@ -220,7 +222,8 @@
             /* Are we above the high end or below the low end or in between ? */
             if (y < (dy > 0 ? y0 : y1))
                 dist = hypot(x - (dy > 0 ? x0 : x1), y - (dy > 0 ? y0 : y1));
-            else if (y > (dy > 0 ? y1 : y0))
+            else
+            if (y > (dy > 0 ? y1 : y0))
                 dist = hypot(x - (dy > 0 ? x1 : x0), y - (dy > 0 ? y1 : y0));
             else
                 dist = fabs(x0 + ((double) dx) / dy * (y - y0) - x);
@@ -264,8 +267,7 @@
     int best_match = -1;
     int curx = 32767;                // Oh yes, one more hard-coded constant!
     for (int n = 0; n < NumLineDefs; n++)
-        if ((Vertices[LineDefs[n].start].y > y)
-            != (Vertices[LineDefs[n].end].y > y))
+        if ((Vertices[LineDefs[n].start].y > y) != (Vertices[LineDefs[n].end].y > y))
         {
             int lx0 = Vertices[LineDefs[n].start].x;
             int ly0 = Vertices[LineDefs[n].start].y;
@@ -284,11 +286,11 @@
     object.nil();
     if (best_match >= 0)
     {
-        if (Vertices[LineDefs[best_match].start].y
-            > Vertices[LineDefs[best_match].end].y)
+        if (Vertices[LineDefs[best_match].start].y > Vertices[LineDefs[best_match].end].y)
             best_match = LineDefs[best_match].sidedef1;
         else
             best_match = LineDefs[best_match].sidedef2;
+
         if (best_match >= 0)
         {
             object.obj.type = OBJ_SECTORS;
@@ -297,9 +299,7 @@
             object.radius = 1;        // Not meaningful for sectors
             object.inside = true;        // Not meaningful for sectors
         }
-        else;
     }
-    else;
     return object;
 }
 
--- a/src/yadex.cc	Mon Oct 06 00:13:11 2014 +0300
+++ b/src/yadex.cc	Mon Oct 06 00:25:21 2014 +0300
@@ -421,8 +421,8 @@
         nosound();
     }
 #elif defined Y_UNIX
-    freq = msec;                // To prevent a warning about unused variables
-    return;
+    (void) freq;
+    (void) msec;
 #endif
 }