aligrudi / neatroff_make

Neatroff top-level makefile
50 stars 15 forks source link

tbl - fix some gcc warnings #1

Open ghost opened 5 years ago

ghost commented 5 years ago
diff -urN tbl.orig/t3.c tbl/t3.c
--- tbl.orig/t3.c   Tue May  7 19:43:35 2019
+++ tbl/t3.c    Tue May  7 19:15:33 2019
@@ -6,27 +6,27 @@
    char    *optnam; 
    int *optadd;
 } options [] = {
-   "expand", &expflg,
-   "EXPAND", &expflg,
-   "center", &ctrflg,
-   "CENTER", &ctrflg,
-   "box", &boxflg,
-   "BOX", &boxflg,
-   "allbox", &allflg,
-   "ALLBOX", &allflg,
-   "doublebox", &dboxflg,
-   "DOUBLEBOX", &dboxflg,
-   "frame", &boxflg,
-   "FRAME", &boxflg,
-   "doubleframe", &dboxflg,
-   "DOUBLEFRAME", &dboxflg,
-   "tab", &tab,
-   "TAB", &tab,
-   "linesize", &linsize,
-   "LINESIZE", &linsize,
-   "delim", &delim1,
-   "DELIM", &delim1,
-   0, 0
+   { "expand",     &expflg  },
+   { "EXPAND",     &expflg  },
+   { "center",         &ctrflg  },
+   { "CENTER",     &ctrflg  },
+   { "box",        &boxflg  },
+   { "BOX",        &boxflg  },
+   { "allbox",     &allflg  },
+   { "ALLBOX",     &allflg  },
+   { "doublebox",      &dboxflg },
+   { "DOUBLEBOX",      &dboxflg },
+   { "frame",      &boxflg  },
+   { "FRAME",      &boxflg  },
+   { "doubleframe",    &dboxflg },
+   { "DOUBLEFRAME",    &dboxflg },
+   { "tab",        &tab     },
+   { "TAB",        &tab     },
+   { "linesize",       &linsize },
+   { "LINESIZE",       &linsize },
+   { "delim",      &delim1  },
+   { "DELIM",      &delim1  },
+   { 0,            0    }
 };

 void
diff -urN tbl.orig/t4.c tbl/t4.c
--- tbl.orig/t4.c   Tue May  7 19:43:35 2019
+++ tbl/t4.c    Tue May  7 19:20:14 2019
@@ -43,7 +43,7 @@
    char    sn[10], *snp, *temp;

    sawchar = icol = 0;
-   while (c = get1char()) {
+   while ((c = get1char())) {
        switch (c) {
        default:
            if (c != tab) {
@@ -182,7 +182,7 @@
            if (icol <= 0) 
                continue;
            temp = snp = csize[icol-1][nclin];
-           while (c = get1char()) {
+           while ((c = get1char())) {
                if (c == ' ' || c == tab || c == '\n') 
                    break;
                if (c == '-' || c == '+')
@@ -207,7 +207,7 @@
            if (icol <= 0) 
                continue;
            temp = snp = vsize[icol-1][nclin];
-           while (c = get1char()) {
+           while ((c = get1char())) {
                if (c == ' ' || c == tab || c == '\n') 
                    break;
                if (c == '-' || c == '+')
@@ -229,7 +229,7 @@
        case 'W':
            snp = cll [icol-1];
            stopc = 0;
-           while (c = get1char()) {
+           while ((c = get1char())) {
                if (snp == cll[icol-1] && c == '(') {
                    stopc = ')';
                    continue;
@@ -305,7 +305,7 @@
        ;
    if (c != '\n')
        un1getc(c);
-   for (s = line; *s = c = get1char(); s++) {
+   for (s = line; (*s = c = get1char()); s++) {
        if (c == ')') 
            inpar = 0;
        if (inpar) 
diff -urN tbl.orig/t5.c tbl/t5.c
--- tbl.orig/t5.c   Tue May  7 19:43:35 2019
+++ tbl/t5.c    Tue May  7 19:17:58 2019
@@ -31,7 +31,7 @@
        } else 
            instead[nlin] = 0;
        if (nodata(nlin)) {
-           if (ch = oneh(nlin))
+           if ((ch = oneh(nlin)))
                fullbot[nlin] = ch;
            table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
            for (icol = 0; icol < ncol; icol++) {
diff -urN tbl.orig/t6.c tbl/t6.c
--- tbl.orig/t6.c   Tue May  7 19:43:35 2019
+++ tbl/t6.c    Tue May  7 19:18:26 2019
@@ -102,7 +102,7 @@
                reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
        }
        for (ilin = 0; ilin < nlin; ilin++)
-           if (k = lspan(ilin, icol)) {
+           if ((k = lspan(ilin, icol))) {
                ss = table[ilin][icol-k].col;
                if (!real(ss) || barent(ss) || vspen(ss) ) 
                    continue;
diff -urN tbl.orig/t8.c tbl/t8.c
--- tbl.orig/t8.c   Tue May  7 19:43:35 2019
+++ tbl/t8.c    Tue May  7 19:22:34 2019
@@ -227,11 +227,11 @@
            fprintf(tabout, "%c", F1);
        }
        ip = prev(nl);
-       if (ip >= 0)
+       if (ip >= 0) {
            if (vspen(table[ip][c].col)) {
                exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) && 
                    (topat[c] == topat[c+1]) && 
-                   (cmidx == (flags[c+1] [stynum[nl]] & (CTOP | CDOWN) == 0))
+                   (cmidx == ((flags[c+1] [stynum[nl]] & (CTOP | CDOWN)) == 0))
                     && (left(i, c + 1, &lwid) < 0);
                if (exvspen == 0) {
                    fprintf(tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a');
@@ -245,6 +245,7 @@
            }
            else
                exvspen = 0;
+       }
        /* if lines need to be split for gcos here is the place for a backslash */
        if (vct > 7 && c < ncol) {
            fprintf(tabout, "\n.sp-1\n\\&");
diff -urN tbl.orig/t9.c tbl/t9.c
--- tbl.orig/t9.c   Tue May  7 19:43:35 2019
+++ tbl/t9.c    Tue May  7 19:25:21 2019
@@ -1,6 +1,6 @@
 /* t9.c: write lines for tables over 200 lines */
 # include "t.h"
-static useln;
+static int useln;

 void
 yetmore(void)
diff -urN tbl.orig/te.c tbl/te.c
--- tbl.orig/te.c   Tue May  7 19:43:35 2019
+++ tbl/te.c    Tue May  7 14:35:28 2019
@@ -1,5 +1,6 @@
 /* te.c: error message control, input line count */
 #include <string.h>
+#include <stdlib.h>
 #include "t.h"

 void error(char *s)
diff -urN tbl.orig/tm.c tbl/tm.c
--- tbl.orig/tm.c   Tue May  7 19:43:35 2019
+++ tbl/tm.c    Tue May  7 19:06:35 2019
@@ -37,7 +37,7 @@
        exlim = exstore + MAXCHS;
    }
    q = exstore;
-   while (*exstore++ = *str++)
+   while ((*exstore++ = *str++))
        ;
    *p = 0;
    return(q);
@@ -50,7 +50,7 @@
                /* true if s is in a eqn within p */
    int ineq = 0, c;

-   while (c = *p) {
+   while ((c = *p)) {
        if (s == p)
            return(ineq);
        p++;
diff -urN tbl.orig/ts.c tbl/ts.c
--- tbl.orig/ts.c   Tue May  7 19:43:35 2019
+++ tbl/ts.c    Tue May  7 19:05:35 2019
@@ -64,7 +64,7 @@
 void
 tcopy (char *s, char *t)
 {
-   while (*s++ = *t++)
+   while ((*s++ = *t++))
        ;
 }

diff -urN tbl.orig/tt.c tbl/tt.c
--- tbl.orig/tt.c   Tue May  7 19:43:35 2019
+++ tbl/tt.c    Tue May  7 19:17:15 2019
@@ -119,7 +119,7 @@
        return(1);
    if (vspen(s)) 
        return(1);
-   if (t = barent( s))
+   if ((t = barent( s)))
        return(t);
    return(0);
 }
aligrudi commented 5 years ago

Applied.

Thanks, Ali