]> 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:49:46 +0000 (22:49 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 22:49:46 +0000 (22:49 +0000)
Aidan's third kill - a monster cleanup on, in his words, the "signed/unsigned
mess". Great work!

53 files changed:
faxd/Class1.h
faxd/Class1Recv.c++
faxd/Class1Send.c++
faxd/Class2.h
faxd/Class2Recv.c++
faxd/ClassModem.c++
faxd/ClassModem.h
faxd/FaxAcctInfo.c++
faxd/FaxMachineInfo.c++
faxd/FaxMachineInfo.h
faxd/FaxModem.h
faxd/FaxRecv.c++
faxd/FaxRequest.c++
faxd/FaxSend.c++
faxd/FaxServer.h
faxd/HylaClient.c++
faxd/Modem.c++
faxd/ModemServer.c++
faxd/NSF.c++
faxd/PCFFont.c++
faxd/faxApp.c++
faxd/faxQueueApp.c++
faxd/pageSendApp.c++
hfaxd/FIFO.c++
hfaxd/FileSystem.c++
hfaxd/FileTransfer.c++
hfaxd/HylaFAXServer.c++
hfaxd/OldProtocol.c++
hfaxd/Parser.c++
hfaxd/SNPPServer.c++
hfaxd/User.c++
sendfax/sendfax.c++
util/AtSyntax.c++
util/Class2Params.c++
util/Dictionary.c++
util/Dispatcher.c++
util/Dispatcher.h
util/FaxClient.c++
util/FaxClient.h
util/PageSize.h
util/SNPPClient.c++
util/SNPPJob.h
util/SendFaxJob.h
util/StackBuffer.h
util/Sys.h
util/TextFmt.c++
util/TextFmt.h
util/TypeRules.c++
util/TypeRules.h
util/Types.h
util/class2.h
util/faxinfo.c++
util/typetest.c++

index 800a6138b20b08fbdd06efa6af49b4da5a658db9..6d3306b035de9183702cc594acf849b656f8bc85 100644 (file)
@@ -165,7 +165,7 @@ public:
     u_int      modemXINFO() const;
     bool       setupReceive();
     bool       recvBegin(fxStr& emsg);
-    bool       recvPage(TIFF*, int& ppm, fxStr& emsg);
+    bool       recvPage(TIFF*, u_int& ppm, fxStr& emsg);
     bool       recvEnd(fxStr& emsg);
     void       recvAbort();
 
index a563c94c2f3906b093458a1f0edc3c740583388f..19ca8756e77f56c4adb0a168b6c37b0c489b18c8 100644 (file)
@@ -377,7 +377,7 @@ const u_int Class1Modem::modemPPMCodes[8] = {
  * sending a post-page response in a multi-page document.
  */
 bool
-Class1Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg)
+Class1Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg)
 {
     if (/* sendingHDLC */ lastPPM == FCF_MPS && prevPage && pageGood) {
        // sendingHDLC = false
@@ -698,7 +698,7 @@ Class1Modem::recvEnd(fxStr&)
                 */
                break;
            }
-       } while (Sys::now()-start < t1 &&
+       } while ((unsigned) Sys::now()-start < t1 &&
            (!frame.isOK() || frame.getFCF() == FCF_EOP));
     }
     setInputBuffering(true);
index 0341562d9d7f84d69c6c4b6ef731a59974726e42..1ada087123f3f8601bac458f9abc93f75e1a76e0 100644 (file)
@@ -160,7 +160,7 @@ Class1Modem::getPrologue(Class2Params& params, bool& hasDoc, fxStr& emsg)
        /*
         * Wait up to T1 for a valid DIS.
         */
-       if (Sys::now()-start >= t1)
+       if ((unsigned) Sys::now()-start >= t1)
            break;
        framerecvd = recvFrame(frame, conf.t2Timer);
     }
index 1c4b9cbe3de215f65163e805d8d0806357767c87..05d76011c090f028e68b43b7462f65498e1360ce 100644 (file)
@@ -145,7 +145,7 @@ public:
 // receive support
     bool       setupReceive();
     bool       recvBegin(fxStr& emsg);
-    bool       recvPage(TIFF*, int& ppm, fxStr& emsg);
+    bool       recvPage(TIFF*, u_int& ppm, fxStr& emsg);
     bool       recvEnd(fxStr& emsg);
     void       recvAbort();
 
index 206e89dde154d582ad5f4c52a051aa841ba2ca19..c643594ae24fea024c7f18536ae5893ca8cd44f8 100644 (file)
@@ -126,7 +126,7 @@ Class2Modem::recvDCS(const char* cp)
  * received post-page-message.
  */
 bool
-Class2Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg)
+Class2Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg)
 {
     int ppr;
 
index ed1ee82e2375269983674bb2e09a8da1b9c5fa26..f51f4664788795016b819a3d88cb220aef3a00ee 100644 (file)
@@ -248,7 +248,7 @@ again:
            emsg = callStatus[cs];
            return (CALLTYPE_ERROR);
        }
-    } while (Sys::now()-start < conf.answerResponseTimeout);
+    } while ((unsigned) Sys::now()-start < conf.answerResponseTimeout);
     emsg = "Ring detected without successful handshake";
     return (CALLTYPE_ERROR);
 }
@@ -585,7 +585,7 @@ ClassModem::trimModemLine(char buf[], int& cc)
        buf[cc] = '\0';
     }
     if (cc > 0) {
-       u_int i = 0;
+       int i = 0;
        // leading white space
        while (i < cc && isspace(buf[i]))
            i++;
index 089d1bb3a776575c385226b3b850cc40a7c635f7..b224713d21196c83c537f99c5070345d20bcc364 100644 (file)
@@ -38,14 +38,14 @@ class Class2Params;
 
 // NB: these would be enums in the ClassModem class
 //     if there were a portable way to refer to them!
-typedef unsigned int CallStatus;       // return status from dialing op
-typedef        unsigned int CallType;          // type detected for incoming call
-typedef        unsigned int AnswerType;        // type of call to answer for
-typedef unsigned int SpeakerVolume;
-typedef        unsigned int ATResponse;        // response code from AT command
-typedef        unsigned int BaudRate;          // serial line communication rate
-typedef        unsigned int FlowControl;       // serial line flow control scheme
-typedef        unsigned int SetAction;         // how to act when setting line
+typedef u_int CallStatus;      // return status from dialing op
+typedef        u_int CallType;         // type detected for incoming call
+typedef        u_int AnswerType;       // type of call to answer for
+typedef u_int SpeakerVolume;
+typedef        u_int ATResponse;       // response code from AT command
+typedef        u_int BaudRate;         // serial line communication rate
+typedef        u_int FlowControl;      // serial line flow control scheme
+typedef        u_int SetAction;                // how to act when setting line
 typedef struct {
     const char*        msg;            // string to match
     u_short    len;            // string length
index 452be14cd2428b7fde23b3c518f881c170cbf4c1..aa8739d04073748a3e6eb140d4e0276e489c8025 100644 (file)
@@ -72,7 +72,7 @@ FaxAcctInfo::record(const char* cmd) const
        record.fput("\t\"%s\"", status);        // $14 = status
        record.put('\n');
        flock(fd, LOCK_EX);
-       ok = (Sys::write(fd, record, record.getLength()) == record.getLength());
+       ok = (Sys::write(fd, record, record.getLength()) == (ssize_t)record.getLength());
        Sys::close(fd);                         // implicit unlock
     }
     return (ok);
index b282685113018eec5a90529cecea7b1de10c49c3..9bc6ea1ca51d0295ee98484607d1be5e5eed533f 100644 (file)
@@ -71,10 +71,10 @@ FaxMachineInfo::FaxMachineInfo(const FaxMachineInfo& other)
 }
 FaxMachineInfo::~FaxMachineInfo() { writeConfig(); }
 
-int
+u_short
 FaxMachineInfo::getMaxPageWidthInMM() const
 {
-    return (int)(maxPageWidth/(204.0f/25.4f));
+    return (u_short)(maxPageWidth/(204.0f/25.4f));
 }
 
 #include <ctype.h>
@@ -103,7 +103,7 @@ FaxMachineInfo::resetConfig()
     supportsPostScript = false;                // no support for Adobe protocol
     calledBefore = false;              // never called before
     maxPageWidth = 2432;               // max required width
-    maxPageLength = -1;                        // infinite page length
+    maxPageLength = (u_short) -1;      // infinite page length
     maxSignallingRate = BR_14400;      // T.17 14.4KB
     minScanlineTime = ST_0MS;          // 0ms/0ms
     sendFailures = 0;
@@ -292,7 +292,7 @@ FaxMachineInfo::writeConfig()
            fxStackBuffer buf;
            writeConfig(buf);
            u_int cc = buf.getLength();
-           if (Sys::write(fd, buf, cc) != cc) {
+           if (Sys::write(fd, buf, cc) != (ssize_t)cc) {
                error("write error: %s", strerror(errno));
                Sys::close(fd);
                return;
index 179e291e74837e4f68c4ce3ed6758837d967d111..6c81499687c7ed72ccfce4dfade0ae4820511e6b 100644 (file)
@@ -53,10 +53,10 @@ private:
     bool       supports2DEncoding;     // handles Group 3 2D
     bool       supportsPostScript;     // handles Adobe NSF protocol
     bool       calledBefore;           // successfully called before
-    int                maxPageWidth;           // max capable page width
-    int                maxPageLength;          // max capable page length
-    int                maxSignallingRate;      // max capable signalling rate
-    int                minScanlineTime;        // min scanline time capable
+    u_short            maxPageWidth;           // max capable page width
+    u_short            maxPageLength;          // max capable page length
+    u_short            maxSignallingRate;      // max capable signalling rate
+    u_short            minScanlineTime;        // min scanline time capable
     fxStr      csi;                    // last received CSI
     int                sendFailures;           // count of failed send attempts
     int                dialFailures;           // count of failed dial attempts
@@ -91,11 +91,11 @@ public:
     bool getSupports2DEncoding() const;
     bool getSupportsPostScript() const;
     bool getCalledBefore() const;
-    int getMaxPageWidthInPixels() const;
-    int getMaxPageWidthInMM() const;
-    int getMaxPageLengthInMM() const;
-    int getMaxSignallingRate() const;
-    int getMinScanlineTime() const;
+    u_short getMaxPageWidthInPixels() const;
+    u_short getMaxPageWidthInMM() const;
+    u_short getMaxPageLengthInMM() const;
+    u_short getMaxSignallingRate() const;
+    u_short getMinScanlineTime() const;
     const fxStr& getCSI() const;
 
     int getSendFailures() const;
@@ -134,13 +134,13 @@ inline bool FaxMachineInfo::getSupportsPostScript() const
     { return supportsPostScript; }
 inline bool FaxMachineInfo::getCalledBefore() const    
     { return calledBefore; }
-inline int FaxMachineInfo::getMaxPageWidthInPixels() const
+inline u_short FaxMachineInfo::getMaxPageWidthInPixels() const
     { return maxPageWidth; }
-inline int FaxMachineInfo::getMaxPageLengthInMM() const
+inline u_short FaxMachineInfo::getMaxPageLengthInMM() const
     { return maxPageLength; }
-inline int FaxMachineInfo::getMaxSignallingRate() const
+inline u_short FaxMachineInfo::getMaxSignallingRate() const
     { return maxSignallingRate; }
-inline int FaxMachineInfo::getMinScanlineTime() const
+inline u_short FaxMachineInfo::getMinScanlineTime() const
     { return minScanlineTime; }
 inline const fxStr& FaxMachineInfo::getCSI() const
     { return csi; }
index b258a101c4522f934124cde54ce3bb02bd4d605a..bec64611dbcded4bdbecfbb06587723a0334b8c5 100644 (file)
@@ -248,7 +248,7 @@ public:
      */
     virtual bool setupReceive() = 0;
     virtual bool recvBegin(fxStr& emsg);
-    virtual bool recvPage(TIFF*, int& ppm, fxStr& em) = 0;
+    virtual bool recvPage(TIFF*, u_int& ppm, fxStr& em) = 0;
     virtual bool recvEnd(fxStr& emsg) = 0;
     virtual void recvAbort() = 0;
     // query interfaces for optional state
index 765ccd20664ccc1a7845fdece953d3968c6e2895..996f985c2ed649c383a3f123eab1c68db8af9569 100644 (file)
@@ -190,7 +190,7 @@ bool
 FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, fxStr& emsg)
 {
     bool recvOK;
-    int ppm;
+    u_int ppm;
     pageStart = Sys::now();
     for (;;) {
        modem->getRecvSUB(info.subaddr);                // optional subaddress
@@ -244,7 +244,7 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f
  * Receive Phase B protocol processing.
  */
 bool
-FaxServer::recvFaxPhaseD(TIFF* tif, FaxRecvInfo& info, int& ppm, fxStr& emsg)
+FaxServer::recvFaxPhaseD(TIFF* tif, FaxRecvInfo& info, u_int& ppm, fxStr& emsg)
 {
     ppm = PPM_EOP;
     do {
index 3c5ecaf9fa3843deaec85990a50cdb3b73f541f7..caeae5fd0d3c0a6d2f55e7ba953a92ff0d0bdfd9 100644 (file)
@@ -191,7 +191,7 @@ FaxRequest::readQFile(bool& rejectJob)
     char stackbuf[2048];
     char* buf = stackbuf;
     char* bp = buf;
-    if (sb.st_size > sizeof (buf)-1)           // extra byte for terminating \0
+    if (sb.st_size > (off_t)sizeof(buf)-1)     // extra byte for terminating \0
        bp = buf = new char[sb.st_size+1];
     if (Sys::read(fd, bp, (u_int) sb.st_size) != sb.st_size) {
        error("Read error: %s", strerror(errno));
index a1ff7e76d16b7a502c46af644832ccda0535a4f0..c3783bc81107a7143f25113311c77678c3a773d8 100644 (file)
@@ -538,7 +538,7 @@ FaxServer::sendSetupParams1(TIFF* tif,
     }
     uint32 w;
     (void) TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
-    if (w > clientInfo.getMaxPageWidthInPixels()) {
+    if (w > (uint32)clientInfo.getMaxPageWidthInPixels()) {
        emsg = fxStr::format("Client does not support document page width"
                ", max remote page width %u pixels, image width %lu pixels",
                clientInfo.getMaxPageWidthInPixels(), w);
@@ -608,7 +608,7 @@ FaxServer::sendSetupParams1(TIFF* tif,
      * to take into account sloppy coding practice (e.g.
      * using 200 dpi for high-res facsimile.
      */
-    if (clientInfo.getMaxPageLengthInMM() != -1) {
+    if (clientInfo.getMaxPageLengthInMM() != (u_short)-1) {
        u_long h = 0;
        (void) TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
        float len = h / yres;                   // page length in mm
index cf812b47235f45cb5f0c60a8924ee05e6b871efa..0d3fb3b78ed0c977387ff00843ad7c880f7c2ce5 100644 (file)
@@ -76,7 +76,7 @@ private:
     TIFF*      setupForRecv(FaxRecvInfo&, FaxRecvInfoArray&, fxStr& emsg);
     bool       recvDocuments(TIFF*, FaxRecvInfo&, FaxRecvInfoArray&,
                    fxStr& emsg);
-    bool       recvFaxPhaseD(TIFF* tif, FaxRecvInfo&, int& ppm, fxStr& emsg);
+    bool       recvFaxPhaseD(TIFF* tif, FaxRecvInfo&, u_int& ppm, fxStr& emsg);
     bool       pollFaxPhaseB(const fxStr& sep, const fxStr& pwd,
                    FaxRecvInfoArray&, fxStr& emsg);
 protected:
index 33542f68c6d6833a11303c9c40435f9d3d9468c7..0f16d507ea2e35fb6ffd4196b95b720604dca98b 100644 (file)
@@ -124,7 +124,7 @@ again:
            schedReap();
            return (false);
        }
-       if (n != msgLen)
+       if ((unsigned) n != msgLen)
            logError(
                "HylaClient::send: %s: write failed (return %d, seq# %u, %m)",
                (const char*) fifoName, seqnum, n);
index e1f3bd8485cf2cf9e2ce25c526a797977a690f81..69516be3bb77ffb35762f5bdcfd27513f2c3a57c 100644 (file)
@@ -445,7 +445,7 @@ again:
     }
     if (!cacheFd)
        Sys::close(fd), fd = -1;
-    return (n == msgLen);
+    return ((unsigned)n == msgLen);
 }
 
 #include "StackBuffer.h"
index fc76740edeac645e6f4452566d7a349a7370bea5..2b4ee5ce45b21b477fb7b2ffea6ac49250191d9f 100644 (file)
@@ -1386,7 +1386,7 @@ int
 ModemServer::getModemLine(char rbuf[], u_int bufSize, long ms)
 {
     int c;
-    int cc = 0;
+    u_int cc = 0;
     if (ms) startTimeout(ms);
     do {
        while ((c = getModemChar(0)) != EOF && c != '\n')
index a0762e185c447ebd975591fd1395bb1d38623038..51e0bb5a96a54ddaf8a28b8babf57cc2629b123c 100644 (file)
@@ -39,16 +39,15 @@ struct ModelData
 
 struct NSFData {
     const char* vendorId;
-    static
-    const int   vendorIdSize; // Country & provider code (T.35)
+    static const u_int   vendorIdSize; // Country & provider code (T.35)
     const char* vendorName;
     bool        inverseStationIdOrder;
-    int         modelIdPos;
-    int         modelIdSize;
+    u_int         modelIdPos;
+    u_int         modelIdSize;
     const ModelData* knownModels;
 };
 
-const int NSFData::vendorIdSize = 3; // Country & provider code (T.35)
+const u_int NSFData::vendorIdSize = 3; // Country & provider code (T.35)
 
 static const ModelData Canon[] =
 {{"\x80\x00\x80\x48\x00", "Faxphone B640"},
index f83297a75ed99f1a2472e8eeca3b9d7924f2aee0..efabea3b931ab55aa868b7e70b91f3b39a5eb97d 100644 (file)
@@ -150,7 +150,7 @@ PCFFont::read(const char* name)
            error("No space for font metric information");
            return (false);
        }
-       for (int i = 0; i < numGlyphs; i++) {
+       for (u_int i = 0; i < numGlyphs; i++) {
            if (isFormat(PCF_DEFAULT_FORMAT))
                getMetric(metrics[i]);
            else
@@ -173,8 +173,7 @@ PCFFont::read(const char* name)
            error("No space for bitmap offsets array");
            return (false);
        }
-       int i;
-       for (i = 0; i < nbitmaps; i++)
+       for (u_int i = 0; i < nbitmaps; i++)
            offsets[i] = getINT32();
        u_long bitmapSizes[4];
        bitmapSizes[0] = getINT32();
@@ -219,7 +218,7 @@ PCFFont::read(const char* name)
                return (false);
            }
            int newoff = 0;
-           for (i = 0; i < nbitmaps; i++) {
+           for (u_int i = 0; i < nbitmaps; i++) {
                off_t old = offsets[i];
                offsets[i] = newoff;
                const charInfo& metric = metrics[i];
@@ -231,7 +230,7 @@ PCFFont::read(const char* name)
            delete bitmaps;
            bitmaps = padbitmaps;
        }
-       for (i = 0; i < nbitmaps; i++) {
+       for (u_int i = 0; i < nbitmaps; i++) {
            metrics[i].bits = bitmaps + offsets[i];
            if ((unsigned long) metrics[i].bits & 1) {
                error("Internal error, bitmap data not word-aligned");
@@ -263,7 +262,7 @@ PCFFont::read(const char* name)
            error("No space for character encoding vector");
            return (false);
        }
-       for (int i = 0; i < nencoding; i++) {
+       for (u_int i = 0; i < nencoding; i++) {
            int encodingOffset = getINT16();
            encoding[i] = (encodingOffset == 0xffff) ?
                0 : metrics + encodingOffset;
@@ -380,7 +379,7 @@ PCFFont::getCompressedMetric(charInfo& metric)
 bool
 PCFFont::seekToTable(u_long type)
 {
-    for (int i = 0; i < tocSize; i++)
+    for (u_int i = 0; i < tocSize; i++)
        if (toc[i].type == type) {
            if (fseek(file, toc[i].offset, SEEK_SET) == -1) {
                error("Can not seek; fseek failed");
@@ -410,7 +409,7 @@ PCFFont::readTOC()
        error("Cannot read TOC; no space for %lu records", tocSize);
        return (false);
     }
-    for (int i = 0; i < tocSize; i++) {
+    for (u_int i = 0; i < tocSize; i++) {
        toc[i].type = getLSB32();
        toc[i].format = getLSB32();
        toc[i].size = getLSB32();
@@ -498,9 +497,9 @@ PCFFont::imageText(const char* text,
 {
     if (!ready)
        return (0);
-    int rowwords = howmany(w,16);
-    int y = tm + fontAscent;
-    int x = lm;
+    u_int rowwords = howmany(w,16);
+    u_int y = tm + fontAscent;
+    u_int x = lm;
     /*
      * The rasterize assumes words have a big-endian
      * byte order.  For now (rather than fix it) we
index d280504aeb0d63712ec66d24a59c597b9e17302f..016e1993fd81f673cb489807f44f5556d2035f6a 100644 (file)
@@ -232,7 +232,7 @@ faxApp::vsendQueuer(const char* fmt, va_list ap)
     }
     fxStr msg = fxStr::vformat(fmt, ap);
     u_int len = msg.length() + 1;
-    if (Sys::write(faxqfifo, (const char*)msg, len) != len) {
+    if (Sys::write(faxqfifo, (const char*)msg, len) != (ssize_t)len) {
        if (errno == EBADF || errno == EPIPE)           // reader expired
            Sys::close(faxqfifo), faxqfifo = -1;
        else
index 2cc8f301c8999c7634adbcef9503362d57f5e38f..9c3d8658bad63405e05a300c92ffa1a550d35e29 100644 (file)
@@ -607,7 +607,7 @@ faxQueueApp::preparePageHandling(FaxRequest& req,
      * accepting variable-length pages.
      */
     u_int pagechop;
-    if (info.getMaxPageLengthInMM() == -1) {
+    if (info.getMaxPageLengthInMM() == (unsigned)-1) {
        pagechop = req.pagechop;
        if (pagechop == FaxRequest::chop_default)
            pagechop = pageChop;
@@ -759,7 +759,7 @@ faxQueueApp::setupParams(TIFF* tif, Class2Params& params, const FaxMachineInfo&
      * vertical resolution.  Note that if the resolution
      * info is bogus, we may select the wrong page size.
      */
-    if (info.getMaxPageLengthInMM() != -1) {
+    if (info.getMaxPageLengthInMM() != (unsigned)-1) {
        uint32 h;
        TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
        params.setPageLengthInMM((u_int)(h / yres));
@@ -2741,12 +2741,12 @@ faxQueueApp::configTrace(const char* fmt, ...)
 static void
 crackArgv(fxStr& s)
 {
-    int i = 0;
+    u_int i = 0;
     do {
         while (i < s.length() && !isspace(s[i])) i++;
         if (i < s.length()) {
             s[i++] = '\0';
-            int j = i;
+            u_int j = i;
             while (j < s.length() && isspace(s[j])) j++;
             if (j > i) {
                 s.remove(i, j - i);
index 38b27ff278029cbe171c8386b49148136cd3f1bc..865bf1d95419efcb5081c88c774d34b70eebb8c7 100644 (file)
@@ -476,7 +476,7 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em
                buf.getLength(), (const char*) buf);
        } else
            traceResponse(buf);
-    } while (!gotID && Sys::now() - start < ixoIDTimeout);
+    } while (!gotID && (unsigned) Sys::now() - start < ixoIDTimeout);
     if (!gotID) {
        emsg = "No initial ID response from paging central";
        req.status = send_retry;
@@ -563,7 +563,7 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em
            if (!scanForCode(cp, len))
                traceResponse(buf);
        }
-    } while (Sys::now()-start < ixoLoginTimeout && --unknown);
+    } while ((unsigned)Sys::now()-start < ixoLoginTimeout && --unknown != 0);
     emsg = fxStr::format("Protocol failure: %s from paging central",
        (unknown ?
            "timeout waiting for response" : "too many unknown responses"));
@@ -588,7 +588,7 @@ pageSendApp::pageGoAhead(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg)
            (void) scanForCode(cp, len);
        }
        traceResponse(buf);
-    } while (Sys::now()-start < ixoGATimeout && --unknown);
+    } while ((unsigned) Sys::now()-start < ixoGATimeout && --unknown != 0);
     emsg = fxStr::format("Protocol failure: %s waiting for go-ahead message",
        unknown ? "timeout" : "too many unknown responses");
     req.status = send_retry;
@@ -710,7 +710,7 @@ pageSendApp::sendPagerMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, f
            if (!scanForCode(cp, len))
                traceResponse(resp);
        }
-    } while (Sys::now()-start < ixoXmitTimeout && unknown < ixoMaxUnknown);
+    } while ((unsigned)Sys::now()-start < ixoXmitTimeout && unknown < ixoMaxUnknown);
     emsg = fxStr::format("Protocol failure: %s to message block transmit",
        (unknown ?
            "timeout waiting for response" : "too many unknown responses"));
@@ -746,7 +746,7 @@ pageSendApp::pageEpilogue(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg)
        }
        traceResponse(buf);
        // NB: ignore unknown responses
-    } while (Sys::now() - start < ixoAckTimeout);
+    } while ((unsigned)Sys::now() - start < ixoAckTimeout);
     req.status = send_retry;
     emsg = "Protocol failure: timeout waiting for transaction ACK/NAK "
        "from paging central";
@@ -1129,7 +1129,7 @@ pageSendApp::sendUcpMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, fxS
                }
            }
        }
-    } while (Sys::now()-start < ixoXmitTimeout && unknown < ixoMaxUnknown);
+    } while ((unsigned)Sys::now()-start < ixoXmitTimeout && unknown < ixoMaxUnknown);
     return false;
 }
 
index 4e9090b795cc44050bf443e7ef6bdf5d0dc65309..dd23b48fe47c7f252e3baa9cf244f4badf21f5b0 100644 (file)
@@ -172,7 +172,7 @@ again:
        if (fcntl(faxqFd, F_SETFL, fcntl(faxqFd, F_GETFL, 0) &~ O_NDELAY) < 0)
            logError("fcntl: %m");
     }
-    u_int len = msg.length()+1;
+    ssize_t len = msg.length()+1;
     if (Sys::write(faxqFd, msg, len) != len) {
        if (errno == EBADF || errno == EPIPE) {
            /*
@@ -285,7 +285,7 @@ HylaFAXServer::sendModem(const char* modem, fxStr& emsg, const char* fmt ...)
     va_start(ap, fmt);
     fxStr msg = fxStr::vformat(fmt, ap);
     va_end(ap);
-    u_int len = msg.length()+1;
+    ssize_t len = msg.length()+1;
     if (Sys::write(fd, msg, len) != len) {
        emsg = fxStr::format("write to %s failed: %s",
            (const char*) fifoName, strerror(errno));
index 10d0b2548b9f9b1a1cd0fb3f577e7e3b282e7c9b..ffa1d54d7e3d6995558226785c9e30af7691cedf 100644 (file)
@@ -756,14 +756,14 @@ HylaFAXServer::docType(const char* docname, FaxSendOp& op)
                char buf[512];
                TIFFHeader h;
            } b;
-           int cc = Sys::read(fd, (char*) &b, sizeof (b));
+           ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
            if (cc > 2 && b.buf[0] == '%' && b.buf[1] == '!')
                op = FaxRequest::send_postscript;
            else if (cc > 2 && b.buf[0] == '%' && b.buf[1] == 'P') {
                logError("What we have here is a PDF file");
                op = FaxRequest::send_pdf;
            }
-           else if (cc > sizeof (b.h) && isTIFF(b.h))
+           else if (cc > (ssize_t)sizeof (b.h) && isTIFF(b.h))
                op = FaxRequest::send_tiff;
            else
                op = FaxRequest::send_data;
index 5bf0e39288c95299c0999e3478ade4bca5cf7375..5f0d0184f790cff59b8732d45c0d7f219a28f8ec 100644 (file)
@@ -241,8 +241,8 @@ HylaFAXServer::openTIFF(const char* name)
                char buf[512];
                TIFFHeader h;
            } b;
-           int cc = Sys::read(fd, (char*) &b, sizeof (b));
-           if (cc > sizeof (b.h) && b.h.tiff_version == TIFF_VERSION &&
+           ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
+           if (cc > (ssize_t)sizeof (b.h) && b.h.tiff_version == TIFF_VERSION &&
              (b.h.tiff_magic == TIFF_BIGENDIAN ||
               b.h.tiff_magic == TIFF_LITTLEENDIAN)) {
                (void) lseek(fd, 0L, SEEK_SET);         // rewind
@@ -420,7 +420,7 @@ HylaFAXServer::sendITIFFData(TIFF* tif, int fdout)
     uint32* sb;
     (void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
     tdata_t buf = _TIFFmalloc(sb[0]);
-    uint32 bsize = sb[0];
+    tsize_t bsize = sb[0];
     for (tstrip_t s = 0, ns = TIFFNumberOfStrips(tif); s < ns; s++) {
        tsize_t cc = sb[s];
        if (cc > bsize) {
@@ -827,7 +827,7 @@ HylaFAXServer::recvZData(int fdin, int fdout)
            int cc = read(fdin, buf, sizeof (buf));
            if (cc == 0) {
                size_t occ = sizeof (obuf) - zstream.avail_out;
-               if (occ > 0 && write(fdout, obuf, occ) != occ) {
+               if (occ > 0 && write(fdout, obuf, occ) != (ssize_t)occ) {
                    perror_reply(452, "Error writing output file", errno);
                    break;
                }
@@ -850,7 +850,7 @@ HylaFAXServer::recvZData(int fdin, int fdout)
                    goto bad;
                }
                size_t occ = sizeof (obuf) - zstream.avail_out;
-               if (write(fdout, obuf, occ) != occ) {
+               if (write(fdout, obuf, occ) != (ssize_t)occ) {
                    perror_reply(452, "Error writing output file", errno);
                    goto bad;
                }
index 28cb551a137184c0c2e5448af69fa8281348e13a..c55b8d5f73c2eb5f2e4ea01a4eb19289e27083e6 100644 (file)
@@ -566,7 +566,7 @@ u_int HylaFAXServer::getDocumentNumbers(u_int count, fxStr& emsg)
 void
 HylaFAXServer::sanitize(fxStr& s)
 {
-    for (int i = 0; i < s.length(); i++)
+    for (u_int i = 0; i < s.length(); i++)
        if (!isascii(s[i]) || !isprint(s[i]))
            s[i] = '?';
 }
index db5c62ba62b5d50781951fe22e27ac2b75a15c28..542565b2949bec7712853b66e9aef2100b747cd7 100644 (file)
@@ -284,7 +284,7 @@ OldProtocolServer::doProtocol(void)
                ;
            modem = tag;
        } else {
-           int i;
+           u_int i;
            for (i = 0; i < NCMDS && !isCmd(cmds[i].cmd); i++)
                ;
            if (i == NCMDS)
@@ -1116,7 +1116,7 @@ OldProtocolServer::decodeLZW(FILE* fin, FILE* fout)
             * value to output (written in reverse).
             */
            char buf[1024];
-           int len = codep->length;
+           u_int len = codep->length;
            char* tp = (len > sizeof (buf) ? (char*) malloc(len) : buf) + len;
            do {
                *--tp = codep->value;
index 39cc64f657f686f1b06e7dca5203293b52666521..c8e0b5eb12bc0827d0847b94c49ef6e146e606fd 100644 (file)
@@ -711,7 +711,7 @@ HylaFAXServer::cmd(Token t)
            return (true);
        } else if (number_param(n)) {
            logcmd(t, "%lu", n);
-           if (n > maxIdleTimeout && !IS(PRIVILEGED)) {
+           if ((unsigned)n > maxIdleTimeout && !IS(PRIVILEGED)) {
                idleTimeout = maxIdleTimeout;
                reply(213, "%lu: Idle timeout too large, set to %u.",
                    n, maxIdleTimeout);
@@ -1485,7 +1485,7 @@ again:
 void
 HylaFAXServer::pushCmdData(const char* data, int n)
 {
-    if (recvNext + n > sizeof (recvBuf)) {
+    if ((unsigned) recvNext + n > sizeof (recvBuf)) {
        logError("No space to push back urgent data \"%.*s\"", n, data);
        return;
     }
index 2181a8bb16f8b063f805132bd3d50f59fbbdde20..7e48db18b513a26bc8e50f172a6a64227951f526 100644 (file)
@@ -703,7 +703,7 @@ SNPPServer::site_cmd(Token t)
            return (true);
        } else if (number_param(n)) {
            logcmd(t, "%lu", n);
-           if (n > maxIdleTimeout && !IS(PRIVILEGED)) {
+           if ((unsigned)n > maxIdleTimeout && !IS(PRIVILEGED)) {
                idleTimeout = maxIdleTimeout;
                reply(250, "%lu: Idle timeout too large, set to %u.",
                    n, maxIdleTimeout);
index 6779e25446a1d02f78b72e64c47fd8003d637232..e7eb29d98e444f2d450abd01118a449fb72dac35 100644 (file)
@@ -382,7 +382,7 @@ HylaFAXServer::addUser(FILE* db, const char* user, u_int uid, const char* upass,
        line = fxStr::format("%s:%u:%s\n", user, uid, upass);
     else
        line = fxStr::format("%s:%u\n", user, uid);
-    if (Sys::write(fd, line, line.length()) != line.length()) {
+    if (Sys::write(fd, line, line.length()) != (ssize_t)line.length()) {
        perror_reply(550, "Write error", errno);
        Sys::close(fd);
        (void) Sys::unlink(tfile);
index f67d94a9766f29132df91024670a1de50b2046dd..dd0b346896232190884bd483b26784caf3ab2526 100644 (file)
@@ -23,6 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  * OF THIS SOFTWARE.
  */
+#include "config.h"            //for BR_14400 definition
 #include "class2.h"            //for BR_14400 definition
 #include "SendFaxClient.h"
 #include "FaxDB.h"
index dfe8580f2a740d838ce39a545c48d31baf67a1fd..972d1f133b48a98c183578a9a869bc9c0e01dd0a 100644 (file)
@@ -289,19 +289,19 @@ again:
 /*
  * The number of days in each month of the year.
  */
-static const u_int nonLeapYear[12] =
+static const int nonLeapYear[12] =
     { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-static const u_int leapYear[12] =
+static const int leapYear[12] =
     { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-static const u_int* daysInMonth[2] = { nonLeapYear, leapYear };
+static const int* daysInMonth[2] = { nonLeapYear, leapYear };
 
 static void
 adjustYDay(struct tm& t)
 {
     // adjust year day according to month
-    const u_int* days = daysInMonth[isLeapYear(t)];
+    const int* days = daysInMonth[isLeapYear(t)];
     t.tm_yday = t.tm_mday;
-    for (u_int i = 0; i < t.tm_mon; i++)
+    for (int i = 0; i < t.tm_mon; i++)
        t.tm_yday += days[i];
 }
 
@@ -348,7 +348,7 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e
            adjustYDay(at);
        }
     }
-    const u_int* days = daysInMonth[isLeapYear(at)];
+    const int* days = daysInMonth[isLeapYear(at)];
     if (at.tm_mday > days[at.tm_mon]) {
        _atError(emsg, "Invalid day of month, %s has only %u days",
            months[at.tm_mon], days[at.tm_mon]);
@@ -426,7 +426,7 @@ fixup(struct tm& at)
      * Now recalculate derivative values
      * to insure everything is consistent.
      */
-    const u_int* days = daysInMonth[leap];
+    const int* days = daysInMonth[leap];
     at.tm_mday = at.tm_yday;
     for (at.tm_mon = 0; at.tm_mday >= days[at.tm_mon]; at.tm_mon++)
        at.tm_mday -= days[at.tm_mon];
index 78226fa094fcc287c925af989f8675aa5efbe5c0..66ea500fe829d68e9ddb2a1795086cc75f6f1fcd 100644 (file)
@@ -23,6 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  * OF THIS SOFTWARE.
  */
+#include "config.h"
 #include "Class2Params.h"
 #include "Sys.h"
 #include "t.30.h"
index dcadee81d7fba229ab7dd02d4ca3bf90930b436a..6d59a68e2fabe3eb100b95776693141eac3dc90d 100644 (file)
@@ -47,7 +47,7 @@ fxDictionary::fxDictionary(u_int ksize, u_int vsize,u_int initsize)
 
 fxDictionary::fxDictionary(const fxDictionary& a)
 {
-    for (int i = 0; i < a.buckets.length(); i++) {
+    for (u_int i = 0; i < a.buckets.length(); i++) {
        const fxDictBucket* sb = a.buckets[i];
        while (sb) {
            addInternal(KEY(sb),VALUE(sb));
@@ -95,7 +95,7 @@ fxDictionary::operator=(const fxDictionary &a)
     assert(valuesize == a.getValueSize());
     if (this == &a) return;
     this->fxDictionary::~fxDictionary();       // NB: need this for HP C++ 3.4
-    for (int i = 0; i < a.buckets.length(); i++) {
+    for (u_int i = 0; i < a.buckets.length(); i++) {
        const fxDictBucket* db = a.buckets[i];
        while (db) {
            addInternal(KEY(db), VALUE(db));
@@ -210,7 +210,7 @@ fxDictionary::hashKey(const void* key) const
 {
     u_long u = 0;
     const u_long* p = (const u_long*)key;
-    int l = (int)keysize;
+    u_int l = keysize;
     while (l>=sizeof (u_long)) {
        u ^= *p++;
        l -= sizeof (u_long);
index 36b676594dd847e28a92402d805fe5a46d6f82bb..42a78801e9443467421c5d19c92eaefa30a04a8b 100644 (file)
@@ -329,7 +329,7 @@ Dispatcher::Dispatcher() {
     _etable = new IOHandler*[_max_fds];
     _queue = new TimerQueue;
     _cqueue = new ChildQueue;
-    for (int i = 0; i < _max_fds; i++) {
+    for (u_int i = 0; i < _max_fds; i++) {
        _rtable[i] = NULL;
        _wtable[i] = NULL;
        _etable[i] = NULL;
@@ -385,6 +385,9 @@ void Dispatcher::unlink(int fd) {
 }
 
 void Dispatcher::attach(int fd, DispatcherMask mask, IOHandler* handler) {
+    if (fd < 0)
+       return;
+
     if (mask == ReadMask) {
         FD_SET(fd, &_rmask);
         _rtable[fd] = handler;
@@ -397,7 +400,7 @@ void Dispatcher::attach(int fd, DispatcherMask mask, IOHandler* handler) {
     } else {
         abort();
     }
-    if (_nfds < fd+1) {
+    if (_nfds < (unsigned)fd+1) {
        _nfds = fd+1;
     }
 }
@@ -409,7 +412,7 @@ void Dispatcher::detach(int fd) {
     _wtable[fd] = NULL;
     FD_CLR(fd, &_emask);
     _etable[fd] = NULL;
-    if (_nfds == fd+1) {
+    if (_nfds == (unsigned)fd+1) {
        while (_nfds > 0 && _rtable[_nfds-1] == NULL &&
               _wtable[_nfds-1] == NULL && _etable[_nfds-1] == NULL
        ) {
@@ -503,7 +506,7 @@ bool Dispatcher::anyReady() const {
         Dispatcher::sigCLD(0);         // poll for pending children
         return _cqueue->isReady();
     }
-    for (int i = 0; i < _nfds; i++) {
+    for (u_int i = 0; i < _nfds; i++) {
         if (FD_ISSET(i, &_rmaskready) ||
                 FD_ISSET(i, &_wmaskready) || FD_ISSET(i, &_emaskready)) {
             return true;
@@ -523,7 +526,7 @@ int Dispatcher::fillInReady(
     FD_ZERO(&_wmaskready);
     FD_ZERO(&_emaskready);
     int n = 0;
-    for (int i = 0; i < _nfds; i++) {
+    for (u_int i = 0; i < _nfds; i++) {
         if (FD_ISSET(i, &rmaskret)) n++;
         if (FD_ISSET(i, &wmaskret)) n++;
         if (FD_ISSET(i, &emaskret)) n++;
@@ -606,7 +609,7 @@ int Dispatcher::waitFor(
 
 void Dispatcher::notify(int nfound,
         fd_set& rmaskret, fd_set& wmaskret, fd_set& emaskret) {
-    for (int i = 0; i < _nfds && nfound > 0; i++) {
+    for (u_int i = 0; i < _nfds && nfound > 0; i++) {
         if (FD_ISSET(i, &rmaskret)) {
             if (_rtable[i]) {
                 int status = _rtable[i]->inputReady(i);
@@ -693,7 +696,7 @@ void Dispatcher::checkConnections() {
     FD_ZERO(&rmask);
     timeval poll = TimerQueue::zeroTime();
 
-    for (int fd = 0; fd < _nfds; fd++) {
+    for (u_int fd = 0; fd < _nfds; fd++) {
         if (_rtable[fd] != NULL) {
             FD_SET(fd, &rmask);
 #if CONFIG_BADSELECTPROTO
index a8a29878acfee85fcd676bcad5a017e3beb8ac9d..8ea17bd9a4199c03720ff79318b1cdeb8339dc26 100644 (file)
@@ -80,8 +80,8 @@ protected:
     virtual bool handleError();
     virtual void checkConnections();
 protected:
-    int        _nfds;
-    int _max_fds;
+    u_int _nfds;
+    u_int _max_fds;
     fd_set _rmask;
     fd_set _wmask;
     fd_set _emask;
index d64c6d1786b628ff9cdd51327d6b6daa3fb492ab..21f92baa9367e0c88a48ec2c20507578d315c1b2 100644 (file)
@@ -1103,7 +1103,7 @@ FaxClient::sendData(int fd,
        while (cc > 0) {
            char buf[32*1024];                  // XXX better if page-aligned
            size_t n = fxmin(cc, sizeof (buf));
-           if (read(fd, buf, n) != n) {
+           if (read(fd, buf, n) != (ssize_t)n) {
                protocolBotch(emsg, " (data read: %s).", strerror(errno));
                goto bad;
            }
index 2236fbd8fe22546c5d1a2a2527e01ad86c2deee6..8b04126815e9cfd0fd7b0da98dda117f4ea312fc 100644 (file)
@@ -84,7 +84,7 @@ public:
     struct FaxParam {
         const char* cmd;
         const char** parmNames;
-        int    NparmNames;
+        u_int  NparmNames;
         u_int  FaxClient::*pv;
     };
     struct FaxFmtHeader {
index 05c9ea6dd51ad4f2a434fa50ff666f9e734ec7ca..afac46121d38fbedb5bb1e7e395ff58b20c4c517 100644 (file)
@@ -33,7 +33,7 @@
 
 class PageInfoArray;
 
-typedef unsigned int BMU;      // ISO basic measurement unit
+typedef u_int BMU;     // ISO basic measurement unit
 struct PageInfo {
     const char* name;  // page size name
     const char* abbr;  // abbreviated name
index e473c71542ece622980401affcf83c03bfe08772..4e54582e73f4d84eac69e7d786418d76c41cd7f6 100644 (file)
@@ -940,7 +940,7 @@ SNPPClient::sendData(int fd, fxStr& emsg)
        while (cc > 0) {
            char buf[32*1024];
            size_t n = fxmin(cc, sizeof (buf));
-           if (read(fd, buf, n) != n) {
+           if (read(fd, buf, n) != (ssize_t) n) {
                protocolBotch(emsg, " (data read: %s).", strerror(errno));
                return (false);
            }
index 7a9a30db24cbeedd3423edf8e863c5646190890c..186cadcb8b70b8858486a8897f4de598d434730b 100644 (file)
@@ -31,7 +31,7 @@
 
 class SNPPClient;
 
-typedef unsigned int PageNotify;
+typedef u_int PageNotify;
 
 class SNPPJob : public fxObj {
 public:
index b5acf1af7cf5500c90d4908c7c61dddc65e094b8..1990584d3a41d49d127e7a2c4703b80687d7b5d5 100644 (file)
@@ -31,8 +31,8 @@
 
 class SendFaxClient;
 
-typedef unsigned int FaxNotify;
-typedef        unsigned int FaxPageChop;
+typedef u_int FaxNotify;
+typedef        u_int FaxPageChop;
 
 class SendFaxJob : public fxObj {
 public:
index eb428127a884f7f37af1a66cf95621f52a97f884..e52f10e98b3f113cdb7febccee1db99f44058dd3 100644 (file)
@@ -55,11 +55,11 @@ public:
 
     // NB: the buffer is *NOT* null terminated, unless you put one there.
     operator char*();                  // Return base of buffer
-    operator unsigned char*();         // Return base of buffer
+    operator u_char*();                // Return base of buffer
     operator const char*();            // Return base of buffer
-    operator const unsigned char*();   // Return base of buffer
+    operator const u_char*();  // Return base of buffer
     operator const char*() const;      // Return base of buffer
-    operator const unsigned char*() const;// Return base of buffer
+    operator const u_char*() const;// Return base of buffer
     char& operator[](u_int i) const;   // Return character in buffer
     char& operator[](int i) const;     // Return character in buffer
     fxStackBuffer& operator=(const fxStackBuffer&);
@@ -80,14 +80,14 @@ inline void fxStackBuffer::put(char const* c)       { put(c, strlen(c)); }
 inline void fxStackBuffer::set(char c)         { put(c); next--; }
 inline void fxStackBuffer::reset()             { next = base; }
 inline fxStackBuffer::operator char*()         { return base; }
-inline fxStackBuffer::operator unsigned char*() { return (unsigned char*)base; }
+inline fxStackBuffer::operator u_char*() { return (u_char*)base; }
 inline fxStackBuffer::operator const char*()   { return base; }
-inline fxStackBuffer::operator const unsigned char*()
-    { return (unsigned char*)base; }
+inline fxStackBuffer::operator const u_char*()
+    { return (u_char*)base; }
 inline fxStackBuffer::operator const char*() const
     { return base; }
-inline fxStackBuffer::operator const unsigned char*() const
-    { return (unsigned char*)base; }
+inline fxStackBuffer::operator const u_char*() const
+    { return (u_char*)base; }
 inline u_int fxStackBuffer::getLength() const  { return next - base; }
 inline char& fxStackBuffer::operator[](u_int ix) const { return base[ix]; }
 inline char& fxStackBuffer::operator[](int ix) const   { return base[ix]; }
index 90332be5c4bf7ddd44e8739d9b7c36498c9aa360..e71a70173e3a981c84927c6a84f0161316f63745 100644 (file)
@@ -89,9 +89,9 @@ public:
        { return ::open(filename, flags, m); }
     static int close(int fd)           { return ::close(fd); }
     // NB: char* param to read+write for implicit cast when using fxStr's
-    static int write(int fd, const char *buf, u_int cc)
+    static ssize_t write(int fd, const char *buf, u_int cc)
        { return ::write(fd, buf, cc); }
-    static int read(int fd, char* buf, unsigned cc)
+    static ssize_t read(int fd, char* buf, u_int cc)
        { return ::read(fd, buf, cc); }
 
     static time_t now(void)            { return ::time(0); }
index 97729440695d1945ba4d0865336f9faad38a569d..4f3c9a47d665f7fa48bf1ce8672ad23e96f6007d 100644 (file)
@@ -331,8 +331,7 @@ TextFmt::Copy_Block(off_t b1, off_t b2)
 {
     char buf[16*1024];
     for (off_t k = b1; k <= b2; k += sizeof (buf)) {
-       off_t cc = (off_t)
-           fxmin((u_long) (off_t) sizeof (buf), (u_long) (b2-k+1));
+       size_t cc = (size_t) fxmin(sizeof (buf), (unsigned) (b2-k+1));
        fseek(tf, (long) k, SEEK_SET);          // position to desired block
        if (fread(buf, 1, (size_t) cc, tf) != cc)
            fatal("Read error during reverse collation: %s", strerror(errno));
@@ -604,7 +603,7 @@ putString(FILE* fd, const char* val)
 {
     fputc('(', fd);
     for (; *val; val++) {
-       unsigned c = *val & 0xff;
+       u_int c = *val & 0xff;
        if ((c & 0200) == 0) {
            if (c == '(' || c == ')' || c == '\\')
                fputc('\\', fd);
@@ -620,7 +619,7 @@ TextFmt::beginCol(void)
 {
     if (column == 1) {                         // new page
        if (reverse)  {
-           int k = pageNum-firstPageNum;
+           u_int k = pageNum-firstPageNum;
            off_t off = (off_t) ftell(tf);
            if (k < pageOff->length())
                (*pageOff)[k] = off;
@@ -1165,7 +1164,7 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
            int aliascount = maxaliases;
             while (fgets(buf, sizeof(buf), fd) != NULL &&
                aliascount > 0) {
-                int len = strcspn(buf, "%\n");
+                size_t len = strcspn(buf, "%\n");
                 if (len == strlen(buf)) {
                    emsg = fxStr::format(
                        "Warning:%s - line too long.", (const char*)fontMapFile);
@@ -1295,14 +1294,14 @@ TextFont::show(FILE* fd, const char* val, int len) const
     if (len > 0) {
        fprintf(fd, "(");
        do {
-           unsigned c = *val++ & 0xff;
+           u_int c = *val++ & 0xff;
            if ((c & 0200) == 0) {
                if (c == '(' || c == ')' || c == '\\')
                    fputc('\\', fd);
                fputc(c, fd);
            } else
                fprintf(fd, "\\%03o", c);
-           hm += widths[(unsigned) c];         // Leif Erlingsson <leif@lege.com>
+           hm += widths[c];            // Leif Erlingsson <leif@lege.com>
        } while (--len);
        fprintf(fd, ")%s ", (const char*) showproc);
     }
@@ -1419,7 +1418,7 @@ TextFont::readMetrics(TextCoord ps, bool useISO8859, fxStr& emsg)
         */
        if (ix > 127)
            w = 625;                    // distrust metrics-file for char > 127
-       if (ix < NCHARS)
+       if ((unsigned)ix < NCHARS)
            widths[ix] = w*ps/1000L;
     }
     fclose(fp);
index 3e58548ec522b009aef3371ed5c82c4d007291b4..f6fdb5b2d52c1dd9d29bc79b731bf09c3ba7268e 100644 (file)
@@ -69,9 +69,9 @@ public:
     bool readMetrics(TextCoord pointsize, bool useISO8859, fxStr& emsg);
 };
 /*
- * we have to use unsigned const char
+ * we have to use const u_char
  */
-inline TextCoord TextFont::charwidth(const char c) const { return widths[(unsigned const char) c]; }
+inline TextCoord TextFont::charwidth(const char c) const { return widths[(const u_char) c]; }
 inline const char* TextFont::getFamily(void) const      { return family; }
 
 class FontDict;
index b18c045a7fadab2cc71d61e751723da785bd0557..27c94562437eb8d44a8c24d7ac86312de26d2851 100644 (file)
@@ -65,7 +65,7 @@ static const char* opNames[] =
 static const char* resultNames[] = { "tiff", "postscript", "error" };
 
 bool
-TypeRule::match(const void* data, u_int size, bool verbose) const
+TypeRule::match(const void* data, size_t size, bool verbose) const
 {
     if (verbose) {
        printf("rule: %soffset %#lx %s %s",
@@ -84,13 +84,13 @@ TypeRule::match(const void* data, u_int size, bool verbose) const
        }
        printf(" -- ");
     }
-    if (off > size) {
+    if (off > (off_t)size) {
        if (verbose)
            printf("failed (offset past data)\n");
        return (false);
     }
     bool ok = false;
-    u_long v = 0;
+    long v = 0;
     const u_char* cp = (const u_char*) data;
     switch (type) {
     case ASCII:
@@ -128,7 +128,7 @@ TypeRule::match(const void* data, u_int size, bool verbose) const
        v = *cp;
        break;
     case SHORT:
-       if (off + 2 < size) {
+       if (off + 2 < (off_t)size) {
            u_short w;
            memcpy(&w, cp+off, 2);
            v = ntohs(w);
@@ -138,7 +138,7 @@ TypeRule::match(const void* data, u_int size, bool verbose) const
            printf("failed (insufficient data)\n");
        return (false);
     case LONG:
-       if (off + 4 < size) {
+       if (off + 4 < (off_t)size) {
            memcpy(&v, cp+off, 4);
            v = ntohl(v);
            break;
index 073e116c65cae26356ae0fb11141cf8dbae572a2..6cf38e837963cccf9ef2102469b539bf4516db4b 100644 (file)
@@ -108,7 +108,7 @@ private:
     u_int match2(u_int base, const void* data, u_int size, bool verb) const;
 };
 
-typedef unsigned int TypeResult;               // conversion result
+typedef u_int TypeResult;              // conversion result
 
 /*
  * Type rules specify how to convert a file that is
index 29bc6379cd519b5adb40bbfa476c3dda5fee04d3..feb2cd18d88da92a5425b655c746dab62f4d907c 100644 (file)
@@ -35,7 +35,7 @@
 
 // Boolean type
 #ifdef NEED_BOOL
-typedef unsigned char bool;
+typedef u_char bool;
 #undef true
 #define true ((bool)1)
 #undef false
index c098e4711127ce15edb6dcefbd8ff8608b7840ef..fff8ebf63684003555833775e8bfb0ec7e32f986 100644 (file)
 #define        BIT(i)  (1<<(i))
 
 // bit ordering directives +fbor=<n>
-const int BOR_C_DIR    = 0;            // phase C direct
-const int BOR_C_REV    = 1;            // phase C reversed
-const int BOR_C                = 0x1;
-const int BOR_BD_DIR   = (0<<1);       // phase B/D direct
-const int BOR_BD_REV   = (1<<1);       // phase B/D reversed
-const int BOR_BD       = 0x2;
+const u_short BOR_C_DIR        = 0;            // phase C direct
+const u_short BOR_C_REV        = 1;            // phase C reversed
+const u_short BOR_C            = 0x1;
+const u_short BOR_BD_DIR       = (0<<1);       // phase B/D direct
+const u_short BOR_BD_REV       = (1<<1);       // phase B/D reversed
+const u_short BOR_BD   = 0x2;
 
 // service types returned by +fclass=?
-const int SERVICE_DATA  = BIT(0);      // data service
-const int SERVICE_CLASS1 = BIT(1);     // class 1 interface
-const int SERVICE_CLASS2 = BIT(2);     // class 2 interface
-const int SERVICE_CLASS20 = BIT(3);    // class 2.0 interface
-const int SERVICE_CLASS10 = BIT(4);    // class 1.0 interface
-const int SERVICE_CLASS21 = BIT(5);    // class 2.1 interface
-const int SERVICE_VOICE         = BIT(8);      // voice service (ZyXEL extension)
-const int SERVICE_ALL   = BIT(9)-1;
+const u_short SERVICE_DATA      = BIT(0);      // data service
+const u_short SERVICE_CLASS1 = BIT(1); // class 1 interface
+const u_short SERVICE_CLASS2 = BIT(2); // class 2 interface
+const u_short SERVICE_CLASS20 = BIT(3);        // class 2.0 interface
+const u_short SERVICE_CLASS10 = BIT(4);        // class 1.0 interface
+const u_short SERVICE_CLASS21 = BIT(5);        // class 2.1 interface
+const u_short SERVICE_VOICE     = BIT(8);      // voice service (ZyXEL extension)
+const u_short SERVICE_ALL       = BIT(9)-1;
 
 // t.30 session subparameter codes
 // NB: only the first two are used
-const int VR_NORMAL    = 0;            // 98 lpi
-const int VR_FINE      = 1;            // 196 lpi
-const int VR_R8                = 2;            // R8  x 15.4 l/mm
-const int VR_R16       = 4;            // R16 x 15.4 l/mm
-const int VR_200X100   = 8;            // 200 dpi x 100 l/25.4mm
-const int VR_200X200   = 10;           // 200 dpi x 200 l/25.4mm
-const int VR_200X400   = 20;           // 200 dpi x 400 l/25.4mm
-const int VR_300X300   = 40;           // 300 dpi x 300 l/25.4mm
-const int VR_ALL       = BIT(VR_FINE+1)-1;
+const u_int VR_NORMAL  = 0;            // 98 lpi
+const u_int VR_FINE    = 1;            // 196 lpi
+const u_int VR_R8              = 2;            // R8  x 15.4 l/mm
+const u_int VR_R16     = 4;            // R16 x 15.4 l/mm
+const u_int VR_200X100 = 8;            // 200 dpi x 100 l/25.4mm
+const u_int VR_200X200 = 10;           // 200 dpi x 200 l/25.4mm
+const u_int VR_200X400 = 20;           // 200 dpi x 400 l/25.4mm
+const u_int VR_300X300 = 40;           // 300 dpi x 300 l/25.4mm
+const u_int VR_ALL     = BIT(VR_FINE+1)-1;
 
-const int BR_2400      = 0;            // 2400 bit/s
-const int BR_4800      = 1;            // 4800 bit/s
-const int BR_7200      = 2;            // 7200 bit/s
-const int BR_9600      = 3;            // 9600 bit/s
-const int BR_12000     = 4;            // 12000 bit/s
-const int BR_14400     = 5;            // 14400 bit/s
-const int BR_16800     = 6;            // 16800 bit/s
-const int BR_19200     = 7;            // 19200 bit/s
-const int BR_21600     = 8;            // 21600 bit/s
-const int BR_24000     = 9;            // 24000 bit/s
-const int BR_26400     = 10;           // 26400 bit/s
-const int BR_28800     = 11;           // 28800 bit/s
-const int BR_31200     = 12;           // 31200 bit/s
-const int BR_33600     = 13;           // 33600 bit/s
-const int BR_ALL       = BIT(BR_33600+1)-1;
+const u_short BR_2400  = 0;            // 2400 bit/s
+const u_short BR_4800  = 1;            // 4800 bit/s
+const u_short BR_7200  = 2;            // 7200 bit/s
+const u_short BR_9600  = 3;            // 9600 bit/s
+const u_short BR_12000 = 4;            // 12000 bit/s
+const u_short BR_14400 = 5;            // 14400 bit/s
+const u_short BR_16800 = 6;            // 16800 bit/s
+const u_short BR_19200 = 7;            // 19200 bit/s
+const u_short BR_21600 = 8;            // 21600 bit/s
+const u_short BR_24000 = 9;            // 24000 bit/s
+const u_short BR_26400 = 10;           // 26400 bit/s
+const u_short BR_28800 = 11;           // 28800 bit/s
+const u_short BR_31200 = 12;           // 31200 bit/s
+const u_short BR_33600 = 13;           // 33600 bit/s
+const u_short BR_ALL   = BIT(BR_33600+1)-1;
 
-const int WD_1728      = 0;            // 1728 pixels in 215 mm
-const int WD_2048      = 1;            // 2048 pixels in 255 mm
-const int WD_2432      = 2;            // 2432 pixels in 303 mm
-const int WD_1216      = 3;            // 1216 pixels in 151 mm
-const int WD_864       = 4;            // 864 pixels in 107 mm
-const int WD_ALL       = BIT(WD_864+1)-1;
+const u_short WD_1728  = 0;            // 1728 pixels in 215 mm
+const u_short WD_2048  = 1;            // 2048 pixels in 255 mm
+const u_short WD_2432  = 2;            // 2432 pixels in 303 mm
+const u_short WD_1216  = 3;            // 1216 pixels in 151 mm
+const u_short WD_864   = 4;            // 864 pixels in 107 mm
+const u_short WD_ALL   = BIT(WD_864+1)-1;
 
-const int LN_A4                = 0;            // A4, 297 mm
-const int LN_B4                = 1;            // B4, 364 mm
-const int LN_INF       = 2;            // Unlimited length
-const int LN_ALL       = BIT(LN_INF+1)-1;
+const u_short LN_A4            = 0;            // A4, 297 mm
+const u_short LN_B4            = 1;            // B4, 364 mm
+const u_short LN_INF   = 2;            // Unlimited length
+const u_short LN_ALL   = BIT(LN_INF+1)-1;
 
-const int LN_LET       = 3;            // XXX US Letter size (used internally)
+const u_short LN_LET   = 3;            // XXX US Letter size (used internally)
 
-const int DF_1DMR      = 0;            // 1-D Modified Huffman
-const int DF_2DMR      = 1;            // 2-D Modified Huffman
-const int DF_2DMRUNCOMP        = 2;            // 2-D Uncompressed Mode
-const int DF_2DMMR     = 3;            // 2-D Modified Modified Read
-const int DF_ALL       = BIT(DF_2DMMR+1)-1;
+const u_short DF_1DMR  = 0;            // 1-D Modified Huffman
+const u_short DF_2DMR  = 1;            // 2-D Modified Huffman
+const u_short DF_2DMRUNCOMP    = 2;            // 2-D Uncompressed Mode
+const u_short DF_2DMMR = 3;            // 2-D Modified Modified Read
+const u_short DF_ALL   = BIT(DF_2DMMR+1)-1;
 
-const int EC_DISABLE   = 0;            // disable ECM
-const int EC_ENABLE    = 1;            // enable T.30 Annex A, ECM
-const int EC_ECLHALF   = 2;            // enable T.30 Annex C, half duplex
-const int EC_ECLFULL   = 3;            // enable T.30 Annex C, full duplex
-const int EC_ALL       = 0x3;
+const u_short EC_DISABLE       = 0;            // disable ECM
+const u_short EC_ENABLE        = 1;            // enable T.30 Annex A, ECM
+const u_short EC_ECLHALF       = 2;            // enable T.30 Annex C, half duplex
+const u_short EC_ECLFULL       = 3;            // enable T.30 Annex C, full duplex
+const u_short EC_ALL   = 0x3;
 
-const int BF_DISABLE   = 0;            // disable file transfer modes
-const int BF_ENABLE    = 1;            // select BFT, T.434
-const int BF_DTM       = 2;            // select Document Transfer Mode
-const int BF_EDI       = 4;            // select Edifact Mode
-const int BF_BTM       = 8;            // select Basic Transfer Mode
-const int BF_CM                = 10;           // select character mode T.4 Annex D
-const int BF_MM                = 20;           // select Mixed mode, T.4 Annex E
-const int BF_PM                = 40;           // select Processable mode, T.505
-const int BF_ALL       = 0x3;
+const u_short BF_DISABLE       = 0;            // disable file transfer modes
+const u_short BF_ENABLE        = 1;            // select BFT, T.434
+const u_short BF_DTM   = 2;            // select Document Transfer Mode
+const u_short BF_EDI   = 4;            // select Edifact Mode
+const u_short BF_BTM   = 8;            // select Basic Transfer Mode
+const u_short BF_CM            = 10;           // select character mode T.4 Annex D
+const u_short BF_MM            = 20;           // select Mixed mode, T.4 Annex E
+const u_short BF_PM            = 40;           // select Processable mode, T.505
+const u_short BF_ALL   = 0x3;
 
-const int ST_0MS       = 0;            // scan time/line: 0 ms/0 ms
-const int ST_5MS       = 1;            // scan time/line: 5 ms/5 ms
-const int ST_10MS2     = 2;            // scan time/line: 10 ms/5 ms
-const int ST_10MS      = 3;            // scan time/line: 10 ms/10 ms
-const int ST_20MS2     = 4;            // scan time/line: 20 ms/10 ms
-const int ST_20MS      = 5;            // scan time/line: 20 ms/20 ms
-const int ST_40MS2     = 6;            // scan time/line: 40 ms/20 ms
-const int ST_40MS      = 7;            // scan time/line: 40 ms/40 ms
-const int ST_ALL       = BIT(ST_40MS+1)-1;
+const u_short ST_0MS   = 0;            // scan time/line: 0 ms/0 ms
+const u_short ST_5MS   = 1;            // scan time/line: 5 ms/5 ms
+const u_short ST_10MS2 = 2;            // scan time/line: 10 ms/5 ms
+const u_short ST_10MS  = 3;            // scan time/line: 10 ms/10 ms
+const u_short ST_20MS2 = 4;            // scan time/line: 20 ms/10 ms
+const u_short ST_20MS  = 5;            // scan time/line: 20 ms/20 ms
+const u_short ST_40MS2 = 6;            // scan time/line: 40 ms/20 ms
+const u_short ST_40MS  = 7;            // scan time/line: 40 ms/40 ms
+const u_short ST_ALL   = BIT(ST_40MS+1)-1;
 
 // post page message codes
-const int PPM_MPS      = 0;            // another page next, same document
-const int PPM_EOM      = 1;            // another document next
-const int PPM_EOP      = 2;            // no more pages or documents
-const int PPM_PRI_MPS  = 4;            // another page, procedure interrupt
-const int PPM_PRI_EOM  = 5;            // another doc, procedure interrupt
-const int PPM_PRI_EOP  = 6;            // all done, procedure interrupt
+const u_short PPM_MPS  = 0;            // another page next, same document
+const u_short PPM_EOM  = 1;            // another document next
+const u_short PPM_EOP  = 2;            // no more pages or documents
+const u_short PPM_PRI_MPS      = 4;            // another page, procedure interrupt
+const u_short PPM_PRI_EOM      = 5;            // another doc, procedure interrupt
+const u_short PPM_PRI_EOP      = 6;            // all done, procedure interrupt
 
 // post page response codes
-const int PPR_MCF      = 1;            // page good
-const int PPR_RTN      = 2;            // page bad, retrain requested
-const int PPR_RTP      = 3;            // page good, retrain requested
-const int PPR_PIN      = 4;            // page bad, interrupt requested
-const int PPR_PIP      = 5;            // page good, interrupt requested
+const u_short PPR_MCF  = 1;            // page good
+const u_short PPR_RTN  = 2;            // page bad, retrain requested
+const u_short PPR_RTP  = 3;            // page good, retrain requested
+const u_short PPR_PIN  = 4;            // page bad, interrupt requested
+const u_short PPR_PIP  = 5;            // page good, interrupt requested
 
 // important stream transfer codes
+// These are actual (char) recived, so thes aren't unsigned int
 const int DLE = 16;            // transparent character escape
 const int SUB = 26;            // <DLE><SUB> => <DLE><DLE> for Class 2.0
 const int ETX = 3;             // <DLE><ETX> means end of transfer
index 35fbaa5ae849cb1bd02f7a47be765f4b48010ed4..f0096d923f32ecb0794dc59601357f66819cb22f 100644 (file)
@@ -59,7 +59,7 @@ isFAXImage(TIFF* tif)
 static void
 sanitize(fxStr& s)
 {
-    for(int i = 0; i < s.length(); i++) {
+    for(u_int i = 0; i < s.length(); i++) {
         if (!isascii(s[i]) || !isprint(s[i])) s[i] = '?';
     }
 }
index cadd51c3bc5bd8f0f9a78b333cb71997e58d1474..01089077fd7ef53fadde3a2aee86604151921995 100644 (file)
@@ -94,7 +94,7 @@ usage()
 int
 main(int argc, char* argv[])
 {
-    extern int optind, opterr;
+    extern int optind;
     extern char* optarg;
     int c;
     fxStr file;