mirror of
https://github.com/fadden/nulib2.git
synced 2024-10-31 11:08:35 +00:00
Fixed "assert" vs "Assert", some naming convention lapses, and a
possible gotcha in the Squeeze code.
This commit is contained in:
parent
18a61d2d31
commit
771144bcea
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user