From 771144bcea7deb61d89a964d087dbf1a3202a4d7 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sat, 28 Sep 2002 00:57:36 +0000 Subject: [PATCH] Fixed "assert" vs "Assert", some naming convention lapses, and a possible gotcha in the Squeeze code. --- nufxlib-0/Deferred.c | 2 +- nufxlib-0/Funnel.c | 4 ++-- nufxlib-0/Lzw.c | 18 +++++++++--------- nufxlib-0/MiscStuff.c | 4 ++-- nufxlib-0/Record.c | 4 ++-- nufxlib-0/Squeeze.c | 3 ++- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/nufxlib-0/Deferred.c b/nufxlib-0/Deferred.c index 1b0cb9e..70c8387 100644 --- a/nufxlib-0/Deferred.c +++ b/nufxlib-0/Deferred.c @@ -728,7 +728,7 @@ Nu_HandleAddThreadMods(NuArchive* pArchive, NuRecord* pRecord, /* if we're adding filename threads, stop after first one */ /* [shouldn't be able to happen... we only allow one filename!] */ if (doKeepFirstOnly && foundOne) { - assert(0); /* can this happen?? */ + Assert(0); /* can this happen?? */ continue; } foundOne = true; diff --git a/nufxlib-0/Funnel.c b/nufxlib-0/Funnel.c index 411ffae..28be9ff 100644 --- a/nufxlib-0/Funnel.c +++ b/nufxlib-0/Funnel.c @@ -794,8 +794,8 @@ bail: NuError Nu_StrawRewind(NuArchive* pArchive, NuStraw* pStraw) { - assert(pStraw != nil); - assert(pStraw->pDataSource != nil); + Assert(pStraw != nil); + Assert(pStraw->pDataSource != nil); pStraw->lastProgress = 0; pStraw->lastDisplayed = 0; diff --git a/nufxlib-0/Lzw.c b/nufxlib-0/Lzw.c index 4237098..615f497 100644 --- a/nufxlib-0/Lzw.c +++ b/nufxlib-0/Lzw.c @@ -93,7 +93,7 @@ /* * Mask of bits, from 0 to 8. */ -static const int gBitMask[] = { +static const int gNuBitMask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; @@ -295,7 +295,7 @@ Nu_LZWPutCode(uchar** pOutBuf, ulong prefixCode, int codeBits, int* pAtBit) /*DBUG_LZW(("### PUT: prefixCode=0x%04lx, codeBits=%d, atBit=%d\n", prefixCode, codeBits, atBit));*/ - Assert(atBit >= 0 && atBit < sizeof(gBitMask)); + Assert(atBit >= 0 && atBit < sizeof(gNuBitMask)); if (atBit) { /* align the prefix code with the existing byte */ @@ -303,7 +303,7 @@ Nu_LZWPutCode(uchar** pOutBuf, ulong prefixCode, int codeBits, int* pAtBit) /* merge it with the buffer contents (if necessary) and write lo bits */ outBuf--; - *outBuf = (uchar)((*outBuf & gBitMask[atBit]) | prefixCode); + *outBuf = (uchar)((*outBuf & gNuBitMask[atBit]) | prefixCode); outBuf++; } else { /* nothing to merge with; write lo byte at next posn and advance */ @@ -807,13 +807,13 @@ Nu_CompressLZW2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp, /* * Static tables useful for bit manipulation. */ -static const uint gMaskTable[17] = { +static const uint gNuMaskTable[17] = { 0x0000, 0x01ff, 0x03ff, 0x03ff, 0x07ff, 0x07ff, 0x07ff, 0x07ff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff, 0x0fff }; /* convert high byte of "entry" into a bit width */ -static const uint gBitWidth[17] = { +static const uint gNuBitWidth[17] = { 8,9,10,10,11,11,11,11,12,12,12,12,12,12,12,12,12 }; @@ -931,7 +931,7 @@ Nu_LZWGetCode(const uchar** pInBuf, uint entry, int* pAtBit, uint* pLastByte) numBits = (entry +1) >> 8; /* bit-width of next code */ startBit = *pAtBit; - lastBit = startBit + gBitWidth[numBits]; + lastBit = startBit + gNuBitWidth[numBits]; /* * We need one or two bytes from the input. These have to be shifted @@ -956,13 +956,13 @@ Nu_LZWGetCode(const uchar** pInBuf, uint entry, int* pAtBit, uint* pLastByte) *pAtBit = lastBit & 0x07; /*printf("| EX: value=$%06lx mask=$%04x return=$%03lx\n", - value,gMaskTable[numBits], (value >> startBit) & gMaskTable[numBits]);*/ + value,gNuMaskTable[numBits], (value >> startBit) & gNuMaskTable[numBits]);*/ /*DBUG_LZW(("### getcode 0x%04lx\n", - (value >> startBit) & gMaskTable[numBits]));*/ + (value >> startBit) & gNuMaskTable[numBits]));*/ /* I believe ANSI allows shifting by zero bits, so don't test "!startBit" */ - return (value >> startBit) & gMaskTable[numBits]; + return (value >> startBit) & gNuMaskTable[numBits]; } diff --git a/nufxlib-0/MiscStuff.c b/nufxlib-0/MiscStuff.c index ce94151..08544e2 100644 --- a/nufxlib-0/MiscStuff.c +++ b/nufxlib-0/MiscStuff.c @@ -46,8 +46,8 @@ Nu_memmove(void* dst, const void* src, size_t n) char* dstp = (char*)dst; /* you can normally get away with this if n==0 */ - assert(dst != NULL); - assert(src != NULL); + Assert(dst != NULL); + Assert(src != NULL); if (dstp == srcp || !n) { /* nothing to do */ diff --git a/nufxlib-0/Record.c b/nufxlib-0/Record.c index 2cb8017..a04fc00 100644 --- a/nufxlib-0/Record.c +++ b/nufxlib-0/Record.c @@ -760,7 +760,7 @@ Nu_RecordSet_ReplaceRecord(NuArchive* pArchive, NuRecordSet* pBadSet, if (pSiblingRecord == nil) { /* looks like "pBadRecord" wasn't part of "pBadSet" after all */ - assert(0); + Assert(0); err = kNuErrInternal; goto bail; } @@ -2057,7 +2057,7 @@ Nu_HandleAddDuplicateRecord(NuArchive* pArchive, NuRecordSet* pRecordSet, /* fall through to record deletion */ break; default: - assert(0); + Assert(0); err = kNuErrInternal; goto bail; } diff --git a/nufxlib-0/Squeeze.c b/nufxlib-0/Squeeze.c index 81b81b6..c65b940 100644 --- a/nufxlib-0/Squeeze.c +++ b/nufxlib-0/Squeeze.c @@ -122,7 +122,7 @@ Nu_SQGetcCRC(SQState* pSqState, int* pSym) NuError err; uchar c; - if (!pSqState->uncompRemaining--) { + if (!pSqState->uncompRemaining) { *pSym = kNuSQEOFToken; return kNuErrNone; } @@ -136,6 +136,7 @@ Nu_SQGetcCRC(SQState* pSqState, int* pSym) pSqState->crc = Nu_CalcCRC16(pSqState->crc, &c, 1); } *pSym = c; + pSqState->uncompRemaining--; } return err;