]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Cleanup compiler warnings in faxd/
authorAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:09:15 +0000 (18:09 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:09:15 +0000 (18:09 +0000)
22 files changed:
faxd/Class1Recv.c++
faxd/Class2Recv.c++
faxd/CopyQuality.c++
faxd/FaxMachineInfo.c++
faxd/FaxRequest.c++
faxd/G3Encoder.c++
faxd/Getty.c++
faxd/JobControl.c++
faxd/MemoryDecoder.c++
faxd/ModemServer.c++
faxd/TagLine.c++
faxd/UUCPLock.c++
faxd/choptest.c++
faxd/cqtest.c++
faxd/faxGettyApp.c++
faxd/faxQCleanApp.c++
faxd/faxQueueApp.c++
faxd/faxSendApp.c++
faxd/pageSendApp.c++
faxd/tagtest.c++
faxd/tif_fax3.h
faxd/tsitest.c++

index 2473ea21b06d41823ea7ffb14fdc0b6e539ee216..9821bdf7b8d3358d52263e46e68c3319cfc4ff6a 100644 (file)
@@ -989,7 +989,7 @@ Class1Modem::recvPageECMData(TIFF* tif, const Class2Params& params, fxStr& emsg)
            }
            if (useV34 || gotRTNC) {            // V.34 mode or if +FRH:3 in adaptive reception
                if (!gotEOT) {
-                   bool gotprimary;
+                   bool gotprimary = false;
                    if (useV34) gotprimary = waitForDCEChannel(false);
                    while (!sendERR && !gotEOT && (gotRTNC || (ctrlFrameRcvd != fxStr::null))) {
                        /*
index a0d297988ffea0caf5303a4265a077495b7131a8..a742a6aa9b6954c5ab2f9123318d0e2f4ad68bcc 100644 (file)
@@ -343,11 +343,11 @@ Class2Modem::recvPPM(TIFF* tif, int& ppr)
 bool
 Class2Modem::parseFPTS(TIFF* tif, const char* cp, int& ppr)
 {
-    uint32 lc = 0;
+    u_long lc = 0;
     int blc = 0;
     int cblc = 0;
     ppr = 0;
-    if (sscanf(cp, "%d,%d,%d,%d", &ppr, &lc, &blc, &cblc) > 0) {
+    if (sscanf(cp, "%d,%ld,%d,%d", &ppr, &lc, &blc, &cblc) > 0) {
 
        /*
         * In practice we cannot trust the modem line count when we're 
index 71a518b43d4d5103bb8af3149f3c5cf1a6c021aa..3c1fec0c8bb00c57f907d3e98a418960c08f14c1 100644 (file)
@@ -229,7 +229,7 @@ FaxModem::recvPageDLEData(TIFF* tif, bool checkQuality,
                     * is done instead of replacing the missing data with white
                     * to avoid visual disconnect of blackened areas.
                     */
-                   if (decodedPixels < rowpixels) {
+                   if ((u_int) decodedPixels < rowpixels) {
                        u_int filledchars = (decodedPixels + 7) / 8;
                        u_short rembits = decodedPixels % 8;
                        memcpy(recvRow + filledchars, curGood + filledchars, rowSize - filledchars);
@@ -237,12 +237,12 @@ FaxModem::recvPageDLEData(TIFF* tif, bool checkQuality,
                            // now deal with the transitional character
                            u_char remmask = 0;
                            for (u_short bit = 0; bit < 8; bit++) {
-                               remmask<<1;
+                               remmask<<=1;
                                if (bit < rembits) remmask |= 1;
                            }
                            recvRow[filledchars-1] = (recvRow[filledchars-1] & remmask) | (curGood[filledchars-1] & ~remmask);
                        }
-                   } else if (decodedPixels >= rowpixels) {
+                   } else if ((u_int) decodedPixels >= rowpixels) {
                        /*
                         * If we get a long pixel count, then our correction mechanism
                         * involves trimming horizontal "streaks" at the end of the
index b9185208047c47203215bf210bcbda698537c79d..a9f5ce6927ea4df17ca809becc4b906d2a24747f 100644 (file)
@@ -344,7 +344,7 @@ FaxMachineInfo::writeConfig()
                Sys::close(fd);
                return;
            }
-           ftruncate(fd, cc);
+           (void) ftruncate(fd, cc);
            Sys::close(fd);
        } else
            error("open: %m");
index 9ae072cb566182ca9b4c27c3fbc9858700aaaaa0..12ab93f4f5592b211d354d47aa7b11b77e92a59a 100644 (file)
@@ -524,7 +524,7 @@ FaxRequest::writeQFile()
     }
     lseek(fd, 0L, SEEK_SET);
     Sys::write(fd, sb, sb.getLength());
-    ftruncate(fd, sb.getLength());
+    (void) ftruncate(fd, sb.getLength());
     // XXX maybe should fsync, but not especially portable
 }
 
index 4c8160ce511c58958364d29456f086eb1f0c6edf..252ee841ad1b59c2b0904e911976906dfb6d435b 100644 (file)
@@ -162,7 +162,7 @@ G3Encoder::find0span(const u_char* bp, int bs, int be)
                bp++;
        } else
                span = 0;
-       if (bits >= 2*8*sizeof (long)) {
+       if ((uint32) bits >= 2*8*sizeof (long)) {
                long* lp;
                /*
                 * Align to longword boundary and check longwords.
@@ -174,7 +174,7 @@ G3Encoder::find0span(const u_char* bp, int bs, int be)
                        bp++;
                }
                lp = (long*) bp;
-               while (bits >= 8*sizeof (long) && *lp == 0) {
+               while ((uint32) bits >= 8*sizeof (long) && *lp == 0) {
                        span += 8*sizeof (long), bits -= 8*sizeof (long);
                        lp++;
                }
@@ -221,7 +221,7 @@ G3Encoder::find1span(const u_char* bp, int bs, int be)
                bp++;
        } else
                span = 0;
-       if (bits >= 2*8*sizeof (long)) {
+       if ((uint32) bits >= 2*8*sizeof (long)) {
                long* lp;
                /*
                 * Align to longword boundary and check longwords.
@@ -233,7 +233,7 @@ G3Encoder::find1span(const u_char* bp, int bs, int be)
                        bp++;
                }
                lp = (long*) bp;
-               while (bits >= 8*sizeof (long) && *lp == ~0) {
+               while ((uint32) bits >= 8*sizeof (long) && *lp == ~0) {
                        span += 8*sizeof (long), bits -= 8*sizeof (long);
                        lp++;
                }
@@ -352,12 +352,12 @@ G3Encoder::encode(const void* vp, u_int w, u_int h, u_char* rp)
                span = findspan(&bp, bs, w, zeroruns);          // white span
                putspan(span, TIFFFaxWhiteCodes);
                bs += span;
-               if (bs >= w)
+               if ((u_int) bs >= w)
                    break;
                span = findspan(&bp, bs, w, oneruns);           // black span
                putspan(span, TIFFFaxBlackCodes);
                bs += span;
-               if (bs >= w)
+               if ((u_int) bs >= w)
                    break;
            }
        }
@@ -408,7 +408,7 @@ G3Encoder::putBits(u_int bits, u_int length)
     static const u_int mask[9] =
        { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
 
-    while (length > bit) {
+    while (length > (u_short) bit) {
        data |= bits >> (length - bit);
        length -= bit;
        flushBits();
index 7002a238a6cf78ebbf20abd0d99f64af5a4ccfcf..2f0f88cca040e127df10831e769fca5ae4c4fce0 100644 (file)
@@ -207,7 +207,7 @@ Getty::setupSession(int fd)
     struct stat sb;
     Sys::fstat(fd, sb);
 #if HAS_FCHOWN
-    fchown(fd, 0, sb.st_gid);
+    (void) fchown(fd, 0, sb.st_gid);
 #else
     Sys::chown(getLine(), 0, sb.st_gid);
 #endif
index e23a73ef1c4674cf36e386d540ad1df026dea5f2..002f96786e0e463b17092aebdd937fb156ef7e33 100644 (file)
@@ -82,8 +82,6 @@ JobControlInfo::~JobControlInfo() {}
 // XXX can't sort
 int JobControlInfo::compare(const JobControlInfo*) const { return (0); }
 
-static int getNumber(const char* s) { return ((int) strtol(s, NULL, 0)); }
-
 void
 JobControlInfo::configError (const char* fmt, ...)
 {
index 25785c4ec4bd9396975728ca75f6d44ca3506160..1e06af16718e3e8247261d910540c5e6888fefd4 100644 (file)
@@ -231,8 +231,6 @@ void MemoryDecoder::fixFirstEOL()
  */
 u_char* MemoryDecoder::cutExtraRTC()
 {
-    u_char* start = current();
-    
     /*
      * We expect RTC near the end of data and thus
      * do not check all image to save processing time.
@@ -340,7 +338,6 @@ u_char* MemoryDecoder::encodeTagLine(u_long* raster, u_int th, u_int slop)
     G3Encoder enc(result);
     enc.setupEncoder(fillorder, is2D, isG4);
 
-    u_char* start = current();
     decode(NULL, width, th);           // discard decoded data
     if (!isG4) {
        /*
@@ -540,5 +537,8 @@ u_char* MemoryDecoder::convertDataFormat(const Class2Params& params)
        printf("Attempt to convert Phase C data to JBIG without JBIG support.  This should not happen.\n");
        return (NULL);
 #endif /* HAVE_JBIG */
+    } else {
+       printf("Attempt to convert Phase C data to an unsupported format.  This should not happen.\n");
+       return (NULL);
     }
 }
index ce9cc2f29548f725088cf3034d777aa52489b2a9..4bfb4df8d3ac5bbed8f028948d89ad9b06e68c62 100644 (file)
@@ -225,6 +225,8 @@ ModemServer::changeState(ModemServerState s, long timeout)
        case MODEMWAIT:
            setupAttempts = 0;
            break;
+       default:
+           break;
        }
     } else if (s == MODEMWAIT && ++setupAttempts >= maxSetupAttempts) {
        traceStatus(FAXTRACE_SERVER,
@@ -430,7 +432,7 @@ ModemServer::setServerStatus(const char* fmt, ...)
     va_end(ap);
     fprintf(statusFile, "\n");
     fflush(statusFile);
-    ftruncate(fileno(statusFile), ftell(statusFile));
+    (void) ftruncate(fileno(statusFile), ftell(statusFile));
     flock(fileno(statusFile), LOCK_UN);
 }
 
index 806b3b5587526eb5ea912fd45ec6bd50978ec69c..aaf2a4db94200eae14f97a090afba43fe3a494d2 100644 (file)
@@ -159,7 +159,7 @@ FaxModem::imageTagLine(u_char* buf, u_int fillorder, const Class2Params& params,
      */
     u_int w = params.pageWidth();
     u_int h = (tagLineFont->fontHeight()*2)+MARGIN_TOP+MARGIN_BOT;     // max height - double VR_FINE
-    u_int th;                                                          // actual tagline height
+    u_int th = 0;                                                      // actual tagline height
     switch(params.vr) {
        case VR_NORMAL:
        case VR_200X100:
@@ -304,7 +304,7 @@ FaxModem::imageTagLine(u_char* buf, u_int fillorder, const Class2Params& params,
                u_int bpl = sizeof(u_long) * 8;         // bits per u_long
                for (u_int nl = lpr/2 - 1; nl ; nl--) {
                    // make 2 longs out of 1 (ABCD -> AABB CCDD)
-                   int pos;
+                   int pos = 0;
                    for (u_int i = 0; i < (bpl/8); i++) {
                        if (i == 0 || i == bpl/8/2) {
                            *l2 = (u_long) 0;
index 61b2017d79c49070d0ed8e6e2d623df24373d629..c94a5f410f1090654d9d388cdfc64c1dedc42c37 100644 (file)
@@ -178,7 +178,7 @@ UUCPLock::create()
        Sys::chmod(buff, mode);
 #endif
 #if HAS_FCHOWN
-       fchown(fd, UUCPuid, UUCPgid);
+       (void) fchown(fd, UUCPuid, UUCPgid);
 #else
        Sys::chown(buff, UUCPuid, UUCPgid);
 #endif
index 1a3edac672ed3415dcb97c8ad96d2214d21558a4..db16d63a24aabfe89d405cfdec63595aa37769d6 100644 (file)
@@ -58,7 +58,7 @@ fatal(const char* fmt ...)
 int
 main(int argc, char* argv[])
 {
-    extern int optind, opterr;
+    extern int optind;
     extern char* optarg;
     float minChop = 3.0;               // chop if >= 3" white space at bottom
     u_int minRows;
@@ -130,8 +130,8 @@ main(int argc, char* argv[])
                        printf(
                            "Chop %u rows, strip was %lu bytes, need only %lu\n"
                            , dec.getLastBlanks()
-                           , totbytes
-                           , dec.getEndOfPage() - data
+                           , (u_long) totbytes
+                           , (u_long) (dec.getEndOfPage() - data)
                        );
                    } else {
                        printf("Don't chop, found %u rows, need %u rows\n"
index d08e8866371d02b9007705faaeb84935bd3d7f4e..a3d19fb624285120f97848846967bbfc9f2ac868 100644 (file)
@@ -503,7 +503,7 @@ int
 main(int argc, char* argv[])
 {
     const char* outFile = "cq.tif";
-    extern int optind, opterr;
+    extern int optind;
     extern char* optarg;
     int c;
 
index 9021e8b46c35fbc75c651557c96a7b8cacd55901..f636b7734505a7d197bbae1ea97e6c114ea746a8 100644 (file)
@@ -238,7 +238,8 @@ faxGettyApp::listenForRing()
            /* DID modems may only signal a call with DID data - no RING */
            bool done = false;
            for (u_int i = 0; i < callid.size(); i++) {
-               if (idConfig[i].answerlength > 0 && callid[i].length() >= idConfig[i].answerlength) {
+               if ((u_int) idConfig[i].answerlength > 0 && 
+                   callid[i].length() >= (u_int) idConfig[i].answerlength) {
                    done = true;
                    break;
                }
index 1947260ab0f73a6dcfe5d46a235c06285c6e9f17..3f29ebea8c57a43c0118d5f5aeb0fa735975cca7 100644 (file)
@@ -372,7 +372,7 @@ faxQCleanApp::expungeCruft(void)
            // suffix, when the PS.jobid version of the file still
            // exists.
            char        *base;
-           int         sl=k-docDir.length()-1-1;       // removing docDir,'/' and trailing ';'
+           u_int         sl=k-docDir.length()-1-1;     // removing docDir,'/' and trailing ';'
            base=(char *)malloc(sl+1);
            strncpy(base, &file[docDir.length()+1], sl);
            base[sl]=0;
index a4a77f000ff3b64fae8a1e3e67b73b88a724264d..4824e96ffd75b3262c11fa04ba5805f37cb63f07 100644 (file)
@@ -946,7 +946,7 @@ faxQueueApp::preparePageChop(const FaxRequest& req,
        float threshold = req.chopthreshold;
        if (threshold == -1)
            threshold = pageChopThreshold;
-       u_int minRows;
+       u_int minRows = 0;
        switch(params.vr) {
            case VR_NORMAL:
            case VR_200X100:
@@ -1425,7 +1425,7 @@ faxQueueApp::sendJobDone(Job& job, int status)
     if (req && req->status == send_retry) {
        // prevent turnaround-redialing, delay any blocked jobs
        time_t newtts = req->tts;
-       while (cjob = di.nextBlocked()) {
+       while ((cjob = di.nextBlocked())) {
            FaxRequest* blockedreq = readRequest(*cjob);
            if (blockedreq) {
                delayJob(*cjob, *blockedreq, "Delayed by prior call", newtts);
index 01041d8db056c15659a840d4325a269ee2380bd2..0333457829df43a7bdc0701a0531b6136dde5bb3 100644 (file)
@@ -121,7 +121,7 @@ faxSendApp::send(const char** filenames, int num)
     u_int batched = BATCH_FIRST;
     FaxSendStatus status = send_done;
     fxStr batchcommid, notice;
-    time_t retrybatchtts;
+    time_t retrybatchtts = 0;
 
     for (int i = 0; i < num; i++)
     {
index ebbf82f5a1d53583fedbb96f0632a8a6b01a952e..48d5c3a181f41c69bf90539d402b9c7e33c42f70 100644 (file)
@@ -120,7 +120,7 @@ pageSendApp::send(const char** filenames, int num)
     u_int batched = BATCH_FIRST;
     FaxSendStatus status = send_done;
     fxStr batchcommid, notice;
-    time_t retrybatchtts;
+    time_t retrybatchtts = 0;
 
     for (int i = 0; i < num; i++) {
        if (i+1 == num)
@@ -1174,7 +1174,7 @@ pageSendApp::sendUcpMsg(FaxRequest& req, FaxItem& preq, const fxStr& msg, fxStr&
     u_int unknown = 0;                         // count of unknown responses
     time_t start = Sys::now();
     do {
-       u_int len = getResponse(resp, ixoXmitTimeout);
+       (void) getResponse(resp, ixoXmitTimeout);
        const fxStr str = (const char*)resp;
        //readUcpResponse(str);
        fxStr tmp;
index eb650abd0a92eb8a6ac07a3590b4ab56a169a1f8..12f1374a1732fff7815e3a8c5f2e954be1402ccb 100644 (file)
@@ -164,7 +164,7 @@ imageTagLine(u_char* buf, u_int fillorder, const Class2Params& params, u_long& t
      */
     u_int w = params.pageWidth();
     u_int h = (tagLineFont->fontHeight()*2)+MARGIN_TOP+MARGIN_BOT;     // max height - double VR_FINE
-    u_int th;                                                          // actual tagline height
+    u_int th = 0;                                                      // actual tagline height
     switch(params.vr) {
        case VR_NORMAL:
        case VR_200X100:
@@ -304,7 +304,7 @@ imageTagLine(u_char* buf, u_int fillorder, const Class2Params& params, u_long& t
                u_int bpl = sizeof(u_long) * 8;         // bits per u_long
                for (u_int nl = lpr/2 - 1; nl ; nl--) {
                    // make 2 longs out of 1 (ABCD -> AABB CCDD)
-                   int pos;
+                   int pos = 0;
                    for (u_int i = 0; i < (bpl/8); i++) {
                        if (i == 0 || i == bpl/8/2) {
                            *l2 = (u_long) 0;
@@ -401,7 +401,7 @@ fatal(const char* fmt ...)
 int
 main(int argc, char* argv[])
 {
-    extern int optind, opterr;
+    extern int optind;
     extern char* optarg;
     int c;
     const char* output = "t.tif";
index ece58eac78cc152383faf40b3eb9866dc245f4c6..f652fb67326398e106b0392fe5d34e515fa54512 100644 (file)
@@ -291,17 +291,17 @@ static const char* StateNames[] = {
 #define        CLEANUP_RUNS() do {                                             \
     if (RunLength)                                                     \
        SETVAL(0);                                                      \
-    if (a0 != lastx) {                                                 \
-       badlength(a0, lastx);                                           \
-       while (a0 > lastx && pa > thisrun)                              \
+    if ((tiff_runlen_t)a0 != lastx) {                                  \
+       badlength((tiff_runlen_t)a0, lastx);                            \
+       while ((tiff_runlen_t)a0 > lastx && pa > thisrun)               \
            a0 -= *--pa;                                                \
-       if (a0 < lastx) {                                               \
+       if ((tiff_runlen_t)a0 < lastx) {                                \
            if (a0 < 0)                                                 \
                a0 = 0;                                                 \
            if ((pa-thisrun)&1)                                         \
                SETVAL(0);                                              \
            SETVAL(lastx - a0);                                         \
-       } else if (a0 > lastx) {                                        \
+       } else if ((tiff_runlen_t)a0 > lastx) {                         \
            SETVAL(lastx);                                              \
            SETVAL(0);                                                  \
        }                                                               \
@@ -342,7 +342,7 @@ static const char* StateNames[] = {
            }                                                           \
        }                                                               \
     doneWhite1d:                                                       \
-       if (a0 >= lastx)                                                \
+       if ((tiff_runlen_t)a0 >= lastx)                                 \
            goto done1d;                                                \
        for (;;) {                                                      \
            LOOKUP16(13, TIFFFaxBlackTable, eof1d);                     \
@@ -364,7 +364,7 @@ static const char* StateNames[] = {
            }                                                           \
        }                                                               \
     doneBlack1d:                                                       \
-       if (a0 >= lastx)                                                \
+       if ((tiff_runlen_t)a0 >= lastx)                                 \
            goto done1d;                                                \
         if( *(pa-1) == 0 && *(pa-2) == 0 )                             \
             pa -= 2;                                                    \
@@ -382,7 +382,7 @@ done1d:                                                                     \
  * of runs for the reference line.
  */
 #define CHECK_b1 do {                                                  \
-    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {                        \
+    if (pa != thisrun) while (b1 <= a0 && (tiff_runlen_t)b1 < lastx) { \
        b1 += pb[0] + pb[1];                                            \
        pb += 2;                                                        \
     }                                                                  \
@@ -392,7 +392,7 @@ done1d:                                                                     \
  * Expand a row of 2D-encoded data.
  */
 #define EXPAND2D(eoflab) do {                                          \
-    while (a0 < lastx) {                                               \
+    while ((tiff_runlen_t)a0 < lastx) {                                        \
        LOOKUP8(7, TIFFFaxMainTable, eof2d);                            \
        switch (TabEnt->State) {                                        \
        case S_Pass:                                                    \
@@ -516,7 +516,7 @@ done1d:                                                                     \
        }                                                               \
     }                                                                  \
     if (RunLength) {                                                   \
-       if (RunLength + a0 < lastx) {                                   \
+       if ((tiff_runlen_t)(RunLength + a0) < lastx) {                  \
            /* expect a final V0 */                                     \
            NeedBits8(1,eof2d);                                         \
            if (!GetBits(1))                                            \
index 5ad96e6eee69156c1d2c600f9959c176d71eff6f..cbf599279febd43a48cca6a201cae86800bffcba 100644 (file)
@@ -140,8 +140,7 @@ int
 main(int argc, char* argv[])
 {
     bool verbose = true;
-    extern int optind, opterr;
-    extern char* optarg;
+    extern int optind;
     int c;
 
     appName = argv[0];