]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 267] Fix gcc warnings in -Wall mode
authorDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 22:32:29 +0000 (22:32 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 22:32:29 +0000 (22:32 +0000)
Fixes suggest parentheses around assignment used as truth value
This is Patrice's second kill. Nice work!

17 files changed:
faxd/DestControl.c++
faxd/FaxAcctInfo.c++
faxd/FaxRequest.c++
faxd/G3Decoder.c++
faxmail/MsgFmt.c++
faxmail/faxmail.c++
hfaxd/FileSystem.c++
hfaxd/Jobs.c++
hfaxd/OldProtocol.c++
hfaxd/RecvQueue.c++
hfaxd/Status.c++
hfaxd/User.c++
util/DialRules.c++
util/Dictionary.c++
util/FaxDB.c++
util/PageSize.c++
util/dialtest.c++

index 27ecf591b3600916b3641215cd6bf9eef36cbe1b..b6352f0de57a6d258a5ce7f5c6226207994246d4 100644 (file)
@@ -207,9 +207,9 @@ DestControl::readLine(FILE* fp, char line[], u_int cc)
        return (false);
     lineno++;
     char* cp;
-    if (cp = strchr(line, '#'))
+    if ((cp = strchr(line, '#')))
        *cp = '\0';
-    if (cp = strchr(line, '\n'))
+    if ((cp = strchr(line, '\n')))
        *cp = '\0';
     return (true);
 }
index 143a75d4a849685c9c7b166d6eafae179fa1cdff..452be14cd2428b7fde23b3c518f881c170cbf4c1 100644 (file)
@@ -51,7 +51,7 @@ FaxAcctInfo::record(const char* cmd) const
        record.fput("\t%s", jobid);             // $ 5 = jobid
        u_int i = 0;
        char c;
-       for (const char* cp = jobtag; c = *cp; cp++) {
+       for (const char* cp = jobtag; (c = *cp); cp++) {
            if (i == sizeof (buf)-2)            // truncate string
                break;
            if (c == '\t')                      // tabs are field delimiters
index 1b0382034002dbb373df2f3577e491ab1d5a7375..3c5ecaf9fa3843deaec85990a50cdb3b73f541f7 100644 (file)
@@ -545,7 +545,7 @@ hasDotDot(const char* pathname)
     while (cp) {
        if (cp[0] == '.')               // NB: good enough
            return (true);
-       if (cp = strchr(cp, '/'))
+       if ((cp = strchr(cp, '/')))
            cp++;
     }
     return (false);
index 2134685905ba2c803cc2b237f52f95249b0fff22..0d6ac30cf337802c4bf50b525803ffe47d3695d8 100644 (file)
@@ -116,7 +116,7 @@ void
 G3Decoder::setRuns(tiff_runlen_t* cr, tiff_runlen_t* rr, int w)
 {
     curruns = cr;
-    if (refruns = rr) {
+    if ((refruns = rr)) {
        refruns[0] = w;
        refruns[1] = 0;
     }
index e067286a4659ab3e56cf6805c7de4a4e0b56c67d..64dd73eb183a8a4b42822949270af4037a115d2a 100644 (file)
@@ -173,7 +173,7 @@ MsgFmt::setConfigItem(const char* tag, const char* value)
             } else {
                 headToKeep.append(cp);
             }
-        } while (cp = tp);
+        } while ((cp = tp));
         delete [] cp;
     } else if (streq(tag, "mapheader")) {
        char* tp = (char *) strchr(value, ' ');
index 81400c3006f8b45731d0abb8bf85370068209f52..3d866174fb6718e06c01afa1bc975ee113b7438a 100644 (file)
@@ -230,7 +230,7 @@ faxMailApp::run(int argc, char** argv)
            job->setDialString(dest);
        }
        const fxStr* s;
-       if (s = findHeader("x-fax-dialstring")) // dialstring in envelope
+       if ((s = findHeader("x-fax-dialstring")))  // dialstring in envelope
            job->setDialString(*s);
        if (job->getDialString() == "")
            fxFatal("No Destination/Dialstring specified");
@@ -240,7 +240,7 @@ faxMailApp::run(int argc, char** argv)
         */
        if (optind+1 < argc) {
            client->setFromIdentity(argv[optind+1]);
-       } else if (s = findHeader("from")) {
+       } else if ((s = findHeader("from"))) {
            client->setFromIdentity(*s);
        } else {
            fxFatal("No From/Sender identity specified");
index cb2cf8433e96f853394cd82aeddd32784f227544..10d0b2548b9f9b1a1cd0fb3f577e7e3b282e7c9b 100644 (file)
@@ -488,7 +488,7 @@ HylaFAXServer::listDirectory(FILE* fd, const SpoolDir& sd, DIR* dir)
      */
     fxStr path(sd.pathname);
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        if (dp->d_name[0] == '.' &&
          (dp->d_name[1] == '\0' || strcmp(dp->d_name, "..") == 0))
            continue;
@@ -706,7 +706,7 @@ HylaFAXServer::nlstDirectory(FILE* fd, const SpoolDir& sd, DIR* dir)
      */
     fxStr path(sd.pathname);
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        if (dp->d_name[0] == '.' &&
          (dp->d_name[1] == '\0' || strcmp(dp->d_name, "..") == 0))
            continue;
index be7c4ea8da6f776431ba4d03a312106c4f4afda3..aed2767ed63b4b3c286ed3faa8dafae022c06240 100644 (file)
@@ -1826,7 +1826,7 @@ void
 HylaFAXServer::listSendQ(FILE* fd, const SpoolDir&, DIR* dir)
 {
     struct dirent* dp;
-    while (dp = readdir(dir))
+    while ((dp = readdir(dir)))
        if (dp->d_name[0] == 'q') {
            fxStr emsg;
            Job* job = findJob(&dp->d_name[1], emsg);
@@ -1853,7 +1853,7 @@ void
 HylaFAXServer::nlstSendQ(FILE* fd, const SpoolDir&, DIR* dir)
 {
     struct dirent* dp;
-    while (dp = readdir(dir))
+    while ((dp = readdir(dir)))
        if (dp->d_name[0] == 'q') {
            fxStr emsg;
            Job* job = findJob(&dp->d_name[1], emsg);
index c56b4fefd95b83f45f7db5c66b407e265b7a100c..db5c62ba62b5d50781951fe22e27ac2b75a15c28 100644 (file)
@@ -280,7 +280,7 @@ OldProtocolServer::doProtocol(void)
             */
            if (strncmp(tag, _PATH_DEV, l) == 0)
                tag += l;
-           for (cp = tag; cp = strchr(cp, '/'); *cp = '_')
+           for (cp = tag; (cp = strchr(cp, '/')); *cp = '_')
                ;
            modem = tag;
        } else {
@@ -1120,7 +1120,7 @@ OldProtocolServer::decodeLZW(FILE* fin, FILE* fout)
            char* tp = (len > sizeof (buf) ? (char*) malloc(len) : buf) + len;
            do {
                *--tp = codep->value;
-           } while (codep = codep->next);
+           } while ((codep = codep->next));
            fwrite(tp, len, 1, fout);
            total += len;
            if (tp != buf)
@@ -1359,7 +1359,7 @@ OldProtocolServer::sendRecvStatus(const char*)
            FAX_RECVDIR);
     fxStr path(FAX_RECVDIR "/");
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        const char* name = dp->d_name;
        if (name[0] != 'f' || name[1] != 'a' || name[2] != 'x')
            continue;
index 26d33e1d531dd7705350d0824c9da95293d009f4..85f64f3e41483fefd7dd28ac3f0d3ceec3b64b73 100644 (file)
@@ -196,7 +196,7 @@ HylaFAXServer::listRecvQ(FILE* fd, const SpoolDir& sd, DIR* dir)
      */
     fxStr path(sd.pathname);
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        struct stat sb;
        if (!isVisibleRecvQFile(dp->d_name, sb))
            continue;
index 3772aa960617d8216348e47792b645ae25e166f0..232ceb9c125388ab367a990cd2ab9e5e8837383f 100644 (file)
@@ -131,7 +131,7 @@ HylaFAXServer::listStatus(FILE* fd, const SpoolDir& sd, DIR* dir)
     struct stat sb;
     fxStr fifoPrefix("/" FAX_FIFO ".");
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        fxStr statusFile(path | dp->d_name);
        if (!FileCache::update(statusFile, sb) || !S_ISREG(sb.st_mode))
            continue;
@@ -308,7 +308,7 @@ HylaFAXServer::nlstStatus(FILE* fd, const SpoolDir& sd, DIR* dir)
     struct stat sb;
     fxStr fifoPrefix("/" FAX_FIFO ".");
     struct dirent* dp;
-    while (dp = readdir(dir)) {
+    while ((dp = readdir(dir))) {
        fxStr statusFile(path | dp->d_name);
        if (!FileCache::update(statusFile, sb) || !S_ISREG(sb.st_mode))
            continue;
index 97555acf234ded9f2be2e733b578ba23dd196165..6779e25446a1d02f78b72e64c47fd8003d637232 100644 (file)
@@ -74,7 +74,7 @@ nextRecord(FILE* db, char line[], u_int size)
                    break;
            *cp = '\0';
        }
-       if (cp = strchr(line, '\n'))
+       if ((cp = strchr(line, '\n')))
            *cp = '\0';
        if (line[0] != '\0')
            return (true);
index 1438399c654bd4c59d2f8b448f175f3e1c4b71c4..3fa7346ccf4b87ed14bcf126ab242d22e4e17dd0 100644 (file)
@@ -120,7 +120,7 @@ DialStringRules::parseRules()
 {
     char line[1024];
     char* cp;
-    while (cp = nextLine(line, sizeof (line))) {
+    while ((cp = nextLine(line, sizeof (line)))) {
        // collect token
        if (!isalpha(*cp)) {
            parseError("Syntax error, expecting identifier");
@@ -183,12 +183,12 @@ DialStringRules::nextLine(char* line, int lineSize)
        if (!fgets(line, lineSize, fp))
            return (NULL);
        lineno++;
-       for (cp = line; cp = strchr(cp, '!'); cp++)
+       for (cp = line; (cp = strchr(cp, '!')); cp++)
            if (cp == line || cp[-1] != '\\')
                break;
        if (cp)
            *cp = '\0';
-       else if (cp = strchr(line, '\n'))
+       else if ((cp = strchr(line, '\n')))
            *cp = '\0';
        for (cp = line; isspace(*cp); cp++)
            ;
index 8f55471fefbe0c5f696528b7aa9a83a92ae83dd4..dcadee81d7fba229ab7dd02d4ca3bf90930b436a 100644 (file)
@@ -326,7 +326,7 @@ fxDictIter::advanceToValid()
            invalid = true;
            break;
        }
-       if (n = dict->buckets[bucket]) {        // NB: intentional =
+       if ((n = dict->buckets[bucket])) {      // NB: intentional =
            node = n;
            invalid = false;
            break;
index bc85796178a3e01d1d81622a576f2380032f39c9..ef8cae0fd3f38381523ae840e317db71a85fab7c 100644 (file)
@@ -33,7 +33,7 @@ FaxDBRecord::FaxDBRecord()
 
 FaxDBRecord::FaxDBRecord(FaxDBRecord* other)
 {
-    if (parent = other)
+    if ((parent = other))
        parent->inc();
 }
 
index a362a0d627f7acf8b78be1a80762a93030fa9be1..5a6997f0d248a1a2c152ae6bb94079529767c297 100644 (file)
@@ -84,7 +84,7 @@ PageSizeInfo::readPageInfoFile()
            char* cp = strchr(line, '#');
            if (cp)
                *cp = '\0';
-           else if (cp = strchr(line, '\n'))
+           else if ((cp = strchr(line, '\n')))
                *cp = '\0';
            for (cp = line; isspace(*cp); cp++)
                ;
index 8061491b98da17954a16b974abc3c95949323d89..31063fe579dc6c261b10206da9a56306a11361ac 100644 (file)
@@ -109,7 +109,7 @@ main(int argc, char* argv[])
            *cp = '\0';
        if (verbose)
            printf("input = \"%s\"\n", line);
-       if (cp = strchr(line, '(')) {
+       if ((cp = strchr(line, '('))) {
            char* ep = strchr(cp, ')');
            if (ep)
                *ep = '\0';