Move method return type to declaration line

Having the method name up against the left edge used to be common
practice, because you could jump to a method quickly by searching
for "^name".  Now we have "ctags" and IDEs.
This commit is contained in:
Andy McFadden 2014-12-22 16:00:33 -08:00
parent 20c9ac1195
commit 9666ebd97a
34 changed files with 691 additions and 1200 deletions

View File

@ -53,8 +53,7 @@ static void Nu_CloseAndFree(NuArchive* pArchive);
/*
* Allocate and initialize a new NuArchive structure.
*/
static NuError
Nu_NuArchiveNew(NuArchive** ppArchive)
static NuError Nu_NuArchiveNew(NuArchive** ppArchive)
{
Assert(ppArchive != NULL);
@ -105,8 +104,7 @@ Nu_NuArchiveNew(NuArchive** ppArchive)
/*
* Free up a NuArchive structure and its contents.
*/
static NuError
Nu_NuArchiveFree(NuArchive* pArchive)
static NuError Nu_NuArchiveFree(NuArchive* pArchive)
{
Assert(pArchive != NULL);
Assert(pArchive->structMagic == kNuArchiveStructMagic);
@ -133,8 +131,7 @@ Nu_NuArchiveFree(NuArchive* pArchive)
/*
* Copy a NuMasterHeader struct.
*/
void
Nu_MasterHeaderCopy(NuArchive* pArchive, NuMasterHeader* pDstHeader,
void Nu_MasterHeaderCopy(NuArchive* pArchive, NuMasterHeader* pDstHeader,
const NuMasterHeader* pSrcHeader)
{
Assert(pArchive != NULL);
@ -147,8 +144,8 @@ Nu_MasterHeaderCopy(NuArchive* pArchive, NuMasterHeader* pDstHeader,
/*
* Get a pointer to the archive master header (this is an API call).
*/
NuError
Nu_GetMasterHeader(NuArchive* pArchive, const NuMasterHeader** ppMasterHeader)
NuError Nu_GetMasterHeader(NuArchive* pArchive,
const NuMasterHeader** ppMasterHeader)
{
if (ppMasterHeader == NULL)
return kNuErrInvalidArg;
@ -162,8 +159,7 @@ Nu_GetMasterHeader(NuArchive* pArchive, const NuMasterHeader** ppMasterHeader)
/*
* Allocate the general-purpose compression buffer, if needed.
*/
NuError
Nu_AllocCompressionBufferIFN(NuArchive* pArchive)
NuError Nu_AllocCompressionBufferIFN(NuArchive* pArchive)
{
Assert(pArchive != NULL);
@ -181,8 +177,7 @@ Nu_AllocCompressionBufferIFN(NuArchive* pArchive)
/*
* Return a unique value.
*/
NuRecordIdx
Nu_GetNextRecordIdx(NuArchive* pArchive)
NuRecordIdx Nu_GetNextRecordIdx(NuArchive* pArchive)
{
return pArchive->nextRecordIdx++;
}
@ -190,8 +185,7 @@ Nu_GetNextRecordIdx(NuArchive* pArchive)
/*
* Return a unique value.
*/
NuThreadIdx
Nu_GetNextThreadIdx(NuArchive* pArchive)
NuThreadIdx Nu_GetNextThreadIdx(NuArchive* pArchive)
{
return pArchive->nextRecordIdx++; /* just use the record counter */
}
@ -206,8 +200,7 @@ Nu_GetNextThreadIdx(NuArchive* pArchive)
/*
* Copy the wrapper from the archive file to the temp file.
*/
NuError
Nu_CopyWrapperToTemp(NuArchive* pArchive)
NuError Nu_CopyWrapperToTemp(NuArchive* pArchive)
{
NuError err;
@ -245,8 +238,7 @@ bail:
* guess some of the SEA weirdness stems from some far-sighted support
* for multiple archives within a single SEA wrapper.
*/
NuError
Nu_UpdateWrapper(NuArchive* pArchive, FILE* fp)
NuError Nu_UpdateWrapper(NuArchive* pArchive, FILE* fp)
{
NuError err = kNuErrNone;
Boolean hasBinary2, hasSea;
@ -397,8 +389,7 @@ bail:
* require additional disk space to be used, assuming a filesystem block
* size of at least 128 bytes.
*/
NuError
Nu_AdjustWrapperPadding(NuArchive* pArchive, FILE* fp)
NuError Nu_AdjustWrapperPadding(NuArchive* pArchive, FILE* fp)
{
NuError err = kNuErrNone;
Boolean hasBinary2, hasSea;
@ -493,8 +484,7 @@ bail:
*
* On exit, the stream will be positioned just past the master header.
*/
static NuError
Nu_ReadMasterHeader(NuArchive* pArchive)
static NuError Nu_ReadMasterHeader(NuArchive* pArchive)
{
NuError err;
uint16_t crc;
@ -710,8 +700,7 @@ bail:
* Prepare the NuArchive and NuMasterHeader structures for use with a
* newly-created archive.
*/
static void
Nu_InitNewArchive(NuArchive* pArchive)
static void Nu_InitNewArchive(NuArchive* pArchive)
{
NuMasterHeader* pHeader;
@ -739,8 +728,7 @@ Nu_InitNewArchive(NuArchive* pArchive)
/*
* Open an archive in streaming read-only mode.
*/
NuError
Nu_StreamOpenRO(FILE* infp, NuArchive** ppArchive)
NuError Nu_StreamOpenRO(FILE* infp, NuArchive** ppArchive)
{
NuError err;
NuArchive* pArchive = NULL;
@ -773,8 +761,7 @@ bail:
/*
* Open an archive in non-streaming read-only mode.
*/
NuError
Nu_OpenRO(const char* archivePathname, NuArchive** ppArchive)
NuError Nu_OpenRO(const char* archivePathname, NuArchive** ppArchive)
{
NuError err;
NuArchive* pArchive = NULL;
@ -825,8 +812,7 @@ bail:
* Thought for the day: consider using Win32 SetFileAttributes() to make
* temp files hidden. We will need to un-hide it before rolling it over.
*/
static NuError
Nu_OpenTempFile(char* fileName, FILE** pFp)
static NuError Nu_OpenTempFile(char* fileName, FILE** pFp)
{
NuArchive* pArchive = NULL; /* dummy for NU_BLOB */
NuError err = kNuErrNone;
@ -926,9 +912,8 @@ bail:
* Open an archive in read-write mode, optionally creating it if it doesn't
* exist.
*/
NuError
Nu_OpenRW(const char* archivePathname, const char* tmpPathname, uint32_t flags,
NuArchive** ppArchive)
NuError Nu_OpenRW(const char* archivePathname, const char* tmpPathname,
uint32_t flags, NuArchive** ppArchive)
{
NuError err;
FILE* fp = NULL;
@ -1058,8 +1043,7 @@ bail:
/*
* Write the NuFX master header at the current offset.
*/
NuError
Nu_WriteMasterHeader(NuArchive* pArchive, FILE* fp,
NuError Nu_WriteMasterHeader(NuArchive* pArchive, FILE* fp,
NuMasterHeader* pHeader)
{
NuError err;
@ -1120,8 +1104,7 @@ bail:
* If it's a brand-new archive, and we didn't add anything to it, then we
* want to remove the stub archive file.
*/
static void
Nu_CloseAndFree(NuArchive* pArchive)
static void Nu_CloseAndFree(NuArchive* pArchive)
{
if (pArchive->archiveFp != NULL) {
DBUG(("--- Closing archive\n"));
@ -1156,8 +1139,7 @@ Nu_CloseAndFree(NuArchive* pArchive)
/*
* Flush pending changes to the archive, then close it.
*/
NuError
Nu_Close(NuArchive* pArchive)
NuError Nu_Close(NuArchive* pArchive)
{
NuError err = kNuErrNone;
long flushStatus;
@ -1188,8 +1170,7 @@ Nu_Close(NuArchive* pArchive)
/*
* Delete the archive file, which should already have been closed.
*/
NuError
Nu_DeleteArchiveFile(NuArchive* pArchive)
NuError Nu_DeleteArchiveFile(NuArchive* pArchive)
{
Assert(pArchive != NULL);
Assert(pArchive->archiveFp == NULL);
@ -1202,8 +1183,7 @@ Nu_DeleteArchiveFile(NuArchive* pArchive)
* Rename the temp file on top of the original archive. The temp file
* should be closed, and the archive file should be deleted.
*/
NuError
Nu_RenameTempToArchive(NuArchive* pArchive)
NuError Nu_RenameTempToArchive(NuArchive* pArchive)
{
Assert(pArchive != NULL);
Assert(pArchive->archiveFp == NULL);

View File

@ -26,8 +26,7 @@
/*
* Read one byte, optionally computing a CRC.
*/
uint8_t
Nu_ReadOneC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
uint8_t Nu_ReadOneC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
{
int ic;
@ -41,8 +40,7 @@ Nu_ReadOneC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
return (uint8_t) ic;
}
uint8_t
Nu_ReadOne(NuArchive* pArchive, FILE* fp)
uint8_t Nu_ReadOne(NuArchive* pArchive, FILE* fp)
{
uint16_t dummyCrc CLEAN_INIT;
return Nu_ReadOneC(pArchive, fp, &dummyCrc);
@ -51,8 +49,7 @@ Nu_ReadOne(NuArchive* pArchive, FILE* fp)
/*
* Write one byte, optionally computing a CRC.
*/
void
Nu_WriteOneC(NuArchive* pArchive, FILE* fp, uint8_t val, uint16_t* pCrc)
void Nu_WriteOneC(NuArchive* pArchive, FILE* fp, uint8_t val, uint16_t* pCrc)
{
Assert(pArchive != NULL);
Assert(fp != NULL);
@ -61,8 +58,7 @@ Nu_WriteOneC(NuArchive* pArchive, FILE* fp, uint8_t val, uint16_t* pCrc)
putc(val, fp);
}
void
Nu_WriteOne(NuArchive* pArchive, FILE* fp, uint8_t val)
void Nu_WriteOne(NuArchive* pArchive, FILE* fp, uint8_t val)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_WriteOneC(pArchive, fp, val, &dummyCrc);
@ -72,8 +68,7 @@ Nu_WriteOne(NuArchive* pArchive, FILE* fp, uint8_t val)
/*
* Read two little-endian bytes, optionally computing a CRC.
*/
uint16_t
Nu_ReadTwoC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
uint16_t Nu_ReadTwoC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
{
int ic1, ic2;
@ -89,8 +84,7 @@ Nu_ReadTwoC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
return ic1 | ic2 << 8;
}
uint16_t
Nu_ReadTwo(NuArchive* pArchive, FILE* fp)
uint16_t Nu_ReadTwo(NuArchive* pArchive, FILE* fp)
{
uint16_t dummyCrc CLEAN_INIT;
return Nu_ReadTwoC(pArchive, fp, &dummyCrc);
@ -100,8 +94,7 @@ Nu_ReadTwo(NuArchive* pArchive, FILE* fp)
/*
* Write two little-endian bytes, optionally computing a CRC.
*/
void
Nu_WriteTwoC(NuArchive* pArchive, FILE* fp, uint16_t val, uint16_t* pCrc)
void Nu_WriteTwoC(NuArchive* pArchive, FILE* fp, uint16_t val, uint16_t* pCrc)
{
int ic1, ic2;
@ -118,8 +111,7 @@ Nu_WriteTwoC(NuArchive* pArchive, FILE* fp, uint16_t val, uint16_t* pCrc)
putc(ic2, fp);
}
void
Nu_WriteTwo(NuArchive* pArchive, FILE* fp, uint16_t val)
void Nu_WriteTwo(NuArchive* pArchive, FILE* fp, uint16_t val)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_WriteTwoC(pArchive, fp, val, &dummyCrc);
@ -129,8 +121,7 @@ Nu_WriteTwo(NuArchive* pArchive, FILE* fp, uint16_t val)
/*
* Read four little-endian bytes, optionally computing a CRC.
*/
uint32_t
Nu_ReadFourC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
uint32_t Nu_ReadFourC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
{
int ic1, ic2, ic3, ic4;
@ -150,8 +141,7 @@ Nu_ReadFourC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
return ic1 | ic2 << 8 | (uint32_t)ic3 << 16 | (uint32_t)ic4 << 24;
}
uint32_t
Nu_ReadFour(NuArchive* pArchive, FILE* fp)
uint32_t Nu_ReadFour(NuArchive* pArchive, FILE* fp)
{
uint16_t dummyCrc CLEAN_INIT;
return Nu_ReadFourC(pArchive, fp, &dummyCrc);
@ -161,8 +151,7 @@ Nu_ReadFour(NuArchive* pArchive, FILE* fp)
/*
* Write four little-endian bytes, optionally computing a CRC.
*/
void
Nu_WriteFourC(NuArchive* pArchive, FILE* fp, uint32_t val, uint16_t* pCrc)
void Nu_WriteFourC(NuArchive* pArchive, FILE* fp, uint32_t val, uint16_t* pCrc)
{
int ic1, ic2, ic3, ic4;
@ -185,8 +174,7 @@ Nu_WriteFourC(NuArchive* pArchive, FILE* fp, uint32_t val, uint16_t* pCrc)
putc(ic4, fp);
}
void
Nu_WriteFour(NuArchive* pArchive, FILE* fp, uint32_t val)
void Nu_WriteFour(NuArchive* pArchive, FILE* fp, uint32_t val)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_WriteFourC(pArchive, fp, val, &dummyCrc);
@ -200,8 +188,7 @@ Nu_WriteFour(NuArchive* pArchive, FILE* fp, uint32_t val)
* and GS/ShrinkIt. It's easy enough to deal with, and I figure the less
* messing-with, the better.
*/
NuDateTime
Nu_ReadDateTimeC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
NuDateTime Nu_ReadDateTimeC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
{
NuDateTime temp;
int ic;
@ -238,8 +225,7 @@ Nu_ReadDateTimeC(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
return temp;
}
NuDateTime
Nu_ReadDateTime(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
NuDateTime Nu_ReadDateTime(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
{
uint16_t dummyCrc CLEAN_INIT;
return Nu_ReadDateTimeC(pArchive, fp, &dummyCrc);
@ -249,8 +235,7 @@ Nu_ReadDateTime(NuArchive* pArchive, FILE* fp, uint16_t* pCrc)
/*
* Write an 8-byte NuFX Date/Time structure.
*/
void
Nu_WriteDateTimeC(NuArchive* pArchive, FILE* fp, NuDateTime dateTime,
void Nu_WriteDateTimeC(NuArchive* pArchive, FILE* fp, NuDateTime dateTime,
uint16_t* pCrc)
{
int ic;
@ -285,8 +270,7 @@ Nu_WriteDateTimeC(NuArchive* pArchive, FILE* fp, NuDateTime dateTime,
putc(ic, fp);
}
void
Nu_WriteDateTime(NuArchive* pArchive, FILE* fp, NuDateTime dateTime)
void Nu_WriteDateTime(NuArchive* pArchive, FILE* fp, NuDateTime dateTime)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_WriteDateTimeC(pArchive, fp, dateTime, &dummyCrc);
@ -296,8 +280,7 @@ Nu_WriteDateTime(NuArchive* pArchive, FILE* fp, NuDateTime dateTime)
/*
* Read N bytes from the stream, optionally computing a CRC.
*/
void
Nu_ReadBytesC(NuArchive* pArchive, FILE* fp, void* vbuffer, long count,
void Nu_ReadBytesC(NuArchive* pArchive, FILE* fp, void* vbuffer, long count,
uint16_t* pCrc)
{
uint8_t* buffer = vbuffer;
@ -316,8 +299,7 @@ Nu_ReadBytesC(NuArchive* pArchive, FILE* fp, void* vbuffer, long count,
}
}
void
Nu_ReadBytes(NuArchive* pArchive, FILE* fp, void* vbuffer, long count)
void Nu_ReadBytes(NuArchive* pArchive, FILE* fp, void* vbuffer, long count)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_ReadBytesC(pArchive, fp, vbuffer, count, &dummyCrc);
@ -327,9 +309,8 @@ Nu_ReadBytes(NuArchive* pArchive, FILE* fp, void* vbuffer, long count)
/*
* Write N bytes to the stream, optionally computing a CRC.
*/
void
Nu_WriteBytesC(NuArchive* pArchive, FILE* fp, const void* vbuffer, long count,
uint16_t* pCrc)
void Nu_WriteBytesC(NuArchive* pArchive, FILE* fp, const void* vbuffer,
long count, uint16_t* pCrc)
{
const uint8_t* buffer = vbuffer;
int ic;
@ -347,8 +328,8 @@ Nu_WriteBytesC(NuArchive* pArchive, FILE* fp, const void* vbuffer, long count,
}
}
void
Nu_WriteBytes(NuArchive* pArchive, FILE* fp, const void* vbuffer, long count)
void Nu_WriteBytes(NuArchive* pArchive, FILE* fp, const void* vbuffer,
long count)
{
uint16_t dummyCrc CLEAN_INIT;
Nu_WriteBytesC(pArchive, fp, vbuffer, count, &dummyCrc);
@ -365,8 +346,7 @@ Nu_WriteBytes(NuArchive* pArchive, FILE* fp, const void* vbuffer, long count)
* Determine whether the stream completed the last set of operations
* successfully.
*/
NuError
Nu_HeaderIOFailed(NuArchive* pArchive, FILE* fp)
NuError Nu_HeaderIOFailed(NuArchive* pArchive, FILE* fp)
{
if (feof(fp) || ferror(fp))
return kNuErrFile;
@ -381,8 +361,7 @@ Nu_HeaderIOFailed(NuArchive* pArchive, FILE* fp)
*
* The values for "ptrname" are the same as for fseek().
*/
NuError
Nu_SeekArchive(NuArchive* pArchive, FILE* fp, long offset, int ptrname)
NuError Nu_SeekArchive(NuArchive* pArchive, FILE* fp, long offset, int ptrname)
{
if (Nu_IsStreaming(pArchive)) {
Assert(ptrname == SEEK_CUR);
@ -408,8 +387,7 @@ Nu_SeekArchive(NuArchive* pArchive, FILE* fp, long offset, int ptrname)
*
* Note that rewind(3S) resets the error indication, but this doesn't.
*/
NuError
Nu_RewindArchive(NuArchive* pArchive)
NuError Nu_RewindArchive(NuArchive* pArchive)
{
Assert(pArchive != NULL);
Assert(!Nu_IsStreaming(pArchive));

View File

@ -25,13 +25,11 @@
/*
* Alloc and free functions provided to libbz2.
*/
static void*
Nu_bzalloc(void* opaque, int items, int size)
static void* Nu_bzalloc(void* opaque, int items, int size)
{
return Nu_Malloc(opaque, items * size);
}
static void
Nu_bzfree(void* opaque, void* address)
static void Nu_bzfree(void* opaque, void* address)
{
Nu_Free(opaque, address);
}
@ -46,8 +44,7 @@ Nu_bzfree(void* opaque, void* address)
/*
* Compress "srcLen" bytes from "pStraw" to "fp".
*/
NuError
Nu_CompressBzip2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressBzip2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
NuError err = kNuErrNone;
@ -173,8 +170,7 @@ bail:
/*
* Expand from "infp" to "pFunnel".
*/
NuError
Nu_ExpandBzip2(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandBzip2(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, uint16_t* pCrc)
{
NuError err = kNuErrNone;

View File

@ -15,8 +15,7 @@
/*
* "Compress" an uncompressed thread.
*/
static NuError
Nu_CompressUncompressed(NuArchive* pArchive, NuStraw* pStraw,
static NuError Nu_CompressUncompressed(NuArchive* pArchive, NuStraw* pStraw,
FILE* fp, uint32_t srcLen, uint32_t* pDstLen, uint16_t *pCrc)
{
NuError err = kNuErrNone;
@ -87,8 +86,7 @@ bail:
* On exit, the output file will be positioned after the last byte of the
* output. (For a pre-sized buffer, this may not be the desired result.)
*/
NuError
Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
NuError Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
NuThreadID threadID, NuThreadFormat sourceFormat,
NuThreadFormat targetFormat, NuProgressData* pProgressData, FILE* dstFp,
NuThread* pThread)
@ -322,8 +320,7 @@ bail:
* will copy the data, and then continue writing zeros to fill out the rest
* of the pre-sized buffer.
*/
NuError
Nu_CopyPresizedToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
NuError Nu_CopyPresizedToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
NuThreadID threadID, FILE* dstFp, NuThread* pThread, char** ppSavedCopy)
{
NuError err = kNuErrNone;

View File

@ -83,8 +83,7 @@ const uint16_t gNuCrc16Table[256] = {
* Depending on CPU architecture, one may be dramatically faster than
* the other.
*/
uint16_t
Nu_CalcCRC16(uint16_t seed, const uint8_t* ptr, int count)
uint16_t Nu_CalcCRC16(uint16_t seed, const uint8_t* ptr, int count)
{
uint16_t CRC = seed;
#ifndef CRC_TAB

View File

@ -65,8 +65,7 @@ static const char* gFileSysIDs[] = {
*
* Returns "buffer" for the benefit of printf() calls.
*/
static char*
Nu_DebugDumpDate(const NuDateTime* pDateTime, char* buffer)
static char* Nu_DebugDumpDate(const NuDateTime* pDateTime, char* buffer)
{
char* cp;
@ -118,8 +117,7 @@ bail:
*
* The result will be 2x the size of the original, +1 for a null byte.
*/
static void
ConvertToHexStr(const uint8_t* inBuf, int inLen, char* outBuf)
static void ConvertToHexStr(const uint8_t* inBuf, int inLen, char* outBuf)
{
while (inLen--) {
*outBuf++ = HexConv((*inBuf >> 4) & 0x0f);
@ -133,8 +131,7 @@ ConvertToHexStr(const uint8_t* inBuf, int inLen, char* outBuf)
/*
* Dump everything we know about pThread.
*/
void
Nu_DebugDumpThread(const NuThread* pThread)
void Nu_DebugDumpThread(const NuThread* pThread)
{
static const char* kInd = " ";
NuThreadID threadID;
@ -177,8 +174,7 @@ Nu_DebugDumpThread(const NuThread* pThread)
* set. Pass in the "orig" copy in "pRecord", and optionally pass in the
* "copy" set in "pXrefRecord" to glean data from both.
*/
static void
Nu_DebugDumpRecord(NuArchive* pArchive, const NuRecord* pRecord,
static void Nu_DebugDumpRecord(NuArchive* pArchive, const NuRecord* pRecord,
const NuRecord* pXrefRecord, Boolean isDeleted)
{
NuError err; /* dummy */
@ -290,9 +286,8 @@ bail:
/*
* Dump the records in a RecordSet.
*/
static void
Nu_DebugDumpRecordSet(NuArchive* pArchive, const NuRecordSet* pRecordSet,
const NuRecordSet* pXrefSet)
static void Nu_DebugDumpRecordSet(NuArchive* pArchive,
const NuRecordSet* pRecordSet, const NuRecordSet* pXrefSet)
{
const NuRecord* pRecord;
const NuRecord* pXrefRecord;
@ -332,8 +327,7 @@ Nu_DebugDumpRecordSet(NuArchive* pArchive, const NuRecordSet* pRecordSet,
/*
* Dump the master header block.
*/
static void
Nu_DebugDumpMH(const NuMasterHeader* pMasterHeader)
static void Nu_DebugDumpMH(const NuMasterHeader* pMasterHeader)
{
static const char* kInd = " ";
char dateBuf1[kNuDateOutputLen];
@ -359,8 +353,7 @@ Nu_DebugDumpMH(const NuMasterHeader* pMasterHeader)
* the archive, then this won't be very interesting. This will never
* show any records for streaming-mode archives.
*/
void
Nu_DebugDumpAll(NuArchive* pArchive)
void Nu_DebugDumpAll(NuArchive* pArchive)
{
Assert(pArchive != NULL);

View File

@ -23,8 +23,7 @@
* NOTE: threadFormat is how you want the data to be compressed. The
* threadFormat passed to DataSource describes the source data.
*/
NuError
Nu_ThreadModAdd_New(NuArchive* pArchive, NuThreadID threadID,
NuError Nu_ThreadModAdd_New(NuArchive* pArchive, NuThreadID threadID,
NuThreadFormat threadFormat, NuDataSource* pDataSource,
NuThreadMod** ppThreadMod)
{
@ -53,8 +52,7 @@ Nu_ThreadModAdd_New(NuArchive* pArchive, NuThreadID threadID,
*
* Caller is allowed to dispose of the data source.
*/
NuError
Nu_ThreadModUpdate_New(NuArchive* pArchive, NuThreadIdx threadIdx,
NuError Nu_ThreadModUpdate_New(NuArchive* pArchive, NuThreadIdx threadIdx,
NuDataSource* pDataSource, NuThreadMod** ppThreadMod)
{
Assert(ppThreadMod != NULL);
@ -78,8 +76,7 @@ Nu_ThreadModUpdate_New(NuArchive* pArchive, NuThreadIdx threadIdx,
* The "threadID" argument is really only needed for filename threads. We
* use it when trying to track how many filename threads we really have.
*/
NuError
Nu_ThreadModDelete_New(NuArchive* pArchive, NuThreadIdx threadIdx,
NuError Nu_ThreadModDelete_New(NuArchive* pArchive, NuThreadIdx threadIdx,
NuThreadID threadID, NuThreadMod** ppThreadMod)
{
Assert(ppThreadMod != NULL);
@ -99,8 +96,7 @@ Nu_ThreadModDelete_New(NuArchive* pArchive, NuThreadIdx threadIdx,
/*
* Free a single NuThreadMod.
*/
void
Nu_ThreadModFree(NuArchive* pArchive, NuThreadMod* pThreadMod)
void Nu_ThreadModFree(NuArchive* pArchive, NuThreadMod* pThreadMod)
{
if (pThreadMod == NULL)
return;
@ -133,8 +129,8 @@ Nu_ThreadModFree(NuArchive* pArchive, NuThreadMod* pThreadMod)
*
* Returns "NULL" if nothing found.
*/
NuThreadMod*
Nu_ThreadMod_FindByThreadIdx(const NuRecord* pRecord, NuThreadIdx threadIdx)
NuThreadMod* Nu_ThreadMod_FindByThreadIdx(const NuRecord* pRecord,
NuThreadIdx threadIdx)
{
NuThreadMod* pThreadMod;
NuThreadMod* pMatch = NULL;
@ -178,9 +174,8 @@ Nu_ThreadMod_FindByThreadIdx(const NuRecord* pRecord, NuThreadIdx threadIdx)
/*
* Search for an "add" ThreadMod, by threadID.
*/
NuError
Nu_ThreadModAdd_FindByThreadID(const NuRecord* pRecord, NuThreadID threadID,
NuThreadMod** ppThreadMod)
NuError Nu_ThreadModAdd_FindByThreadID(const NuRecord* pRecord,
NuThreadID threadID, NuThreadMod** ppThreadMod)
{
NuThreadMod* pThreadMod;
@ -207,8 +202,7 @@ Nu_ThreadModAdd_FindByThreadID(const NuRecord* pRecord, NuThreadID threadID,
/*
* Free up the list of NuThreadMods in this record.
*/
void
Nu_FreeThreadMods(NuArchive* pArchive, NuRecord* pRecord)
void Nu_FreeThreadMods(NuArchive* pArchive, NuRecord* pRecord)
{
NuThreadMod* pThreadMod;
NuThreadMod* pNext;
@ -246,9 +240,8 @@ typedef struct {
/*
* Allocate and initialize a NuNewThreads struct.
*/
static NuError
Nu_NewThreads_New(NuArchive* pArchive, NuNewThreads** ppNewThreads,
long numThreads)
static NuError Nu_NewThreads_New(NuArchive* pArchive,
NuNewThreads** ppNewThreads, long numThreads)
{
NuError err = kNuErrNone;
@ -256,7 +249,8 @@ Nu_NewThreads_New(NuArchive* pArchive, NuNewThreads** ppNewThreads,
BailAlloc(*ppNewThreads);
(*ppNewThreads)->numThreads = numThreads;
(*ppNewThreads)->nextSlot = 0;
(*ppNewThreads)->pThreads = Nu_Malloc(pArchive, numThreads * sizeof(NuThread));
(*ppNewThreads)->pThreads =
Nu_Malloc(pArchive, numThreads * sizeof(NuThread));
BailAlloc((*ppNewThreads)->pThreads);
bail:
@ -266,8 +260,7 @@ bail:
/*
* Free a NuNewThreads struct.
*/
static void
Nu_NewThreads_Free(NuArchive* pArchive, NuNewThreads* pNewThreads)
static void Nu_NewThreads_Free(NuArchive* pArchive, NuNewThreads* pNewThreads)
{
if (pNewThreads != NULL) {
Nu_Free(pArchive, pNewThreads->pThreads);
@ -278,8 +271,7 @@ Nu_NewThreads_Free(NuArchive* pArchive, NuNewThreads* pNewThreads)
/*
* Returns true if "pNewThreads" has room for another entry, false otherwise.
*/
static Boolean
Nu_NewThreads_HasRoom(const NuNewThreads* pNewThreads)
static Boolean Nu_NewThreads_HasRoom(const NuNewThreads* pNewThreads)
{
if (pNewThreads->nextSlot < pNewThreads->numThreads)
return true;
@ -293,8 +285,8 @@ Nu_NewThreads_HasRoom(const NuNewThreads* pNewThreads)
*
* The "next slot" marker is automatically advanced.
*/
static NuThread*
Nu_NewThreads_GetNext(NuNewThreads* pNewThreads, NuArchive* pArchive)
static NuThread* Nu_NewThreads_GetNext(NuNewThreads* pNewThreads,
NuArchive* pArchive)
{
NuThread* pThread;
@ -313,8 +305,7 @@ Nu_NewThreads_GetNext(NuNewThreads* pNewThreads, NuArchive* pArchive)
/*
* Return the #of threads we're meant to hold.
*/
static int
Nu_NewThreads_GetNumThreads(const NuNewThreads* pNewThreads)
static int Nu_NewThreads_GetNumThreads(const NuNewThreads* pNewThreads)
{
Assert(pNewThreads != NULL);
@ -324,8 +315,7 @@ Nu_NewThreads_GetNumThreads(const NuNewThreads* pNewThreads)
/*
* Total up the compressed EOFs of all threads.
*/
static uint32_t
Nu_NewThreads_TotalCompThreadEOF(NuNewThreads* pNewThreads)
static uint32_t Nu_NewThreads_TotalCompThreadEOF(NuNewThreads* pNewThreads)
{
uint32_t compThreadEOF;
int i;
@ -347,8 +337,7 @@ Nu_NewThreads_TotalCompThreadEOF(NuNewThreads* pNewThreads)
* to the thread array, and then nukes our copy of the pointer. This
* allows us to transfer ownership of the storage to the caller.
*/
static NuThread*
Nu_NewThreads_DonateThreads(NuNewThreads* pNewThreads)
static NuThread* Nu_NewThreads_DonateThreads(NuNewThreads* pNewThreads)
{
NuThread* pThreads = pNewThreads->pThreads;
@ -369,8 +358,7 @@ Nu_NewThreads_DonateThreads(NuNewThreads* pNewThreads)
*
* Pass in the record from the *copy* set, not the original.
*/
static NuError
Nu_CopyArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_CopyArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err = kNuErrNone;
long offsetAdjust;
@ -414,9 +402,8 @@ bail:
*
* Returns -1 on error.
*/
static NuError
Nu_CountEventualThreads(const NuRecord* pRecord, long* pTotalThreads,
long* pFilenameThreads)
static NuError Nu_CountEventualThreads(const NuRecord* pRecord,
long* pTotalThreads, long* pFilenameThreads)
{
const NuThreadMod* pThreadMod;
const NuThread* pThread;
@ -497,8 +484,7 @@ Nu_CountEventualThreads(const NuRecord* pRecord, long* pTotalThreads,
* we ignore, are marked "used" during processing, so we don't need
* to be terribly bright here.
*/
static Boolean
Nu_VerifyAllTouched(NuArchive* pArchive, const NuRecord* pRecord)
static Boolean Nu_VerifyAllTouched(NuArchive* pArchive, const NuRecord* pRecord)
{
const NuThreadMod* pThreadMod;
const NuThread* pThread;
@ -538,8 +524,8 @@ Nu_VerifyAllTouched(NuArchive* pArchive, const NuRecord* pRecord)
*
* "newName" must be allocated storage.
*/
static void
Nu_SetNewThreadFilename(NuArchive* pArchive, NuRecord* pRecord, char* newName)
static void Nu_SetNewThreadFilename(NuArchive* pArchive, NuRecord* pRecord,
char* newName)
{
Assert(pRecord != NULL);
Assert(newName != NULL);
@ -556,8 +542,8 @@ Nu_SetNewThreadFilename(NuArchive* pArchive, NuRecord* pRecord, char* newName)
* appropriate values, we'll set them on their behalf, so long as
* the uncompressed size is a multiple of 512.
*/
static NuError
Nu_UpdateDiskImageFields(NuArchive* pArchive, NuRecord* pRecord, long sourceLen)
static NuError Nu_UpdateDiskImageFields(NuArchive* pArchive, NuRecord* pRecord,
long sourceLen)
{
NuError err = kNuErrNone;
long actualLen;
@ -599,9 +585,8 @@ Nu_UpdateDiskImageFields(NuArchive* pArchive, NuRecord* pRecord, long sourceLen)
*
* Possible side-effects on "pRecord": threadFilename may be updated.
*/
static NuError
Nu_ConstructArchiveUpdate(NuArchive* pArchive, FILE* fp, NuRecord* pRecord,
NuThread* pThread, const NuThreadMod* pThreadMod)
static NuError Nu_ConstructArchiveUpdate(NuArchive* pArchive, FILE* fp,
NuRecord* pRecord, NuThread* pThread, const NuThreadMod* pThreadMod)
{
NuError err;
NuDataSource* pDataSource = NULL;
@ -705,8 +690,7 @@ bail:
* Possible side-effects on "pRecord": disk image fields may be revised
* (storage type, extra type), and threadFilename may be updated.
*/
static NuError
Nu_HandleAddThreadMods(NuArchive* pArchive, NuRecord* pRecord,
static NuError Nu_HandleAddThreadMods(NuArchive* pArchive, NuRecord* pRecord,
NuThreadID threadID, Boolean doKeepFirstOnly, NuNewThreads* pNewThreads,
FILE* dstFp)
{
@ -911,9 +895,9 @@ bail:
*
* "pRecord" must be from the "copy" data set.
*/
static NuError
Nu_ConstructArchiveThreads(NuArchive* pArchive, NuRecord* pRecord,
NuThreadID threadID, Boolean doKeepFirstOnly, NuNewThreads* pNewThreads)
static NuError Nu_ConstructArchiveThreads(NuArchive* pArchive,
NuRecord* pRecord, NuThreadID threadID, Boolean doKeepFirstOnly,
NuNewThreads* pNewThreads)
{
NuError err = kNuErrNone;
NuThread* pThread;
@ -1056,8 +1040,7 @@ bail:
* kNuErrSkipped, which should cause the caller to simply copy the
* previous record.
*/
static NuError
Nu_ConstructArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_ConstructArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err;
NuNewThreads* pNewThreads = NULL;
@ -1261,8 +1244,8 @@ bail:
* not the entire operation, we rewind the temp file to the initial
* position and return kNuErrSkipped.
*/
static NuError
Nu_ConstructNewRecord(NuArchive* pArchive, NuRecord* pRecord, FILE* fp)
static NuError Nu_ConstructNewRecord(NuArchive* pArchive, NuRecord* pRecord,
FILE* fp)
{
NuError err;
NuNewThreads* pNewThreads = NULL;
@ -1490,8 +1473,7 @@ bail:
* The position of pArchive->archiveFp on entry and on exit is not
* defined.
*/
static NuError
Nu_UpdateRecordInOriginal(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_UpdateRecordInOriginal(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err = kNuErrNone;
NuThread* pThread;
@ -1583,8 +1565,7 @@ bail:
*
* On exit, pArchive->tmpFp will point at the archive EOF.
*/
static NuError
Nu_CreateTempFromOriginal(NuArchive* pArchive)
static NuError Nu_CreateTempFromOriginal(NuArchive* pArchive)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1671,8 +1652,7 @@ bail:
*
* On exit, pArchive->archiveFp will point at the archive EOF.
*/
static NuError
Nu_UpdateInOriginal(NuArchive* pArchive)
static NuError Nu_UpdateInOriginal(NuArchive* pArchive)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1717,8 +1697,7 @@ bail:
*
* On completion, "fp" will point at the end of the archive.
*/
static NuError
Nu_CreateNewRecords(NuArchive* pArchive, FILE* fp)
static NuError Nu_CreateNewRecords(NuArchive* pArchive, FILE* fp)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1770,8 +1749,7 @@ bail:
* At present, a "dirtyHeader" flag is not of itself cause to rebuild
* the archive, so we don't test for it here.
*/
static Boolean
Nu_NoHeavyUpdates(NuArchive* pArchive)
static Boolean Nu_NoHeavyUpdates(NuArchive* pArchive)
{
const NuRecord* pRecord;
long count;
@ -1828,8 +1806,8 @@ Nu_NoHeavyUpdates(NuArchive* pArchive)
* it from the number of threads, skipping on if the record has any
* "add" thread mods.
*/
static NuError
Nu_PurgeEmptyRecords(NuArchive* pArchive, NuRecordSet* pRecordSet)
static NuError Nu_PurgeEmptyRecords(NuArchive* pArchive,
NuRecordSet* pRecordSet)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1873,8 +1851,8 @@ bail:
* Pass in a correctly positioned "fp" and the total length of the archive
* file.
*/
static NuError
Nu_UpdateMasterHeader(NuArchive* pArchive, FILE* fp, long archiveEOF)
static NuError Nu_UpdateMasterHeader(NuArchive* pArchive, FILE* fp,
long archiveEOF)
{
NuError err;
long numRecords;
@ -1914,8 +1892,7 @@ bail:
/*
* Reset the temp file to a known (empty) state.
*/
static NuError
Nu_ResetTempFile(NuArchive* pArchive)
static NuError Nu_ResetTempFile(NuArchive* pArchive)
{
NuError err = kNuErrNone;
@ -1984,8 +1961,7 @@ bail:
* don't even exist. This is done as we are cleaning up the record sets
* after a successful (or aborted) update.
*/
static NuError
Nu_RecordResetUsedFlags(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_RecordResetUsedFlags(NuArchive* pArchive, NuRecord* pRecord)
{
NuThread* pThread;
long idx;
@ -2016,8 +1992,7 @@ Nu_RecordResetUsedFlags(NuArchive* pArchive, NuRecord* pRecord)
/*
* Invoke Nu_RecordResetUsedFlags on all records in a record set.
*/
static NuError
Nu_ResetUsedFlags(NuArchive* pArchive, NuRecordSet* pRecordSet)
static NuError Nu_ResetUsedFlags(NuArchive* pArchive, NuRecordSet* pRecordSet)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -2040,8 +2015,7 @@ Nu_ResetUsedFlags(NuArchive* pArchive, NuRecordSet* pRecordSet)
/*
* If nothing in the "copy" set has actually been disturbed, throw it out.
*/
static void
Nu_ResetCopySetIfUntouched(NuArchive* pArchive)
static void Nu_ResetCopySetIfUntouched(NuArchive* pArchive)
{
const NuRecord* pRecord;
@ -2071,8 +2045,7 @@ Nu_ResetCopySetIfUntouched(NuArchive* pArchive)
* GSHK always adds a comment to the first new record added to an archive.
* Imitate this behavior.
*/
static NuError
Nu_AddCommentToFirstNewRecord(NuArchive* pArchive)
static NuError Nu_AddCommentToFirstNewRecord(NuArchive* pArchive)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -2137,8 +2110,7 @@ bail:
* If the things this function is doing aren't making any sense at all,
* read "NOTES.txt" for an introduction.
*/
NuError
Nu_Flush(NuArchive* pArchive, long* pStatusFlags)
NuError Nu_Flush(NuArchive* pArchive, long* pStatusFlags)
{
NuError err = kNuErrNone;
Boolean canAbort = true;
@ -2555,8 +2527,7 @@ bail:
/*
* Abort any pending changes.
*/
NuError
Nu_Abort(NuArchive* pArchive)
NuError Nu_Abort(NuArchive* pArchive)
{
Assert(pArchive != NULL);

View File

@ -25,13 +25,11 @@
/*
* Alloc and free functions provided to zlib.
*/
static voidpf
Nu_zalloc(voidpf opaque, uInt items, uInt size)
static voidpf Nu_zalloc(voidpf opaque, uInt items, uInt size)
{
return Nu_Malloc(opaque, items * size);
}
static void
Nu_zfree(voidpf opaque, voidpf address)
static void Nu_zfree(voidpf opaque, voidpf address)
{
Nu_Free(opaque, address);
}
@ -46,8 +44,7 @@ Nu_zfree(voidpf opaque, voidpf address)
/*
* Compress "srcLen" bytes from "pStraw" to "fp".
*/
NuError
Nu_CompressDeflate(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressDeflate(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
NuError err = kNuErrNone;
@ -174,8 +171,7 @@ bail:
/*
* Expand from "infp" to "pFunnel".
*/
NuError
Nu_ExpandDeflate(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandDeflate(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, uint16_t* pCrc)
{
NuError err = kNuErrNone;

View File

@ -24,8 +24,7 @@
* it does not follow all sorts of crazy semaphore semantics. If you
* have the need, go ahead and fix it.
*/
static inline void
Nu_SetBusy(NuArchive* pArchive)
static inline void Nu_SetBusy(NuArchive* pArchive)
{
pArchive->busy = true;
}
@ -33,8 +32,7 @@ Nu_SetBusy(NuArchive* pArchive)
/*
* Clear the busy flag.
*/
static inline void
Nu_ClearBusy(NuArchive* pArchive)
static inline void Nu_ClearBusy(NuArchive* pArchive)
{
pArchive->busy = false;
}
@ -45,8 +43,7 @@ Nu_ClearBusy(NuArchive* pArchive)
* can be made during callback functions when the archive isn't fully
* consistent.
*/
static NuError
Nu_PartiallyValidateNuArchive(const NuArchive* pArchive)
static NuError Nu_PartiallyValidateNuArchive(const NuArchive* pArchive)
{
if (pArchive == NULL)
return kNuErrInvalidArg;
@ -61,8 +58,7 @@ Nu_PartiallyValidateNuArchive(const NuArchive* pArchive)
/*
* Validate the NuArchive* argument passed in to us.
*/
static NuError
Nu_ValidateNuArchive(const NuArchive* pArchive)
static NuError Nu_ValidateNuArchive(const NuArchive* pArchive)
{
NuError err;
@ -104,8 +100,7 @@ Nu_ValidateNuArchive(const NuArchive* pArchive)
* ===========================================================================
*/
NUFXLIB_API NuError
NuStreamOpenRO(FILE* infp, NuArchive** ppArchive)
NUFXLIB_API NuError NuStreamOpenRO(FILE* infp, NuArchive** ppArchive)
{
NuError err;
@ -117,8 +112,7 @@ NuStreamOpenRO(FILE* infp, NuArchive** ppArchive)
return err;
}
NUFXLIB_API NuError
NuContents(NuArchive* pArchive, NuCallback contentFunc)
NUFXLIB_API NuError NuContents(NuArchive* pArchive, NuCallback contentFunc)
{
NuError err;
@ -134,8 +128,7 @@ NuContents(NuArchive* pArchive, NuCallback contentFunc)
return err;
}
NUFXLIB_API NuError
NuExtract(NuArchive* pArchive)
NUFXLIB_API NuError NuExtract(NuArchive* pArchive)
{
NuError err;
@ -151,8 +144,7 @@ NuExtract(NuArchive* pArchive)
return err;
}
NUFXLIB_API NuError
NuTest(NuArchive* pArchive)
NUFXLIB_API NuError NuTest(NuArchive* pArchive)
{
NuError err;
@ -168,8 +160,7 @@ NuTest(NuArchive* pArchive)
return err;
}
NUFXLIB_API NuError
NuTestRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
NUFXLIB_API NuError NuTestRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
{
NuError err;
@ -189,8 +180,7 @@ NuTestRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
* ===========================================================================
*/
NUFXLIB_API NuError
NuOpenRO(const char* filename, NuArchive** ppArchive)
NUFXLIB_API NuError NuOpenRO(const char* filename, NuArchive** ppArchive)
{
NuError err;
@ -199,8 +189,7 @@ NuOpenRO(const char* filename, NuArchive** ppArchive)
return err;
}
NUFXLIB_API NuError
NuExtractRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
NUFXLIB_API NuError NuExtractRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
{
NuError err;
@ -213,8 +202,7 @@ NuExtractRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
return err;
}
NUFXLIB_API NuError
NuExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NUFXLIB_API NuError NuExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuDataSink* pDataSink)
{
NuError err;
@ -228,8 +216,7 @@ NuExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
return err;
}
NUFXLIB_API NuError
NuGetRecord(NuArchive* pArchive, NuRecordIdx recordIdx,
NUFXLIB_API NuError NuGetRecord(NuArchive* pArchive, NuRecordIdx recordIdx,
const NuRecord** ppRecord)
{
NuError err;
@ -243,8 +230,7 @@ NuGetRecord(NuArchive* pArchive, NuRecordIdx recordIdx,
return err;
}
NUFXLIB_API NuError
NuGetRecordIdxByName(NuArchive* pArchive, const char* name,
NUFXLIB_API NuError NuGetRecordIdxByName(NuArchive* pArchive, const char* name,
NuRecordIdx* pRecordIdx)
{
NuError err;
@ -258,8 +244,7 @@ NuGetRecordIdxByName(NuArchive* pArchive, const char* name,
return err;
}
NUFXLIB_API NuError
NuGetRecordIdxByPosition(NuArchive* pArchive, uint32_t position,
NUFXLIB_API NuError NuGetRecordIdxByPosition(NuArchive* pArchive, uint32_t position,
NuRecordIdx* pRecordIdx)
{
NuError err;
@ -280,9 +265,8 @@ NuGetRecordIdxByPosition(NuArchive* pArchive, uint32_t position,
* ===========================================================================
*/
NUFXLIB_API NuError
NuOpenRW(const char* archivePathname, const char* tmpPathname,
uint32_t flags, NuArchive** ppArchive)
NUFXLIB_API NuError NuOpenRW(const char* archivePathname,
const char* tmpPathname, uint32_t flags, NuArchive** ppArchive)
{
NuError err;
@ -292,8 +276,7 @@ NuOpenRW(const char* archivePathname, const char* tmpPathname,
return err;
}
NUFXLIB_API NuError
NuFlush(NuArchive* pArchive, long* pStatusFlags)
NUFXLIB_API NuError NuFlush(NuArchive* pArchive, long* pStatusFlags)
{
NuError err;
@ -306,8 +289,7 @@ NuFlush(NuArchive* pArchive, long* pStatusFlags)
return err;
}
NUFXLIB_API NuError
NuAbort(NuArchive* pArchive)
NUFXLIB_API NuError NuAbort(NuArchive* pArchive)
{
NuError err;
@ -320,9 +302,8 @@ NuAbort(NuArchive* pArchive)
return err;
}
NUFXLIB_API NuError
NuAddRecord(NuArchive* pArchive, const NuFileDetails* pFileDetails,
NuRecordIdx* pRecordIdx)
NUFXLIB_API NuError NuAddRecord(NuArchive* pArchive,
const NuFileDetails* pFileDetails, NuRecordIdx* pRecordIdx)
{
NuError err;
@ -335,9 +316,8 @@ NuAddRecord(NuArchive* pArchive, const NuFileDetails* pFileDetails,
return err;
}
NUFXLIB_API NuError
NuAddThread(NuArchive* pArchive, NuRecordIdx recordIdx, NuThreadID threadID,
NuDataSource* pDataSource, NuThreadIdx* pThreadIdx)
NUFXLIB_API NuError NuAddThread(NuArchive* pArchive, NuRecordIdx recordIdx,
NuThreadID threadID, NuDataSource* pDataSource, NuThreadIdx* pThreadIdx)
{
NuError err;
@ -351,8 +331,7 @@ NuAddThread(NuArchive* pArchive, NuRecordIdx recordIdx, NuThreadID threadID,
return err;
}
NUFXLIB_API NuError
NuAddFile(NuArchive* pArchive, const char* pathname,
NUFXLIB_API NuError NuAddFile(NuArchive* pArchive, const char* pathname,
const NuFileDetails* pFileDetails, short isFromRsrcFork,
NuRecordIdx* pRecordIdx)
{
@ -368,9 +347,8 @@ NuAddFile(NuArchive* pArchive, const char* pathname,
return err;
}
NUFXLIB_API NuError
NuRename(NuArchive* pArchive, NuRecordIdx recordIdx, const char* pathname,
char fssep)
NUFXLIB_API NuError NuRename(NuArchive* pArchive, NuRecordIdx recordIdx,
const char* pathname, char fssep)
{
NuError err;
@ -384,8 +362,7 @@ NuRename(NuArchive* pArchive, NuRecordIdx recordIdx, const char* pathname,
}
NUFXLIB_API NuError
NuSetRecordAttr(NuArchive* pArchive, NuRecordIdx recordIdx,
NUFXLIB_API NuError NuSetRecordAttr(NuArchive* pArchive, NuRecordIdx recordIdx,
const NuRecordAttr* pRecordAttr)
{
NuError err;
@ -399,9 +376,8 @@ NuSetRecordAttr(NuArchive* pArchive, NuRecordIdx recordIdx,
return err;
}
NUFXLIB_API NuError
NuUpdatePresizedThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuDataSource* pDataSource, long* pMaxLen)
NUFXLIB_API NuError NuUpdatePresizedThread(NuArchive* pArchive,
NuThreadIdx threadIdx, NuDataSource* pDataSource, long* pMaxLen)
{
NuError err;
@ -415,8 +391,7 @@ NuUpdatePresizedThread(NuArchive* pArchive, NuThreadIdx threadIdx,
return err;
}
NUFXLIB_API NuError
NuDelete(NuArchive* pArchive)
NUFXLIB_API NuError NuDelete(NuArchive* pArchive)
{
NuError err;
@ -429,8 +404,7 @@ NuDelete(NuArchive* pArchive)
return err;
}
NUFXLIB_API NuError
NuDeleteRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
NUFXLIB_API NuError NuDeleteRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
{
NuError err;
@ -443,8 +417,7 @@ NuDeleteRecord(NuArchive* pArchive, NuRecordIdx recordIdx)
return err;
}
NUFXLIB_API NuError
NuDeleteThread(NuArchive* pArchive, NuThreadIdx threadIdx)
NUFXLIB_API NuError NuDeleteThread(NuArchive* pArchive, NuThreadIdx threadIdx)
{
NuError err;
@ -464,8 +437,7 @@ NuDeleteThread(NuArchive* pArchive, NuThreadIdx threadIdx)
* ===========================================================================
*/
NUFXLIB_API NuError
NuClose(NuArchive* pArchive)
NUFXLIB_API NuError NuClose(NuArchive* pArchive)
{
NuError err;
@ -480,8 +452,8 @@ NuClose(NuArchive* pArchive)
return err;
}
NUFXLIB_API NuError
NuGetMasterHeader(NuArchive* pArchive, const NuMasterHeader** ppMasterHeader)
NUFXLIB_API NuError NuGetMasterHeader(NuArchive* pArchive,
const NuMasterHeader** ppMasterHeader)
{
NuError err;
@ -491,8 +463,7 @@ NuGetMasterHeader(NuArchive* pArchive, const NuMasterHeader** ppMasterHeader)
return err;
}
NUFXLIB_API NuError
NuGetExtraData(NuArchive* pArchive, void** ppData)
NUFXLIB_API NuError NuGetExtraData(NuArchive* pArchive, void** ppData)
{
NuError err;
@ -504,8 +475,7 @@ NuGetExtraData(NuArchive* pArchive, void** ppData)
return err;
}
NUFXLIB_API NuError
NuSetExtraData(NuArchive* pArchive, void* pData)
NUFXLIB_API NuError NuSetExtraData(NuArchive* pArchive, void* pData)
{
NuError err;
@ -515,8 +485,8 @@ NuSetExtraData(NuArchive* pArchive, void* pData)
return err;
}
NUFXLIB_API NuError
NuGetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue)
NUFXLIB_API NuError NuGetValue(NuArchive* pArchive, NuValueID ident,
NuValue* pValue)
{
NuError err;
@ -526,8 +496,8 @@ NuGetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue)
return err;
}
NUFXLIB_API NuError
NuSetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
NUFXLIB_API NuError NuSetValue(NuArchive* pArchive, NuValueID ident,
NuValue value)
{
NuError err;
@ -537,8 +507,8 @@ NuSetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
return err;
}
NUFXLIB_API NuError
NuGetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr)
NUFXLIB_API NuError NuGetAttr(NuArchive* pArchive, NuAttrID ident,
NuAttr* pAttr)
{
NuError err;
@ -548,8 +518,7 @@ NuGetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr)
return err;
}
NUFXLIB_API NuError
NuDebugDumpArchive(NuArchive* pArchive)
NUFXLIB_API NuError NuDebugDumpArchive(NuArchive* pArchive)
{
#if defined(DEBUG_MSGS)
/* skip validation checks for this one */
@ -568,8 +537,7 @@ NuDebugDumpArchive(NuArchive* pArchive)
* ===========================================================================
*/
NUFXLIB_API NuError
NuCreateDataSourceForFile(NuThreadFormat threadFormat,
NUFXLIB_API NuError NuCreateDataSourceForFile(NuThreadFormat threadFormat,
uint32_t otherLen, const char* pathname, short isFromRsrcFork,
NuDataSource** ppDataSource)
{
@ -577,8 +545,7 @@ NuCreateDataSourceForFile(NuThreadFormat threadFormat,
pathname, (Boolean)(isFromRsrcFork != 0), ppDataSource);
}
NUFXLIB_API NuError
NuCreateDataSourceForFP(NuThreadFormat threadFormat,
NUFXLIB_API NuError NuCreateDataSourceForFP(NuThreadFormat threadFormat,
uint32_t otherLen, FILE* fp, long offset, long length,
NuCallback fcloseFunc, NuDataSource** ppDataSource)
{
@ -586,8 +553,7 @@ NuCreateDataSourceForFP(NuThreadFormat threadFormat,
fp, offset, length, fcloseFunc, ppDataSource);
}
NUFXLIB_API NuError
NuCreateDataSourceForBuffer(NuThreadFormat threadFormat,
NUFXLIB_API NuError NuCreateDataSourceForBuffer(NuThreadFormat threadFormat,
uint32_t otherLen, const uint8_t* buffer, long offset,
long length, NuCallback freeFunc, NuDataSource** ppDataSource)
{
@ -595,14 +561,13 @@ NuCreateDataSourceForBuffer(NuThreadFormat threadFormat,
buffer, offset, length, freeFunc, ppDataSource);
}
NUFXLIB_API NuError
NuFreeDataSource(NuDataSource* pDataSource)
NUFXLIB_API NuError NuFreeDataSource(NuDataSource* pDataSource)
{
return Nu_DataSourceFree(pDataSource);
}
NUFXLIB_API NuError
NuDataSourceSetRawCrc(NuDataSource* pDataSource, uint16_t crc)
NUFXLIB_API NuError NuDataSourceSetRawCrc(NuDataSource* pDataSource,
uint16_t crc)
{
if (pDataSource == NULL)
return kNuErrInvalidArg;
@ -610,38 +575,35 @@ NuDataSourceSetRawCrc(NuDataSource* pDataSource, uint16_t crc)
return kNuErrNone;
}
NUFXLIB_API NuError
NuCreateDataSinkForFile(short doExpand, NuValue convertEOL,
NUFXLIB_API NuError NuCreateDataSinkForFile(short doExpand, NuValue convertEOL,
const char* pathname, char fssep, NuDataSink** ppDataSink)
{
return Nu_DataSinkFile_New((Boolean)(doExpand != 0), convertEOL, pathname,
fssep, ppDataSink);
}
NUFXLIB_API NuError
NuCreateDataSinkForFP(short doExpand, NuValue convertEOL, FILE* fp,
NuDataSink** ppDataSink)
NUFXLIB_API NuError NuCreateDataSinkForFP(short doExpand, NuValue convertEOL,
FILE* fp, NuDataSink** ppDataSink)
{
return Nu_DataSinkFP_New((Boolean)(doExpand != 0), convertEOL, fp,
ppDataSink);
}
NUFXLIB_API NuError
NuCreateDataSinkForBuffer(short doExpand, NuValue convertEOL,
uint8_t* buffer, uint32_t bufLen, NuDataSink** ppDataSink)
NUFXLIB_API NuError NuCreateDataSinkForBuffer(short doExpand,
NuValue convertEOL, uint8_t* buffer, uint32_t bufLen,
NuDataSink** ppDataSink)
{
return Nu_DataSinkBuffer_New((Boolean)(doExpand != 0), convertEOL, buffer,
bufLen, ppDataSink);
}
NUFXLIB_API NuError
NuFreeDataSink(NuDataSink* pDataSink)
NUFXLIB_API NuError NuFreeDataSink(NuDataSink* pDataSink)
{
return Nu_DataSinkFree(pDataSink);
}
NUFXLIB_API NuError
NuDataSinkGetOutCount(NuDataSink* pDataSink, uint32_t* pOutCount)
NUFXLIB_API NuError NuDataSinkGetOutCount(NuDataSink* pDataSink,
uint32_t* pOutCount)
{
if (pDataSink == NULL || pOutCount == NULL)
return kNuErrInvalidArg;
@ -657,22 +619,19 @@ NuDataSinkGetOutCount(NuDataSink* pDataSink, uint32_t* pOutCount)
* ===========================================================================
*/
NUFXLIB_API const char*
NuStrError(NuError err)
NUFXLIB_API const char* NuStrError(NuError err)
{
return Nu_StrError(err);
}
NUFXLIB_API NuError
NuGetVersion(long* pMajorVersion, long* pMinorVersion, long* pBugVersion,
const char** ppBuildDate, const char** ppBuildFlags)
NUFXLIB_API NuError NuGetVersion(long* pMajorVersion, long* pMinorVersion,
long* pBugVersion, const char** ppBuildDate, const char** ppBuildFlags)
{
return Nu_GetVersion(pMajorVersion, pMinorVersion, pBugVersion,
ppBuildDate, ppBuildFlags);
}
NUFXLIB_API NuError
NuTestFeature(NuFeature feature)
NUFXLIB_API NuError NuTestFeature(NuFeature feature)
{
NuError err = kNuErrUnsupFeature;
@ -710,8 +669,8 @@ NuTestFeature(NuFeature feature)
return err;
}
NUFXLIB_API void
NuRecordCopyAttr(NuRecordAttr* pRecordAttr, const NuRecord* pRecord)
NUFXLIB_API void NuRecordCopyAttr(NuRecordAttr* pRecordAttr,
const NuRecord* pRecord)
{
pRecordAttr->fileSysID = pRecord->recFileSysID;
/*pRecordAttr->fileSysInfo = pRecord->recFileSysInfo;*/
@ -723,8 +682,8 @@ NuRecordCopyAttr(NuRecordAttr* pRecordAttr, const NuRecord* pRecord)
pRecordAttr->archiveWhen = pRecord->recArchiveWhen;
}
NUFXLIB_API NuError
NuRecordCopyThreads(const NuRecord* pNuRecord, NuThread** ppThreads)
NUFXLIB_API NuError NuRecordCopyThreads(const NuRecord* pNuRecord,
NuThread** ppThreads)
{
if (pNuRecord == NULL || ppThreads == NULL)
return kNuErrInvalidArg;
@ -741,8 +700,7 @@ NuRecordCopyThreads(const NuRecord* pNuRecord, NuThread** ppThreads)
return kNuErrNone;
}
NUFXLIB_API uint32_t
NuRecordGetNumThreads(const NuRecord* pNuRecord)
NUFXLIB_API uint32_t NuRecordGetNumThreads(const NuRecord* pNuRecord)
{
if (pNuRecord == NULL)
return -1;
@ -750,16 +708,15 @@ NuRecordGetNumThreads(const NuRecord* pNuRecord)
return pNuRecord->recTotalThreads;
}
NUFXLIB_API const NuThread*
NuThreadGetByIdx(const NuThread* pNuThread, long idx)
NUFXLIB_API const NuThread* NuThreadGetByIdx(const NuThread* pNuThread,
long idx)
{
if (pNuThread == NULL)
return NULL;
return &pNuThread[idx]; /* can't range-check here */
}
NUFXLIB_API short
NuIsPresizedThreadID(NuThreadID threadID)
NUFXLIB_API short NuIsPresizedThreadID(NuThreadID threadID)
{
return Nu_IsPresizedThreadID(threadID);
}
@ -771,8 +728,8 @@ NuIsPresizedThreadID(NuThreadID threadID)
* ===========================================================================
*/
NUFXLIB_API NuCallback
NuSetSelectionFilter(NuArchive* pArchive, NuCallback filterFunc)
NUFXLIB_API NuCallback NuSetSelectionFilter(NuArchive* pArchive,
NuCallback filterFunc)
{
NuError err;
NuCallback oldFunc = kNuInvalidCallback;
@ -787,8 +744,8 @@ NuSetSelectionFilter(NuArchive* pArchive, NuCallback filterFunc)
return oldFunc;
}
NUFXLIB_API NuCallback
NuSetOutputPathnameFilter(NuArchive* pArchive, NuCallback filterFunc)
NUFXLIB_API NuCallback NuSetOutputPathnameFilter(NuArchive* pArchive,
NuCallback filterFunc)
{
NuError err;
NuCallback oldFunc = kNuInvalidCallback;
@ -803,8 +760,8 @@ NuSetOutputPathnameFilter(NuArchive* pArchive, NuCallback filterFunc)
return oldFunc;
}
NUFXLIB_API NuCallback
NuSetProgressUpdater(NuArchive* pArchive, NuCallback updateFunc)
NUFXLIB_API NuCallback NuSetProgressUpdater(NuArchive* pArchive,
NuCallback updateFunc)
{
NuError err;
NuCallback oldFunc = kNuInvalidCallback;
@ -819,8 +776,8 @@ NuSetProgressUpdater(NuArchive* pArchive, NuCallback updateFunc)
return oldFunc;
}
NUFXLIB_API NuCallback
NuSetErrorHandler(NuArchive* pArchive, NuCallback errorFunc)
NUFXLIB_API NuCallback NuSetErrorHandler(NuArchive* pArchive,
NuCallback errorFunc)
{
NuError err;
NuCallback oldFunc = kNuInvalidCallback;
@ -835,8 +792,8 @@ NuSetErrorHandler(NuArchive* pArchive, NuCallback errorFunc)
return oldFunc;
}
NUFXLIB_API NuCallback
NuSetErrorMessageHandler(NuArchive* pArchive, NuCallback messageHandlerFunc)
NUFXLIB_API NuCallback NuSetErrorMessageHandler(NuArchive* pArchive,
NuCallback messageHandlerFunc)
{
NuError err;
NuCallback oldFunc = kNuInvalidCallback;
@ -851,8 +808,7 @@ NuSetErrorMessageHandler(NuArchive* pArchive, NuCallback messageHandlerFunc)
return oldFunc;
}
NUFXLIB_API NuCallback
NuSetGlobalErrorMessageHandler(NuCallback messageHandlerFunc)
NUFXLIB_API NuCallback NuSetGlobalErrorMessageHandler(NuCallback messageHandlerFunc)
{
NuCallback oldFunc = kNuInvalidCallback;
/*Assert(!((uint32_t)messageHandlerFunc % 4));*/

View File

@ -12,9 +12,9 @@
/*
* "Expand" an uncompressed thread.
*/
static NuError
Nu_ExpandUncompressed(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, uint16_t* pCrc)
static NuError Nu_ExpandUncompressed(NuArchive* pArchive,
const NuRecord* pRecord, const NuThread* pThread, FILE* infp,
NuFunnel* pFunnel, uint16_t* pCrc)
{
NuError err;
/*uint8_t* buffer = NULL;*/
@ -63,9 +63,8 @@ bail:
* Copy the "raw" data out of the thread. Unlike the preceeding function,
* this reads up to "thCompThreadEOF", and doesn't even try to compute a CRC.
*/
static NuError
Nu_ExpandRaw(NuArchive* pArchive, const NuThread* pThread, FILE* infp,
NuFunnel* pFunnel)
static NuError Nu_ExpandRaw(NuArchive* pArchive, const NuThread* pThread,
FILE* infp, NuFunnel* pFunnel)
{
NuError err;
/*uint8_t* buffer = NULL;*/
@ -108,8 +107,7 @@ bail:
* Expand a thread from "infp" to "pFunnel", using the compression
* and stream length specified by "pThread".
*/
NuError
Nu_ExpandStream(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandStream(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel)
{
NuError err = kNuErrNone;

View File

@ -81,8 +81,7 @@
*
* If the conversion is invalid, "*pWhen" is set to zero.
*/
static void
Nu_DateTimeToGMTSeconds(const NuDateTime* pDateTime, time_t* pWhen)
static void Nu_DateTimeToGMTSeconds(const NuDateTime* pDateTime, time_t* pWhen)
{
struct tm tmbuf;
time_t when;
@ -119,8 +118,7 @@ Nu_DateTimeToGMTSeconds(const NuDateTime* pDateTime, time_t* pWhen)
/*
* Convert from GMT seconds since 1970 to local time in a NuDateTime struct.
*/
static void
Nu_GMTSecondsToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
static void Nu_GMTSecondsToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
{
struct tm* ptm;
@ -149,8 +147,7 @@ Nu_GMTSecondsToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
/*
* Fill in the current time.
*/
void
Nu_SetCurrentDateTime(NuDateTime* pDateTime)
void Nu_SetCurrentDateTime(NuDateTime* pDateTime)
{
Assert(pDateTime != NULL);
@ -173,8 +170,7 @@ Nu_SetCurrentDateTime(NuDateTime* pDateTime)
* to time in seconds, and compare them that way. However, I don't want
* to rely on that function too heavily, so we just compare fields.
*/
Boolean
Nu_IsOlder(const NuDateTime* pWhen1, const NuDateTime* pWhen2)
Boolean Nu_IsOlder(const NuDateTime* pWhen1, const NuDateTime* pWhen2)
{
long result, year1, year2;
@ -235,8 +231,7 @@ typedef struct NuFileInfo {
/*
* Determine whether the record has both data and resource forks.
*/
static Boolean
Nu_IsForkedFile(NuArchive* pArchive, const NuRecord* pRecord)
static Boolean Nu_IsForkedFile(NuArchive* pArchive, const NuRecord* pRecord)
{
const NuThread* pThread;
NuThreadID threadID;
@ -267,8 +262,7 @@ Nu_IsForkedFile(NuArchive* pArchive, const NuRecord* pRecord)
* Get the file info into a NuFileInfo struct. Fields which are
* inappropriate for the current system are set to default values.
*/
static NuError
Nu_GetFileInfo(NuArchive* pArchive, const char* pathname,
static NuError Nu_GetFileInfo(NuArchive* pArchive, const char* pathname,
NuFileInfo* pFileInfo)
{
NuError err = kNuErrNone;
@ -417,8 +411,7 @@ bail:
* file with data and resource forks, we only claim it exists if it has
* nonzero length.
*/
static NuError
Nu_FileForkExists(NuArchive* pArchive, const char* pathname,
static NuError Nu_FileForkExists(NuArchive* pArchive, const char* pathname,
Boolean isForkedFile, Boolean checkRsrcFork, Boolean* pExists,
NuFileInfo* pFileInfo)
{
@ -509,8 +502,7 @@ Nu_FileForkExists(NuArchive* pArchive, const char* pathname,
/*
* Set the dates on a file according to what's in the record.
*/
static NuError
Nu_SetFileDates(NuArchive* pArchive, const NuRecord* pRecord,
static NuError Nu_SetFileDates(NuArchive* pArchive, const NuRecord* pRecord,
const char* pathname)
{
NuError err = kNuErrNone;
@ -563,8 +555,7 @@ bail:
* possible variations. For our purposes, we treat all files as unlocked
* unless they match the classic "locked" bit pattern.
*/
static Boolean
Nu_IsRecordLocked(const NuRecord* pRecord)
static Boolean Nu_IsRecordLocked(const NuRecord* pRecord)
{
if (pRecord->recAccess == 0x21L || pRecord->recAccess == 0x01L)
return true;
@ -578,8 +569,7 @@ Nu_IsRecordLocked(const NuRecord* pRecord)
* This assumes that the file is currently writable, so we only need
* to do something if the original file was "locked".
*/
static NuError
Nu_SetFileAccess(NuArchive* pArchive, const NuRecord* pRecord,
static NuError Nu_SetFileAccess(NuArchive* pArchive, const NuRecord* pRecord,
const char* pathname)
{
NuError err = kNuErrNone;
@ -627,8 +617,7 @@ bail:
* Generally this just involves ensuring that the file is writable. If
* this is a convenient place to truncate it, we should do that too.
*/
static NuError
Nu_PrepareForWriting(NuArchive* pArchive, const char* pathname,
static NuError Nu_PrepareForWriting(NuArchive* pArchive, const char* pathname,
Boolean prepRsrc, NuFileInfo* pFileInfo)
{
NuError err = kNuErrNone;
@ -679,8 +668,7 @@ bail:
/*
* Invoke the system-dependent directory creation function.
*/
static NuError
Nu_Mkdir(NuArchive* pArchive, const char* dir)
static NuError Nu_Mkdir(NuArchive* pArchive, const char* dir)
{
NuError err = kNuErrNone;
@ -715,8 +703,7 @@ bail:
* subdirectory level doesn't exist either, cut down the pathname and
* recurse.
*/
static NuError
Nu_CreateSubdirIFN(NuArchive* pArchive, const char* pathStart,
static NuError Nu_CreateSubdirIFN(NuArchive* pArchive, const char* pathStart,
const char* pathEnd, char fssep)
{
NuError err = kNuErrNone;
@ -770,8 +757,8 @@ bail:
* If "pathname" is just a filename, or the set of directories matches
* the last directory we created, we don't do anything.
*/
static NuError
Nu_CreatePathIFN(NuArchive* pArchive, const char* pathname, char fssep)
static NuError Nu_CreatePathIFN(NuArchive* pArchive, const char* pathname,
char fssep)
{
NuError err = kNuErrNone;
const char* pathStart;
@ -828,8 +815,7 @@ bail:
/*
* Open the file for writing, possibly truncating it.
*/
static NuError
Nu_OpenFileForWrite(NuArchive* pArchive, const char* pathname,
static NuError Nu_OpenFileForWrite(NuArchive* pArchive, const char* pathname,
Boolean openRsrc, FILE** pFp)
{
#if defined(MAC_LIKE)
@ -856,8 +842,7 @@ Nu_OpenFileForWrite(NuArchive* pArchive, const char* pathname,
* "freshen" option that requires us to only update files that are
* older than what we have.
*/
NuError
Nu_OpenOutputFile(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_OpenOutputFile(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, const char* newPathname, char newFssep,
FILE** pFp)
{
@ -1104,9 +1089,8 @@ bail:
* when writing a rsrc fork to a file with just a data fork. This isn't
* quite right, but it's close enough.
*/
NuError
Nu_CloseOutputFile(NuArchive* pArchive, const NuRecord* pRecord, FILE* fp,
const char* pathname)
NuError Nu_CloseOutputFile(NuArchive* pArchive, const NuRecord* pRecord,
FILE* fp, const char* pathname)
{
NuError err;
@ -1164,8 +1148,7 @@ bail:
/*
* Open the file for reading, in "binary" mode when necessary.
*/
static NuError
Nu_OpenFileForRead(NuArchive* pArchive, const char* pathname,
static NuError Nu_OpenFileForRead(NuArchive* pArchive, const char* pathname,
Boolean openRsrc, FILE** pFp)
{
*pFp = fopen(pathname, kNuFileOpenReadOnly);
@ -1181,8 +1164,7 @@ Nu_OpenFileForRead(NuArchive* pArchive, const char* pathname,
* If the file can't be found, we give the application an opportunity to
* skip the absent file, retry, or abort the whole thing.
*/
NuError
Nu_OpenInputFile(NuArchive* pArchive, const char* pathname,
NuError Nu_OpenInputFile(NuArchive* pArchive, const char* pathname,
Boolean openRsrc, FILE** pFp)
{
NuError err = kNuErrNone;
@ -1280,8 +1262,7 @@ bail:
/*
* Delete a file.
*/
NuError
Nu_DeleteFile(const char* pathname)
NuError Nu_DeleteFile(const char* pathname)
{
#if defined(UNIX_LIKE) || defined(WINDOWS_LIKE)
int cc;
@ -1301,8 +1282,7 @@ Nu_DeleteFile(const char* pathname)
/*
* Rename a file from "fromPath" to "toPath".
*/
NuError
Nu_RenameFile(const char* fromPath, const char* toPath)
NuError Nu_RenameFile(const char* fromPath, const char* toPath)
{
#if defined(UNIX_LIKE) || defined(WINDOWS_LIKE)
int cc;
@ -1329,8 +1309,7 @@ Nu_RenameFile(const char* fromPath, const char* toPath)
/*
* Wrapper for ftell().
*/
NuError
Nu_FTell(FILE* fp, long* pOffset)
NuError Nu_FTell(FILE* fp, long* pOffset)
{
Assert(fp != NULL);
Assert(pOffset != NULL);
@ -1347,8 +1326,7 @@ Nu_FTell(FILE* fp, long* pOffset)
/*
* Wrapper for fseek().
*/
NuError
Nu_FSeek(FILE* fp, long offset, int ptrname)
NuError Nu_FSeek(FILE* fp, long offset, int ptrname)
{
Assert(fp != NULL);
Assert(ptrname == SEEK_SET || ptrname == SEEK_CUR || ptrname == SEEK_END);
@ -1366,8 +1344,7 @@ Nu_FSeek(FILE* fp, long offset, int ptrname)
* Wrapper for fread(). Note the arguments resemble read(2) rather than the
* slightly silly ones used by fread(3S).
*/
NuError
Nu_FRead(FILE* fp, void* buf, size_t nbyte)
NuError Nu_FRead(FILE* fp, void* buf, size_t nbyte)
{
size_t result;
@ -1382,8 +1359,7 @@ Nu_FRead(FILE* fp, void* buf, size_t nbyte)
* Wrapper for fwrite(). Note the arguments resemble write(2) rather than the
* slightly silly ones used by fwrite(3S).
*/
NuError
Nu_FWrite(FILE* fp, const void* buf, size_t nbyte)
NuError Nu_FWrite(FILE* fp, const void* buf, size_t nbyte)
{
size_t result;
@ -1403,8 +1379,8 @@ Nu_FWrite(FILE* fp, const void* buf, size_t nbyte)
/*
* Copy a section from one file to another.
*/
NuError
Nu_CopyFileSection(NuArchive* pArchive, FILE* dstFp, FILE* srcFp, long length)
NuError Nu_CopyFileSection(NuArchive* pArchive, FILE* dstFp, FILE* srcFp,
long length)
{
NuError err;
long readLen;
@ -1452,8 +1428,7 @@ bail:
* (pArchive is only used for BailError message reporting, so it's okay
* to call here with a NULL pointer if the archive isn't open yet.)
*/
NuError
Nu_GetFileLength(NuArchive* pArchive, FILE* fp, long* pLength)
NuError Nu_GetFileLength(NuArchive* pArchive, FILE* fp, long* pLength)
{
NuError err;
long oldpos;
@ -1482,8 +1457,7 @@ bail:
* Truncate an open file. This differs from ftruncate() in that it takes
* a FILE* instead of an fd, and the length is a long instead of off_t.
*/
NuError
Nu_TruncateOpenFile(FILE* fp, long length)
NuError Nu_TruncateOpenFile(FILE* fp, long length)
{
#if defined(HAVE_FTRUNCATE)
if (ftruncate(fileno(fp), length) < 0)

View File

@ -22,9 +22,9 @@
* The same structure will be used when expanding all threads in a given
* record.
*/
NuError
Nu_ProgressDataInit_Compress(NuArchive* pArchive, NuProgressData* pProgressData,
const NuRecord* pRecord, const char* origPathname)
NuError Nu_ProgressDataInit_Compress(NuArchive* pArchive,
NuProgressData* pProgressData, const NuRecord* pRecord,
const char* origPathname)
{
const char* cp;
@ -67,10 +67,9 @@ Nu_ProgressDataInit_Compress(NuArchive* pArchive, NuProgressData* pProgressData,
* The same structure will be used when expanding all threads in a given
* record.
*/
NuError
Nu_ProgressDataInit_Expand(NuArchive* pArchive, NuProgressData* pProgressData,
const NuRecord* pRecord, const char* newPathname, char newFssep,
NuValue convertEOL)
NuError Nu_ProgressDataInit_Expand(NuArchive* pArchive,
NuProgressData* pProgressData, const NuRecord* pRecord,
const char* newPathname, char newFssep, NuValue convertEOL)
{
const NuThread* pThreadIter;
const char* cp;
@ -126,8 +125,7 @@ Nu_ProgressDataInit_Expand(NuArchive* pArchive, NuProgressData* pProgressData,
/*
* Do the setup on a ProgressData prior to compressing a thread.
*/
NuError
Nu_ProgressDataCompressPrep(NuArchive* pArchive, NuStraw* pStraw,
NuError Nu_ProgressDataCompressPrep(NuArchive* pArchive, NuStraw* pStraw,
NuThreadFormat threadFormat, uint32_t sourceLen)
{
NuProgressData* pProgressData;
@ -151,8 +149,7 @@ Nu_ProgressDataCompressPrep(NuArchive* pArchive, NuStraw* pStraw,
*
* "pThread" is the thread being expanded.
*/
NuError
Nu_ProgressDataExpandPrep(NuArchive* pArchive, NuFunnel* pFunnel,
NuError Nu_ProgressDataExpandPrep(NuArchive* pArchive, NuFunnel* pFunnel,
const NuThread* pThread)
{
NuProgressData* pProgressData;
@ -175,8 +172,7 @@ Nu_ProgressDataExpandPrep(NuArchive* pArchive, NuFunnel* pFunnel,
/*
* Compute a completion percentage.
*/
static int
Nu_ComputePercent(uint32_t total, uint32_t progress)
static int Nu_ComputePercent(uint32_t total, uint32_t progress)
{
uint32_t perc;
@ -200,8 +196,7 @@ Nu_ComputePercent(uint32_t total, uint32_t progress)
* Send the initial progress message, before the output file is opened
* (when extracting) or the input file is opened (when adding).
*/
NuError
Nu_SendInitialProgress(NuArchive* pArchive, NuProgressData* pProgress)
NuError Nu_SendInitialProgress(NuArchive* pArchive, NuProgressData* pProgress)
{
NuResult result;
@ -234,9 +229,9 @@ Nu_SendInitialProgress(NuArchive* pArchive, NuProgressData* pProgress)
/*
* Allocate and initialize a Funnel.
*/
NuError
Nu_FunnelNew(NuArchive* pArchive, NuDataSink* pDataSink, NuValue convertEOL,
NuValue convertEOLTo, NuProgressData* pProgress, NuFunnel** ppFunnel)
NuError Nu_FunnelNew(NuArchive* pArchive, NuDataSink* pDataSink,
NuValue convertEOL, NuValue convertEOLTo, NuProgressData* pProgress,
NuFunnel** ppFunnel)
{
NuError err = kNuErrNone;
NuFunnel* pFunnel = NULL;
@ -278,8 +273,7 @@ bail:
* The data should already have been written; it's not the duty of a
* "free" function to flush data out.
*/
NuError
Nu_FunnelFree(NuArchive* pArchive, NuFunnel* pFunnel)
NuError Nu_FunnelFree(NuArchive* pArchive, NuFunnel* pFunnel)
{
if (pFunnel == NULL)
return kNuErrNone;
@ -304,8 +298,7 @@ Nu_FunnelFree(NuArchive* pArchive, NuFunnel* pFunnel)
* allows us to bail out as soon as it's apparent that compression is
* failing and is actually resulting in a larger file.
*/
void
Nu_FunnelSetMaxOutput(NuFunnel* pFunnel, uint32_t maxBytes)
void Nu_FunnelSetMaxOutput(NuFunnel* pFunnel, uint32_t maxBytes)
{
Assert(pFunnel != NULL);
Assert(maxBytes > 0);
@ -324,8 +317,7 @@ Nu_FunnelSetMaxOutput(NuFunnel* pFunnel, uint32_t maxBytes)
* character must have its high bit set, except for spaces (0x20).
* (The exception is courtesy Glen Bredon's "Merlin".)
*/
static Boolean
Nu_CheckHighASCII(const NuFunnel* pFunnel, const uint8_t* buffer,
static Boolean Nu_CheckHighASCII(const NuFunnel* pFunnel, const uint8_t* buffer,
uint32_t count)
{
Boolean isHighASCII;
@ -405,8 +397,8 @@ static const char gNuIsBinary[256] = {
* Returns kConvEOLOff or kConvEOLOn, and sets pFunnel->doStripHighASCII
* if pFunnel->CheckStripHighASCII is set.
*/
static NuValue
Nu_DetermineConversion(NuFunnel* pFunnel, const uint8_t* buffer, uint32_t count)
static NuValue Nu_DetermineConversion(NuFunnel* pFunnel, const uint8_t* buffer,
uint32_t count)
{
uint32_t bufCount, numBinary, numLF, numCR;
Boolean isHighASCII;
@ -484,8 +476,8 @@ Nu_DetermineConversion(NuFunnel* pFunnel, const uint8_t* buffer, uint32_t count)
* This is either a Funnel function or a DataSink function, depending on
* your perspective.
*/
static inline void
Nu_FunnelPutBlock(NuFunnel* pFunnel, const uint8_t* buf, uint32_t len)
static inline void Nu_FunnelPutBlock(NuFunnel* pFunnel, const uint8_t* buf,
uint32_t len)
{
Assert(pFunnel != NULL);
Assert(pFunnel->pDataSink != NULL);
@ -511,8 +503,7 @@ Nu_FunnelPutBlock(NuFunnel* pFunnel, const uint8_t* buf, uint32_t len)
/*
* Output the EOL marker requested for this system.
*/
static inline void
Nu_PutEOL(NuFunnel* pFunnel)
static inline void Nu_PutEOL(NuFunnel* pFunnel)
{
uint8_t ch;
@ -540,8 +531,8 @@ Nu_PutEOL(NuFunnel* pFunnel)
* that looks like an EOL mark and convert it. Doesn't matter if it's
* CR, LF, or CRLF; all three get converted to whatever the system uses.
*/
static NuError
Nu_FunnelWriteConvert(NuFunnel* pFunnel, const uint8_t* buffer, uint32_t count)
static NuError Nu_FunnelWriteConvert(NuFunnel* pFunnel, const uint8_t* buffer,
uint32_t count)
{
NuError err = kNuErrNone;
uint32_t progressCount = count;
@ -637,8 +628,7 @@ Nu_FunnelWriteConvert(NuFunnel* pFunnel, const uint8_t* buffer, uint32_t count)
/*
* Flush any data currently in the funnel.
*/
NuError
Nu_FunnelFlush(NuArchive* pArchive, NuFunnel* pFunnel)
NuError Nu_FunnelFlush(NuArchive* pArchive, NuFunnel* pFunnel)
{
NuError err = kNuErrNone;
@ -661,9 +651,8 @@ bail:
* Write a bunch of bytes into a funnel. They will be held in the buffer
* if they fit, or flushed out the bottom if not.
*/
NuError
Nu_FunnelWrite(NuArchive* pArchive, NuFunnel* pFunnel, const uint8_t* buffer,
uint32_t count)
NuError Nu_FunnelWrite(NuArchive* pArchive, NuFunnel* pFunnel,
const uint8_t* buffer, uint32_t count)
{
NuError err = kNuErrNone;
@ -714,8 +703,7 @@ bail:
/*
* Set the Funnel's progress state.
*/
NuError
Nu_FunnelSetProgressState(NuFunnel* pFunnel, NuProgressState state)
NuError Nu_FunnelSetProgressState(NuFunnel* pFunnel, NuProgressState state)
{
Assert(pFunnel != NULL);
@ -731,8 +719,7 @@ Nu_FunnelSetProgressState(NuFunnel* pFunnel, NuProgressState state)
/*
* Send a progress update to the application, if they're interested.
*/
NuError
Nu_FunnelSendProgressUpdate(NuArchive* pArchive, NuFunnel* pFunnel)
NuError Nu_FunnelSendProgressUpdate(NuArchive* pArchive, NuFunnel* pFunnel)
{
NuProgressData* pProgress;
@ -755,8 +742,7 @@ Nu_FunnelSendProgressUpdate(NuArchive* pArchive, NuFunnel* pFunnel)
/*
* Pull the "doExpand" parameter out of the data source.
*/
Boolean
Nu_FunnelGetDoExpand(NuFunnel* pFunnel)
Boolean Nu_FunnelGetDoExpand(NuFunnel* pFunnel)
{
Assert(pFunnel != NULL);
Assert(pFunnel->pDataSink != NULL);
@ -774,8 +760,7 @@ Nu_FunnelGetDoExpand(NuFunnel* pFunnel)
/*
* Allocate and initialize a Straw.
*/
NuError
Nu_StrawNew(NuArchive* pArchive, NuDataSource* pDataSource,
NuError Nu_StrawNew(NuArchive* pArchive, NuDataSource* pDataSource,
NuProgressData* pProgress, NuStraw** ppStraw)
{
NuError err = kNuErrNone;
@ -802,8 +787,7 @@ bail:
/*
* Free a Straw.
*/
NuError
Nu_StrawFree(NuArchive* pArchive, NuStraw* pStraw)
NuError Nu_StrawFree(NuArchive* pArchive, NuStraw* pStraw)
{
if (pStraw == NULL)
return kNuErrNone;
@ -818,8 +802,7 @@ Nu_StrawFree(NuArchive* pArchive, NuStraw* pStraw)
/*
* Set the Straw's progress state.
*/
NuError
Nu_StrawSetProgressState(NuStraw* pStraw, NuProgressState state)
NuError Nu_StrawSetProgressState(NuStraw* pStraw, NuProgressState state)
{
Assert(pStraw != NULL);
Assert(pStraw->pProgress != NULL);
@ -832,8 +815,7 @@ Nu_StrawSetProgressState(NuStraw* pStraw, NuProgressState state)
/*
* Send a progress update to the application, if they're interested.
*/
NuError
Nu_StrawSendProgressUpdate(NuArchive* pArchive, NuStraw* pStraw)
NuError Nu_StrawSendProgressUpdate(NuArchive* pArchive, NuStraw* pStraw)
{
NuProgressData* pProgress;
@ -856,8 +838,8 @@ Nu_StrawSendProgressUpdate(NuArchive* pArchive, NuStraw* pStraw)
/*
* Read data from a straw.
*/
NuError
Nu_StrawRead(NuArchive* pArchive, NuStraw* pStraw, uint8_t* buffer, long len)
NuError Nu_StrawRead(NuArchive* pArchive, NuStraw* pStraw, uint8_t* buffer,
long len)
{
NuError err;
@ -911,8 +893,7 @@ bail:
* Rewind a straw. This rewinds the underlying data source, and resets
* some progress counters.
*/
NuError
Nu_StrawRewind(NuArchive* pArchive, NuStraw* pStraw)
NuError Nu_StrawRewind(NuArchive* pArchive, NuStraw* pStraw)
{
Assert(pStraw != NULL);
Assert(pStraw->pDataSource != NULL);

View File

@ -300,8 +300,8 @@ static CONST INTCODE gNu_mc[] = {
#endif
static int
Nu_LZC_alloc_tables(LZCState* pLzcState, INTCODE newmaxcode, HASH newhashsize)
static int Nu_LZC_alloc_tables(LZCState* pLzcState, INTCODE newmaxcode,
HASH newhashsize)
{
NuArchive* pArchive = pLzcState->pArchive;
/*static INTCODE oldmaxcode = 0;*/
@ -421,8 +421,7 @@ Nu_LZC_alloc_tables(LZCState* pLzcState, INTCODE newmaxcode, HASH newhashsize)
* ===========================================================================
*/
static void
Nu_prratio(long int num, long int den)
static void Nu_prratio(long int num, long int den)
{
register int q; /* Doesn't need to be long */
@ -443,8 +442,7 @@ Nu_prratio(long int num, long int den)
/* table clear for block compress */
/* this is for adaptive reset present in version 4.0 joe release */
/* DjG, sets it up and returns TRUE to compress and FALSE to not compress */
static int
Nu_LZC_cl_block(LZCState* pLzcState)
static int Nu_LZC_cl_block(LZCState* pLzcState)
{
register long int rat;
@ -486,8 +484,7 @@ Nu_LZC_cl_block(LZCState* pLzcState)
static CONST UCHAR gNu_rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
static void
Nu_LZC_putcode(LZCState* pLzcState, INTCODE code, register int bits)
static void Nu_LZC_putcode(LZCState* pLzcState, INTCODE code, register int bits)
{
/*static int oldbits = 0;*/
/*static UCHAR outbuf[MAXBITS];*/
@ -554,8 +551,7 @@ Nu_LZC_putcode(LZCState* pLzcState, INTCODE code, register int bits)
*
* Returns kNuLZCEOF as the value when we're out of data.
*/
static NuError
Nu_LZCGetcCRC(LZCState* pLzcState, int* pSym)
static NuError Nu_LZCGetcCRC(LZCState* pLzcState, int* pSym)
{
NuError err;
uint8_t c;
@ -579,8 +575,7 @@ Nu_LZCGetcCRC(LZCState* pLzcState, int* pSym)
/*
* compress stdin to stdout
*/
static void
Nu_LZC_compress(LZCState* pLzcState, uint32_t* pDstLen)
static void Nu_LZC_compress(LZCState* pLzcState, uint32_t* pDstLen)
{
int c,adjbits;
register HASH hash;
@ -758,8 +753,7 @@ Nu_LZC_compress(LZCState* pLzcState, uint32_t* pDstLen)
/*
* NufxLib interface to LZC compression.
*/
static NuError
Nu_CompressLZC(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
static NuError Nu_CompressLZC(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc, int maxbits)
{
NuError err = kNuErrNone;
@ -806,15 +800,13 @@ Nu_CompressLZC(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
return err;
}
NuError
Nu_CompressLZC12(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressLZC12(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
return Nu_CompressLZC(pArchive, pStraw, fp, srcLen, pDstLen, pCrc, 12);
}
NuError
Nu_CompressLZC16(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressLZC16(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
return Nu_CompressLZC(pArchive, pStraw, fp, srcLen, pDstLen, pCrc, 16);
@ -833,8 +825,7 @@ Nu_CompressLZC16(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
*
* Returns kNuLZCEOF as the value when we're out of data.
*/
static NuError
Nu_LZCPutcCRC(LZCState* pLzcState, char c)
static NuError Nu_LZCPutcCRC(LZCState* pLzcState, char c)
{
NuError err;
@ -847,8 +838,7 @@ Nu_LZCPutcCRC(LZCState* pLzcState, char c)
}
static int
Nu_LZC_nextcode(LZCState* pLzcState, INTCODE* codeptr)
static int Nu_LZC_nextcode(LZCState* pLzcState, INTCODE* codeptr)
/* Get the next code from input and put it in *codeptr.
* Return (TRUE) on success, or return (FALSE) on end-of-file.
* Adapted from COMPRESS V4.0.
@ -898,8 +888,7 @@ Nu_LZC_nextcode(LZCState* pLzcState, INTCODE* codeptr)
return (TRUE);
}
static void
Nu_LZC_decompress(LZCState* pLzcState, uint32_t compressedLen)
static void Nu_LZC_decompress(LZCState* pLzcState, uint32_t compressedLen)
{
NuArchive* pArchive = pLzcState->pArchive;
register int i;
@ -1060,8 +1049,7 @@ Nu_LZC_decompress(LZCState* pLzcState, uint32_t compressedLen)
/*
* NufxLib interface to LZC expansion.
*/
NuError
Nu_ExpandLZC(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandLZC(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, uint16_t* pCrc)
{
NuError err = kNuErrNone;

View File

@ -146,8 +146,7 @@ typedef struct LZWCompressState {
* the hash function. This way we don't have to re-create it for
* every file, or store it statically in the binary.
*/
static NuError
Nu_AllocLZWCompressState(NuArchive* pArchive)
static NuError Nu_AllocLZWCompressState(NuArchive* pArchive)
{
NuError err;
LZWCompressState* lzwState;
@ -191,8 +190,7 @@ Nu_AllocLZWCompressState(NuArchive* pArchive)
* The RLE format is "<delim> <char> <count>", where count is zero-based
* (i.e. for three bytes we encode "2", allowing us to express 1-256).
*/
static NuError
Nu_CompressBlockRLE(LZWCompressState* lzwState, int* pRLESize)
static NuError Nu_CompressBlockRLE(LZWCompressState* lzwState, int* pRLESize)
{
const uint8_t* inPtr = lzwState->inputBuf;
const uint8_t* endPtr = inPtr + kNuLZWBlockSize;
@ -258,8 +256,7 @@ Nu_CompressBlockRLE(LZWCompressState* lzwState, int* pRLESize)
/*
* Clear the LZW table. Also resets the LZW/2 state.
*/
static void
Nu_ClearLZWTable(LZWCompressState* lzwState)
static void Nu_ClearLZWTable(LZWCompressState* lzwState)
{
Assert(lzwState != NULL);
@ -296,8 +293,8 @@ Nu_ClearLZWTable(LZWCompressState* lzwState)
*
* (Turning this into a macro might speed things up.)
*/
static inline void
Nu_LZWPutCode(uint8_t** pOutBuf, uint32_t prefixCode, int codeBits, int* pAtBit)
static inline void Nu_LZWPutCode(uint8_t** pOutBuf, uint32_t prefixCode,
int codeBits, int* pAtBit)
{
int atBit = *pAtBit;
uint8_t* outBuf = *pOutBuf;
@ -353,9 +350,8 @@ Nu_LZWPutCode(uint8_t** pOutBuf, uint32_t prefixCode, int codeBits, int* pAtBit)
* "resetFix" logic in the expansion functions. Code 0x0101 is essentially
* lost in this situation.
*/
static NuError
Nu_CompressLZWBlock(LZWCompressState* lzwState, const uint8_t* inputBuf,
int inputCount, int* pOutputCount)
static NuError Nu_CompressLZWBlock(LZWCompressState* lzwState,
const uint8_t* inputBuf, int inputCount, int* pOutputCount)
{
int nextFree, ic, atBit, codeBits;
int hash, hashDelta;
@ -555,8 +551,7 @@ Nu_CompressLZWBlock(LZWCompressState* lzwState, const uint8_t* inputBuf,
*
* On exit, the output file will be positioned past the last byte written.
*/
static NuError
Nu_CompressLZW(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
static NuError Nu_CompressLZW(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pThreadCrc, Boolean isType2)
{
NuError err = kNuErrNone;
@ -782,8 +777,7 @@ bail:
/*
* Compress ShrinkIt-style "LZW/1".
*/
NuError
Nu_CompressLZW1(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressLZW1(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
return Nu_CompressLZW(pArchive, pStraw, fp, srcLen, pDstLen, pCrc, false);
@ -792,8 +786,7 @@ Nu_CompressLZW1(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
/*
* Compress ShrinkIt-style "LZW/2".
*/
NuError
Nu_CompressLZW2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressLZW2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
return Nu_CompressLZW(pArchive, pStraw, fp, srcLen, pDstLen, pCrc, true);
@ -865,8 +858,7 @@ typedef struct LZWExpandState {
/*
* Allocate some "reusable" state for LZW expansion.
*/
static NuError
Nu_AllocLZWExpandState(NuArchive* pArchive)
static NuError Nu_AllocLZWExpandState(NuArchive* pArchive)
{
NuError err;
@ -897,8 +889,7 @@ Nu_AllocLZWExpandState(NuArchive* pArchive)
( Nu_LZWPopCheck(lzwState, stackPtr), *(--stackPtr) )
# define Nu_LZWStackEmpty() ( stackPtr == lzwState->stack )
static inline void
Nu_LZWPushCheck(uint8_t uch, const LZWExpandState* lzwState,
static inline void Nu_LZWPushCheck(uint8_t uch, const LZWExpandState* lzwState,
const uint8_t* stackPtr)
{
if (stackPtr >= lzwState->stack + sizeof(lzwState->stack)) {
@ -907,8 +898,8 @@ Nu_LZWPushCheck(uint8_t uch, const LZWExpandState* lzwState,
}
}
static inline void
Nu_LZWPopCheck(const LZWExpandState* lzwState, const uint8_t* stackPtr)
static inline void Nu_LZWPopCheck(const LZWExpandState* lzwState,
const uint8_t* stackPtr)
{
if (stackPtr == lzwState->stack) {
Nu_ReportError(lzwState->NU_BLOB, kNuErrBadData, "stack underflow");
@ -929,8 +920,8 @@ Nu_LZWPopCheck(const LZWExpandState* lzwState, const uint8_t* stackPtr)
*
* (Turning this into a macro might speed things up.)
*/
static inline uint
Nu_LZWGetCode(const uint8_t** pInBuf, uint32_t entry, int* pAtBit, uint* pLastByte)
static inline uint Nu_LZWGetCode(const uint8_t** pInBuf, uint32_t entry,
int* pAtBit, uint* pLastByte)
{
uint32_t numBits, startBit, lastBit;
uint32_t value;
@ -977,8 +968,7 @@ Nu_LZWGetCode(const uint8_t** pInBuf, uint32_t entry, int* pAtBit, uint* pLastBy
*
* Reads from lzwState->dataPtr, writes to lzwState->lzwOutBuf.
*/
static NuError
Nu_ExpandLZW1(LZWExpandState* lzwState, uint32_t expectedLen)
static NuError Nu_ExpandLZW1(LZWExpandState* lzwState, uint32_t expectedLen)
{
NuError err = kNuErrNone;
TableEntry* tablePtr;
@ -1077,8 +1067,7 @@ bail:
* In some cases, "expectedInputUsed" will be -1 to indicate that the
* value is not known.
*/
static NuError
Nu_ExpandLZW2(LZWExpandState* lzwState, uint32_t expectedLen,
static NuError Nu_ExpandLZW2(LZWExpandState* lzwState, uint32_t expectedLen,
uint32_t expectedInputUsed)
{
NuError err = kNuErrNone;
@ -1230,8 +1219,7 @@ bail:
/*
* Expands a chunk of RLEd data into 4K of output.
*/
static NuError
Nu_ExpandRLE(LZWExpandState* lzwState, const uint8_t* inbuf,
static NuError Nu_ExpandRLE(LZWExpandState* lzwState, const uint8_t* inbuf,
uint32_t expectedInputUsed)
{
NuError err = kNuErrNone;
@ -1284,8 +1272,7 @@ bail:
/*
* Utility function to get a byte from the input buffer.
*/
static inline uint8_t
Nu_GetHeaderByte(LZWExpandState* lzwState)
static inline uint8_t Nu_GetHeaderByte(LZWExpandState* lzwState)
{
lzwState->dataInBuffer--;
Assert(lzwState->dataInBuffer > 0);
@ -1302,8 +1289,7 @@ Nu_GetHeaderByte(LZWExpandState* lzwState)
* "*pThreadCrc" should already be set to its initial value. On exit it
* will contain the CRC of the uncompressed data.
*/
NuError
Nu_ExpandLZW(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandLZW(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel,
uint16_t* pThreadCrc)
{

View File

@ -16,8 +16,7 @@
* Return a pointer to the appropriate string in the system table, or NULL
* if the value is out of bounds.
*/
const char*
Nu_strerror(int errnum)
const char* Nu_strerror(int errnum)
{
extern int sys_nerr;
extern char *sys_errlist[];
@ -38,8 +37,7 @@ Nu_strerror(int errnum)
* from BSD, is available in the PGP 2.6.2 distribution, but this should
* suffice for those few systems that don't have memmove.
*/
void*
Nu_memmove(void* dst, const void* src, size_t n)
void* Nu_memmove(void* dst, const void* src, size_t n)
{
void* retval = dst;
char* srcp = (char*)src;
@ -80,8 +78,7 @@ Nu_memmove(void* dst, const void* src, size_t n)
* For our purposes here, strtol does all we need it to. Someday
* we should replace this with a "real" version.
*/
unsigned long
Nu_strtoul(const char *nptr, char **endptr, int base)
unsigned long Nu_strtoul(const char *nptr, char **endptr, int base)
{
return strtol(nptr, endptr, base);
}
@ -91,8 +88,7 @@ Nu_strtoul(const char *nptr, char **endptr, int base)
/*
* Compare two strings, case-insensitive.
*/
int
Nu_strcasecmp(const char *str1, const char *str2)
int Nu_strcasecmp(const char *str1, const char *str2)
{
while (*str1 && *str2 && toupper(*str1) == toupper(*str2))
str1++, str2++;
@ -105,8 +101,7 @@ Nu_strcasecmp(const char *str1, const char *str2)
/*
* Compare two strings, case-insensitive, stopping after "n" chars.
*/
int
Nu_strncasecmp(const char *str1, const char *str2, size_t n)
int Nu_strncasecmp(const char *str1, const char *str2, size_t n)
{
while (n && *str1 && *str2 && toupper(*str1) == toupper(*str2))
str1++, str2++, n--;

View File

@ -21,8 +21,7 @@ static const char* kNufxLibName = "nufxlib";
/*
* strerror() equivalent for NufxLib errors.
*/
const char*
Nu_StrError(NuError err)
const char* Nu_StrError(NuError err)
{
/*
* BUG: this should be set up as per-thread storage in an MT environment.
@ -206,8 +205,7 @@ Nu_StrError(NuError err)
* if the archive is inaccessible (perhaps because it failed to open). We
* can't invoke the error message callback if the pointer is NULL.
*/
void
Nu_ReportError(NuArchive* pArchive, const char* file, int line,
void Nu_ReportError(NuArchive* pArchive, const char* file, int line,
const char* function, Boolean isDebug, NuError err, const char* format, ...)
{
NuErrorMessage errorMessage;
@ -322,8 +320,7 @@ bail:
*/
#ifndef USE_DMALLOC
void*
Nu_Malloc(NuArchive* pArchive, size_t size)
void* Nu_Malloc(NuArchive* pArchive, size_t size)
{
void* _result;
@ -338,16 +335,14 @@ Nu_Malloc(NuArchive* pArchive, size_t size)
return _result;
}
void*
Nu_Calloc(NuArchive* pArchive, size_t size)
void* Nu_Calloc(NuArchive* pArchive, size_t size)
{
void* _cresult = Nu_Malloc(pArchive, size);
memset(_cresult, 0, size);
return _cresult;
}
void*
Nu_Realloc(NuArchive* pArchive, void* ptr, size_t size)
void* Nu_Realloc(NuArchive* pArchive, void* ptr, size_t size)
{
void* _result;
@ -362,8 +357,7 @@ Nu_Realloc(NuArchive* pArchive, void* ptr, size_t size)
return _result;
}
void
Nu_Free(NuArchive* pArchive, void* ptr)
void Nu_Free(NuArchive* pArchive, void* ptr)
{
if (ptr != NULL)
free(ptr);
@ -374,8 +368,7 @@ Nu_Free(NuArchive* pArchive, void* ptr)
* If somebody internal wants to set doClose on a buffer DataSource
* (looks like "Rename" does), we need to supply a "free" callback.
*/
NuResult
Nu_InternalFreeCallback(NuArchive* pArchive, void* args)
NuResult Nu_InternalFreeCallback(NuArchive* pArchive, void* args)
{
DBUG(("+++ internal free callback 0x%08lx\n", (long) args));
Nu_Free(NULL, args);

View File

@ -26,8 +26,7 @@ static const uint8_t kNufxID[kNufxIDLen] = { 0x4e, 0xf5, 0x46, 0xd8 };
* things that a Nu_FreeRecordContents call will check, so that we don't
* end up trying to free garbage. No need to memset() the whole thing.
*/
static NuError
Nu_InitRecordContents(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_InitRecordContents(NuArchive* pArchive, NuRecord* pRecord)
{
Assert(pRecord != NULL);
@ -51,8 +50,7 @@ Nu_InitRecordContents(NuArchive* pArchive, NuRecord* pRecord)
/*
* Allocate and initialize a new NuRecord struct.
*/
static NuError
Nu_RecordNew(NuArchive* pArchive, NuRecord** ppRecord)
static NuError Nu_RecordNew(NuArchive* pArchive, NuRecord** ppRecord)
{
Assert(ppRecord != NULL);
@ -67,8 +65,7 @@ Nu_RecordNew(NuArchive* pArchive, NuRecord** ppRecord)
* Free anything allocated within a record. Doesn't try to free the record
* itself.
*/
static NuError
Nu_FreeRecordContents(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_FreeRecordContents(NuArchive* pArchive, NuRecord* pRecord)
{
Assert(pRecord != NULL);
@ -89,8 +86,7 @@ Nu_FreeRecordContents(NuArchive* pArchive, NuRecord* pRecord)
/*
* Free up a NuRecord struct.
*/
static NuError
Nu_RecordFree(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_RecordFree(NuArchive* pArchive, NuRecord* pRecord)
{
if (pRecord == NULL)
return kNuErrNone;
@ -105,8 +101,8 @@ Nu_RecordFree(NuArchive* pArchive, NuRecord* pRecord)
* Copy a field comprised of a buffer and a length from one structure to
* another. It is assumed that the length value has already been copied.
*/
static NuError
CopySizedField(NuArchive* pArchive, void* vppDst, const void* vpSrc, uint32_t len)
static NuError CopySizedField(NuArchive* pArchive, void* vppDst,
const void* vpSrc, uint32_t len)
{
NuError err = kNuErrNone;
uint8_t** ppDst = vppDst;
@ -131,8 +127,8 @@ bail:
/*
* Make a copy of a record.
*/
static NuError
Nu_RecordCopy(NuArchive* pArchive, NuRecord** ppDst, const NuRecord* pSrc)
static NuError Nu_RecordCopy(NuArchive* pArchive, NuRecord** ppDst,
const NuRecord* pSrc)
{
NuError err;
NuRecord* pDst;
@ -189,8 +185,7 @@ bail:
* acceptable. We could do simple optimizations, like only preserving
* ordering for "add" threadMods, but even that seems silly.
*/
void
Nu_RecordAddThreadMod(NuRecord* pRecord, NuThreadMod* pThreadMod)
void Nu_RecordAddThreadMod(NuRecord* pRecord, NuThreadMod* pThreadMod)
{
NuThreadMod* pScanThreadMod;
@ -224,8 +219,7 @@ Nu_RecordAddThreadMod(NuRecord* pRecord, NuThreadMod* pThreadMod)
* threads, subtract the number of deletes, and return "true" if the net
* result is zero.
*/
Boolean
Nu_RecordIsEmpty(NuArchive* pArchive, const NuRecord* pRecord)
Boolean Nu_RecordIsEmpty(NuArchive* pArchive, const NuRecord* pRecord)
{
const NuThreadMod* pThreadMod;
int numThreads;
@ -275,51 +269,43 @@ Nu_RecordIsEmpty(NuArchive* pArchive, const NuRecord* pRecord)
* Trivial getters and setters
*/
Boolean
Nu_RecordSet_GetLoaded(const NuRecordSet* pRecordSet)
Boolean Nu_RecordSet_GetLoaded(const NuRecordSet* pRecordSet)
{
Assert(pRecordSet != NULL);
return pRecordSet->loaded;
}
void
Nu_RecordSet_SetLoaded(NuRecordSet* pRecordSet, Boolean val)
void Nu_RecordSet_SetLoaded(NuRecordSet* pRecordSet, Boolean val)
{
pRecordSet->loaded = val;
}
uint32_t
Nu_RecordSet_GetNumRecords(const NuRecordSet* pRecordSet)
uint32_t Nu_RecordSet_GetNumRecords(const NuRecordSet* pRecordSet)
{
return pRecordSet->numRecords;
}
void
Nu_RecordSet_SetNumRecords(NuRecordSet* pRecordSet, uint32_t val)
void Nu_RecordSet_SetNumRecords(NuRecordSet* pRecordSet, uint32_t val)
{
pRecordSet->numRecords = val;
}
void
Nu_RecordSet_IncNumRecords(NuRecordSet* pRecordSet)
void Nu_RecordSet_IncNumRecords(NuRecordSet* pRecordSet)
{
pRecordSet->numRecords++;
}
NuRecord*
Nu_RecordSet_GetListHead(const NuRecordSet* pRecordSet)
NuRecord* Nu_RecordSet_GetListHead(const NuRecordSet* pRecordSet)
{
return pRecordSet->nuRecordHead;
}
NuRecord**
Nu_RecordSet_GetListHeadPtr(NuRecordSet* pRecordSet)
NuRecord** Nu_RecordSet_GetListHeadPtr(NuRecordSet* pRecordSet)
{
return &pRecordSet->nuRecordHead;
}
NuRecord*
Nu_RecordSet_GetListTail(const NuRecordSet* pRecordSet)
NuRecord* Nu_RecordSet_GetListTail(const NuRecordSet* pRecordSet)
{
return pRecordSet->nuRecordTail;
}
@ -329,8 +315,7 @@ Nu_RecordSet_GetListTail(const NuRecordSet* pRecordSet)
* Returns "true" if the record set has no records or hasn't ever been
* used.
*/
Boolean
Nu_RecordSet_IsEmpty(const NuRecordSet* pRecordSet)
Boolean Nu_RecordSet_IsEmpty(const NuRecordSet* pRecordSet)
{
if (!pRecordSet->loaded || pRecordSet->numRecords == 0)
return true;
@ -341,8 +326,8 @@ Nu_RecordSet_IsEmpty(const NuRecordSet* pRecordSet)
/*
* Free the list of records, and reset the record sets to initial state.
*/
NuError
Nu_RecordSet_FreeAllRecords(NuArchive* pArchive, NuRecordSet* pRecordSet)
NuError Nu_RecordSet_FreeAllRecords(NuArchive* pArchive,
NuRecordSet* pRecordSet)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -378,8 +363,8 @@ bail:
/*
* Add a new record to the end of the list.
*/
static NuError
Nu_RecordSet_AddRecord(NuRecordSet* pRecordSet, NuRecord* pRecord)
static NuError Nu_RecordSet_AddRecord(NuRecordSet* pRecordSet,
NuRecord* pRecord)
{
Assert(pRecordSet != NULL);
Assert(pRecord != NULL);
@ -413,9 +398,8 @@ Nu_RecordSet_AddRecord(NuRecordSet* pRecordSet, NuRecord* pRecord)
* (Should have a "heavy assert" mode where we verify that "ppRecord"
* actually has something to do with pRecordSet.)
*/
NuError
Nu_RecordSet_DeleteRecordPtr(NuArchive* pArchive, NuRecordSet* pRecordSet,
NuRecord** ppRecord)
NuError Nu_RecordSet_DeleteRecordPtr(NuArchive* pArchive,
NuRecordSet* pRecordSet, NuRecord** ppRecord)
{
NuError err;
NuRecord* pRecord;
@ -456,8 +440,7 @@ Nu_RecordSet_DeleteRecordPtr(NuArchive* pArchive, NuRecordSet* pRecordSet,
/*
* Delete a record from the record set.
*/
NuError
Nu_RecordSet_DeleteRecord(NuArchive* pArchive, NuRecordSet* pRecordSet,
NuError Nu_RecordSet_DeleteRecord(NuArchive* pArchive, NuRecordSet* pRecordSet,
NuRecord* pRecord)
{
NuError err;
@ -490,8 +473,7 @@ bail:
* Make a clone of a record set. This is used to create the "copy" record
* set out of the "orig" set.
*/
NuError
Nu_RecordSet_Clone(NuArchive* pArchive, NuRecordSet* pDstSet,
NuError Nu_RecordSet_Clone(NuArchive* pArchive, NuRecordSet* pDstSet,
const NuRecordSet* pSrcSet)
{
NuError err = kNuErrNone;
@ -533,8 +515,7 @@ bail:
*
* On completion, "pSrcSet" will be empty and "unloaded".
*/
NuError
Nu_RecordSet_MoveAllRecords(NuArchive* pArchive, NuRecordSet* pDstSet,
NuError Nu_RecordSet_MoveAllRecords(NuArchive* pArchive, NuRecordSet* pDstSet,
NuRecordSet* pSrcSet)
{
NuError err = kNuErrNone;
@ -583,9 +564,8 @@ Nu_RecordSet_MoveAllRecords(NuArchive* pArchive, NuRecordSet* pDstSet,
/*
* Find a record in the list by index.
*/
NuError
Nu_RecordSet_FindByIdx(const NuRecordSet* pRecordSet, NuRecordIdx recIdx,
NuRecord** ppRecord)
NuError Nu_RecordSet_FindByIdx(const NuRecordSet* pRecordSet,
NuRecordIdx recIdx, NuRecord** ppRecord)
{
NuRecord* pRecord;
@ -606,9 +586,8 @@ Nu_RecordSet_FindByIdx(const NuRecordSet* pRecordSet, NuRecordIdx recIdx,
/*
* Search for a specific thread in all records in the specified record set.
*/
NuError
Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet, NuThreadIdx threadIdx,
NuRecord** ppRecord, NuThread** ppThread)
NuError Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet,
NuThreadIdx threadIdx, NuRecord** ppRecord, NuThread** ppThread)
{
NuError err = kNuErrThreadIdxNotFound;
NuRecord* pRecord;
@ -650,8 +629,7 @@ Nu_RecordSet_FindByThreadIdx(NuRecordSet* pRecordSet, NuThreadIdx threadIdx,
* string pointed to by name1 is greater than, equal to, or less than
* the string pointed to by s2, respectively (i.e. same as strcmp).
*/
static int
Nu_CompareRecordNames(const char* name1, const char* name2)
static int Nu_CompareRecordNames(const char* name1, const char* name2)
{
#ifdef NU_CASE_SENSITIVE
return strcmp(name1, name2);
@ -664,9 +642,8 @@ Nu_CompareRecordNames(const char* name1, const char* name2)
/*
* Find a record in the list by storageName.
*/
static NuError
Nu_RecordSet_FindByName(const NuRecordSet* pRecordSet, const char* name,
NuRecord** ppRecord)
static NuError Nu_RecordSet_FindByName(const NuRecordSet* pRecordSet,
const char* name, NuRecord** ppRecord)
{
NuRecord* pRecord;
@ -696,9 +673,8 @@ Nu_RecordSet_FindByName(const NuRecordSet* pRecordSet, const char* name,
* up scanning the entire list and keeping the last match. If this
* causes a notable reduction in efficiency we'll have to fix this.
*/
static NuError
Nu_RecordSet_ReverseFindByName(const NuRecordSet* pRecordSet, const char* name,
NuRecord** ppRecord)
static NuError Nu_RecordSet_ReverseFindByName(const NuRecordSet* pRecordSet,
const char* name, NuRecord** ppRecord)
{
NuRecord* pRecord;
NuRecord* pFoundRecord = NULL;
@ -734,8 +710,7 @@ Nu_RecordSet_ReverseFindByName(const NuRecordSet* pRecordSet, const char* name,
*
* "ppNewRecord" will get a pointer to the newly-created clone.
*/
NuError
Nu_RecordSet_ReplaceRecord(NuArchive* pArchive, NuRecordSet* pBadSet,
NuError Nu_RecordSet_ReplaceRecord(NuArchive* pArchive, NuRecordSet* pBadSet,
NuRecord* pBadRecord, NuRecordSet* pGoodSet, NuRecord** ppNewRecord)
{
NuError err;
@ -811,8 +786,8 @@ bail:
* Ask the user if it's okay to ignore a bad CRC. If we can't ask the
* user, return "false".
*/
Boolean
Nu_ShouldIgnoreBadCRC(NuArchive* pArchive, const NuRecord* pRecord, NuError err)
Boolean Nu_ShouldIgnoreBadCRC(NuArchive* pArchive, const NuRecord* pRecord,
NuError err)
{
NuErrorStatus errorStatus;
NuResult result;
@ -872,8 +847,7 @@ bail:
*
* Pass in a NuRecord structure that will hold the data we read.
*/
static NuError
Nu_ReadRecordHeader(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_ReadRecordHeader(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err = kNuErrNone;
uint16_t crc;
@ -1113,8 +1087,7 @@ bail:
* NOTE: for data files (types 1, 2, and 3), the actual value may not match
* up what ProDOS would use, because this doesn't test for sparseness.
*/
static void
Nu_UpdateStorageType(NuArchive* pArchive, NuRecord* pRecord)
static void Nu_UpdateStorageType(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err;
NuThread* pThread;
@ -1167,8 +1140,7 @@ bail:
* The position of the file pointer on exit is undefined. The position
* past the end of the record will be stored in pArchive->currentOffset.
*/
NuError
Nu_WriteRecordHeader(NuArchive* pArchive, NuRecord* pRecord, FILE* fp)
NuError Nu_WriteRecordHeader(NuArchive* pArchive, NuRecord* pRecord, FILE* fp)
{
NuError err = kNuErrNone;
uint16_t crc;
@ -1312,8 +1284,7 @@ bail:
* Prepare for a "walk" through the records. This is useful for the
* "read the TOC as you go" method of archive use.
*/
static NuError
Nu_RecordWalkPrepare(NuArchive* pArchive, NuRecord** ppRecord)
static NuError Nu_RecordWalkPrepare(NuArchive* pArchive, NuRecord** ppRecord)
{
NuError err = kNuErrNone;
@ -1345,8 +1316,7 @@ bail:
* we read it from the archive file, and add it to the TOC being
* constructed.
*/
static NuError
Nu_RecordWalkGetNext(NuArchive* pArchive, NuRecord** ppRecord)
static NuError Nu_RecordWalkGetNext(NuArchive* pArchive, NuRecord** ppRecord)
{
NuError err = kNuErrNone;
@ -1394,8 +1364,7 @@ bail:
* full table of contents. On an unsuccessful walk, blow away the TOC
* if we don't have all of it.
*/
static NuError
Nu_RecordWalkFinish(NuArchive* pArchive, NuError walkErr)
static NuError Nu_RecordWalkFinish(NuArchive* pArchive, NuError walkErr)
{
if (pArchive->haveToc)
return kNuErrNone;
@ -1418,8 +1387,7 @@ Nu_RecordWalkFinish(NuArchive* pArchive, NuError walkErr)
*
* Uses the "record walk" functions, because they're there.
*/
NuError
Nu_GetTOCIfNeeded(NuArchive* pArchive)
NuError Nu_GetTOCIfNeeded(NuArchive* pArchive)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1458,8 +1426,7 @@ bail:
* Run through the entire archive, pulling out the header bits, skipping
* over the data bits, and calling "contentFunc" for each record.
*/
NuError
Nu_StreamContents(NuArchive* pArchive, NuCallback contentFunc)
NuError Nu_StreamContents(NuArchive* pArchive, NuCallback contentFunc)
{
NuError err = kNuErrNone;
NuRecord tmpRecord;
@ -1516,8 +1483,8 @@ bail:
* to recreate the original we need to re-add the resource fork so
* NufxLib knows to make it an extended file.
*/
static NuError
Nu_FakeZeroExtract(NuArchive* pArchive, NuRecord* pRecord, int threadKind)
static NuError Nu_FakeZeroExtract(NuArchive* pArchive, NuRecord* pRecord,
int threadKind)
{
NuError err;
NuThread fakeThread;
@ -1549,8 +1516,7 @@ Nu_FakeZeroExtract(NuArchive* pArchive, NuRecord* pRecord, int threadKind)
/*
* Run through the entire archive, extracting the contents.
*/
NuError
Nu_StreamExtract(NuArchive* pArchive)
NuError Nu_StreamExtract(NuArchive* pArchive)
{
NuError err = kNuErrNone;
NuRecord tmpRecord;
@ -1662,8 +1628,7 @@ bail:
* Test the contents of an archive. Works just like extraction, but we
* don't store anything.
*/
NuError
Nu_StreamTest(NuArchive* pArchive)
NuError Nu_StreamTest(NuArchive* pArchive)
{
NuError err;
@ -1686,8 +1651,7 @@ Nu_StreamTest(NuArchive* pArchive)
* This only walks through the "orig" list, so it does not reflect the
* results of un-flushed changes.
*/
NuError
Nu_Contents(NuArchive* pArchive, NuCallback contentFunc)
NuError Nu_Contents(NuArchive* pArchive, NuCallback contentFunc)
{
NuError err = kNuErrNone;
NuRecord* pRecord;
@ -1727,8 +1691,7 @@ bail:
*
* This assumes random access, so it can't be used in streaming mode.
*/
static NuError
Nu_ExtractRecordByPtr(NuArchive* pArchive, NuRecord* pRecord)
static NuError Nu_ExtractRecordByPtr(NuArchive* pArchive, NuRecord* pRecord)
{
NuError err = kNuErrNone;
Boolean hasInterestingThread;
@ -1796,8 +1759,7 @@ bail:
/*
* Extract a big buncha files.
*/
NuError
Nu_Extract(NuArchive* pArchive)
NuError Nu_Extract(NuArchive* pArchive)
{
NuError err;
NuRecord* pRecord = NULL;
@ -1842,8 +1804,7 @@ bail:
/*
* Extract a single record.
*/
NuError
Nu_ExtractRecord(NuArchive* pArchive, NuRecordIdx recIdx)
NuError Nu_ExtractRecord(NuArchive* pArchive, NuRecordIdx recIdx)
{
NuError err;
NuRecord* pRecord;
@ -1871,8 +1832,7 @@ bail:
* Test the contents of an archive. Works just like extraction, but we
* don't store anything.
*/
NuError
Nu_Test(NuArchive* pArchive)
NuError Nu_Test(NuArchive* pArchive)
{
NuError err;
@ -1885,8 +1845,7 @@ Nu_Test(NuArchive* pArchive)
/*
* Test a single record.
*/
NuError
Nu_TestRecord(NuArchive* pArchive, NuRecordIdx recIdx)
NuError Nu_TestRecord(NuArchive* pArchive, NuRecordIdx recIdx)
{
NuError err;
NuRecord* pRecord;
@ -1919,8 +1878,7 @@ bail:
* for records that have been deleted. It will not reflect changes
* made by previous "write" calls, not even SetRecordAttr.
*/
NuError
Nu_GetRecord(NuArchive* pArchive, NuRecordIdx recordIdx,
NuError Nu_GetRecord(NuArchive* pArchive, NuRecordIdx recordIdx,
const NuRecord** ppRecord)
{
NuError err;
@ -1947,8 +1905,7 @@ bail:
/*
* Find the recordIdx of a record by storage name.
*/
NuError
Nu_GetRecordIdxByName(NuArchive* pArchive, const char* name,
NuError Nu_GetRecordIdxByName(NuArchive* pArchive, const char* name,
NuRecordIdx* pRecordIdx)
{
NuError err;
@ -1976,8 +1933,7 @@ bail:
/*
* Find the recordIdx of a record by zero-based position.
*/
NuError
Nu_GetRecordIdxByPosition(NuArchive* pArchive, uint32_t position,
NuError Nu_GetRecordIdxByPosition(NuArchive* pArchive, uint32_t position,
NuRecordIdx* pRecordIdx)
{
NuError err;
@ -2028,8 +1984,7 @@ bail:
* The record returned will always be from the "copy" set. An error result
* is returned if the record isn't found.
*/
NuError
Nu_FindRecordForWriteByIdx(NuArchive* pArchive, NuRecordIdx recIdx,
NuError Nu_FindRecordForWriteByIdx(NuArchive* pArchive, NuRecordIdx recIdx,
NuRecord** ppFoundRecord)
{
NuError err;
@ -2079,9 +2034,9 @@ bail:
* passed in, then the record will be deleted from the "copy" set (which
* will be created only if necessary).
*/
static NuError
Nu_HandleAddDuplicateRecord(NuArchive* pArchive, NuRecordSet* pRecordSet,
NuRecord* pRecord, const NuFileDetails* pFileDetails)
static NuError Nu_HandleAddDuplicateRecord(NuArchive* pArchive,
NuRecordSet* pRecordSet, NuRecord* pRecord,
const NuFileDetails* pFileDetails)
{
NuError err = kNuErrNone;
NuErrorStatus errorStatus;
@ -2218,8 +2173,7 @@ bail:
* placed in "*pThreadIdx". If "*ppNewRecord" is non-NULL, it gets a pointer
* to the newly-created record (this isn't part of the external interface).
*/
NuError
Nu_AddRecord(NuArchive* pArchive, const NuFileDetails* pFileDetails,
NuError Nu_AddRecord(NuArchive* pArchive, const NuFileDetails* pFileDetails,
NuRecordIdx* pRecordIdx, NuRecord** ppNewRecord)
{
NuError err;
@ -2358,8 +2312,7 @@ bail:
* The caller should have already verified that there isn't another
* "add file" thread mod with the same ThreadID.
*/
static NuError
Nu_AddFileThreadMod(NuArchive* pArchive, NuRecord* pRecord,
static NuError Nu_AddFileThreadMod(NuArchive* pArchive, NuRecord* pRecord,
const char* pathname, const NuFileDetails* pFileDetails,
Boolean fromRsrcFork)
{
@ -2419,8 +2372,7 @@ bail:
*
* If "pRecordIdx" is non-NULL, it will receive the newly assigned recordID.
*/
NuError
Nu_AddFile(NuArchive* pArchive, const char* pathname,
NuError Nu_AddFile(NuArchive* pArchive, const char* pathname,
const NuFileDetails* pFileDetails, Boolean fromRsrcFork,
NuRecordIdx* pRecordIdx)
{
@ -2561,8 +2513,7 @@ bail:
* We might also want to screen out trailing fssep chars, though the NuFX
* spec doesn't say they're illegal.
*/
NuError
Nu_Rename(NuArchive* pArchive, NuRecordIdx recIdx, const char* pathname,
NuError Nu_Rename(NuArchive* pArchive, NuRecordIdx recIdx, const char* pathname,
char fssep)
{
NuError err;
@ -2707,8 +2658,7 @@ bail:
/*
* Update a record's attributes with the contents of pRecordAttr.
*/
NuError
Nu_SetRecordAttr(NuArchive* pArchive, NuRecordIdx recordIdx,
NuError Nu_SetRecordAttr(NuArchive* pArchive, NuRecordIdx recordIdx,
const NuRecordAttr* pRecordAttr)
{
NuError err;
@ -2745,8 +2695,7 @@ bail:
/*
* Bulk-delete several records, using the selection filter callback.
*/
NuError
Nu_Delete(NuArchive* pArchive)
NuError Nu_Delete(NuArchive* pArchive)
{
NuError err;
NuSelectionProposal selProposal;
@ -2828,8 +2777,7 @@ bail:
/*
* Delete an entire record.
*/
NuError
Nu_DeleteRecord(NuArchive* pArchive, NuRecordIdx recIdx)
NuError Nu_DeleteRecord(NuArchive* pArchive, NuRecordIdx recIdx)
{
NuError err;
NuRecord* pRecord;

View File

@ -19,8 +19,7 @@
/*
* Allocate a new DataSource structure.
*/
static NuError
Nu_DataSourceNew(NuDataSource** ppDataSource)
static NuError Nu_DataSourceNew(NuDataSource** ppDataSource)
{
Assert(ppDataSource != NULL);
@ -49,8 +48,7 @@ Nu_DataSourceNew(NuDataSource** ppDataSource)
*
* Returns NULL on error.
*/
NuDataSource*
Nu_DataSourceCopy(NuDataSource* pDataSource)
NuDataSource* Nu_DataSourceCopy(NuDataSource* pDataSource)
{
Assert(pDataSource->common.refCount >= 1);
pDataSource->common.refCount++;
@ -89,8 +87,7 @@ Nu_DataSourceCopy(NuDataSource* pDataSource)
/*
* Free a data source structure, and any type-specific elements.
*/
NuError
Nu_DataSourceFree(NuDataSource* pDataSource)
NuError Nu_DataSourceFree(NuDataSource* pDataSource)
{
if (pDataSource == NULL)
return kNuErrNone;
@ -139,8 +136,7 @@ Nu_DataSourceFree(NuDataSource* pDataSource)
/*
* Create a data source for an unopened file.
*/
NuError
Nu_DataSourceFile_New(NuThreadFormat threadFormat, uint32_t otherLen,
NuError Nu_DataSourceFile_New(NuThreadFormat threadFormat, uint32_t otherLen,
const char* pathname, Boolean isFromRsrcFork, NuDataSource** ppDataSource)
{
NuError err;
@ -175,8 +171,7 @@ bail:
* Create a data source for an open file at a specific offset. The FILE*
* must be seekable.
*/
NuError
Nu_DataSourceFP_New(NuThreadFormat threadFormat, uint32_t otherLen,
NuError Nu_DataSourceFP_New(NuThreadFormat threadFormat, uint32_t otherLen,
FILE* fp, long offset, long length, NuCallback fcloseFunc,
NuDataSource** ppDataSource)
{
@ -220,8 +215,7 @@ bail:
* NULL. This is useful for creating empty pre-sized buffers, such as
* blank comment fields.
*/
NuError
Nu_DataSourceBuffer_New(NuThreadFormat threadFormat, uint32_t otherLen,
NuError Nu_DataSourceBuffer_New(NuThreadFormat threadFormat, uint32_t otherLen,
const uint8_t* buffer, long offset, long length, NuCallback freeFunc,
NuDataSource** ppDataSource)
{
@ -267,8 +261,7 @@ bail:
/*
* Get the type of a NuDataSource.
*/
NuDataSourceType
Nu_DataSourceGetType(const NuDataSource* pDataSource)
NuDataSourceType Nu_DataSourceGetType(const NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
return pDataSource->sourceType;
@ -277,8 +270,7 @@ Nu_DataSourceGetType(const NuDataSource* pDataSource)
/*
* Get the threadFormat for a data source.
*/
NuThreadFormat
Nu_DataSourceGetThreadFormat(const NuDataSource* pDataSource)
NuThreadFormat Nu_DataSourceGetThreadFormat(const NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
return pDataSource->common.threadFormat;
@ -287,8 +279,7 @@ Nu_DataSourceGetThreadFormat(const NuDataSource* pDataSource)
/*
* Get "dataLen" from a dataSource.
*/
uint32_t
Nu_DataSourceGetDataLen(const NuDataSource* pDataSource)
uint32_t Nu_DataSourceGetDataLen(const NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
@ -303,8 +294,7 @@ Nu_DataSourceGetDataLen(const NuDataSource* pDataSource)
/*
* Get "otherLen" from a dataSource.
*/
uint32_t
Nu_DataSourceGetOtherLen(const NuDataSource* pDataSource)
uint32_t Nu_DataSourceGetOtherLen(const NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
return pDataSource->common.otherLen;
@ -313,8 +303,7 @@ Nu_DataSourceGetOtherLen(const NuDataSource* pDataSource)
/*
* Change the "otherLen" value.
*/
void
Nu_DataSourceSetOtherLen(NuDataSource* pDataSource, long otherLen)
void Nu_DataSourceSetOtherLen(NuDataSource* pDataSource, long otherLen)
{
Assert(pDataSource != NULL && otherLen > 0);
pDataSource->common.otherLen = otherLen;
@ -324,8 +313,7 @@ Nu_DataSourceSetOtherLen(NuDataSource* pDataSource, long otherLen)
/*
* Get the "raw CRC" value.
*/
uint16_t
Nu_DataSourceGetRawCrc(const NuDataSource* pDataSource)
uint16_t Nu_DataSourceGetRawCrc(const NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
return pDataSource->common.rawCrc;
@ -335,8 +323,7 @@ Nu_DataSourceGetRawCrc(const NuDataSource* pDataSource)
* Set the "raw CRC" value. You would want to do this if the input was
* already-compressed data, and you wanted to propagate the thread CRC.
*/
void
Nu_DataSourceSetRawCrc(NuDataSource* pDataSource, uint16_t crc)
void Nu_DataSourceSetRawCrc(NuDataSource* pDataSource, uint16_t crc)
{
Assert(pDataSource != NULL);
pDataSource->common.rawCrc = crc;
@ -346,8 +333,8 @@ Nu_DataSourceSetRawCrc(NuDataSource* pDataSource, uint16_t crc)
/*
* Prepare a data source for action.
*/
NuError
Nu_DataSourcePrepareInput(NuArchive* pArchive, NuDataSource* pDataSource)
NuError Nu_DataSourcePrepareInput(NuArchive* pArchive,
NuDataSource* pDataSource)
{
NuError err = kNuErrNone;
FILE* fileFp = NULL;
@ -403,8 +390,7 @@ bail:
* call will take care of this eventually -- but for normal operation on
* a large number of files, it's vital.
*/
void
Nu_DataSourceUnPrepareInput(NuArchive* pArchive, NuDataSource* pDataSource)
void Nu_DataSourceUnPrepareInput(NuArchive* pArchive, NuDataSource* pDataSource)
{
if (Nu_DataSourceGetType(pDataSource) != kNuDataSourceFromFile)
return;
@ -420,8 +406,7 @@ Nu_DataSourceUnPrepareInput(NuArchive* pArchive, NuDataSource* pDataSource)
/*
* Get the pathname from a "from-file" dataSource.
*/
const char*
Nu_DataSourceFile_GetPathname(NuDataSource* pDataSource)
const char* Nu_DataSourceFile_GetPathname(NuDataSource* pDataSource)
{
Assert(pDataSource != NULL);
Assert(pDataSource->sourceType == kNuDataSourceFromFile);
@ -434,8 +419,8 @@ Nu_DataSourceFile_GetPathname(NuDataSource* pDataSource)
/*
* Read a block of data from a dataSource.
*/
NuError
Nu_DataSourceGetBlock(NuDataSource* pDataSource, uint8_t* buf, uint32_t len)
NuError Nu_DataSourceGetBlock(NuDataSource* pDataSource, uint8_t* buf,
uint32_t len)
{
NuError err;
@ -479,8 +464,7 @@ Nu_DataSourceGetBlock(NuDataSource* pDataSource, uint8_t* buf, uint32_t len)
/*
* Rewind a data source to the start of its input.
*/
NuError
Nu_DataSourceRewind(NuDataSource* pDataSource)
NuError Nu_DataSourceRewind(NuDataSource* pDataSource)
{
NuError err;
@ -518,8 +502,7 @@ Nu_DataSourceRewind(NuDataSource* pDataSource)
/*
* Allocate a new DataSink structure.
*/
static NuError
Nu_DataSinkNew(NuDataSink** ppDataSink)
static NuError Nu_DataSinkNew(NuDataSink** ppDataSink)
{
Assert(ppDataSink != NULL);
@ -536,8 +519,7 @@ Nu_DataSinkNew(NuDataSink** ppDataSink)
/*
* Free a data sink structure, and any type-specific elements.
*/
NuError
Nu_DataSinkFree(NuDataSink* pDataSink)
NuError Nu_DataSinkFree(NuDataSink* pDataSink)
{
if (pDataSink == NULL)
return kNuErrNone;
@ -568,9 +550,8 @@ Nu_DataSinkFree(NuDataSink* pDataSink)
/*
* Create a data sink for an unopened file.
*/
NuError
Nu_DataSinkFile_New(Boolean doExpand, NuValue convertEOL, const char* pathname,
char fssep, NuDataSink** ppDataSink)
NuError Nu_DataSinkFile_New(Boolean doExpand, NuValue convertEOL,
const char* pathname, char fssep, NuDataSink** ppDataSink)
{
NuError err;
@ -607,8 +588,7 @@ bail:
/*
* Create a data sink based on a file pointer.
*/
NuError
Nu_DataSinkFP_New(Boolean doExpand, NuValue convertEOL, FILE* fp,
NuError Nu_DataSinkFP_New(Boolean doExpand, NuValue convertEOL, FILE* fp,
NuDataSink** ppDataSink)
{
NuError err;
@ -642,9 +622,8 @@ bail:
/*
* Create a data sink for a buffer in memory.
*/
NuError
Nu_DataSinkBuffer_New(Boolean doExpand, NuValue convertEOL, uint8_t* buffer,
uint32_t bufLen, NuDataSink** ppDataSink)
NuError Nu_DataSinkBuffer_New(Boolean doExpand, NuValue convertEOL,
uint8_t* buffer, uint32_t bufLen, NuDataSink** ppDataSink)
{
NuError err;
@ -681,8 +660,7 @@ bail:
/*
* Create a data sink that goes nowhere.
*/
NuError
Nu_DataSinkVoid_New(Boolean doExpand, NuValue convertEOL,
NuError Nu_DataSinkVoid_New(Boolean doExpand, NuValue convertEOL,
NuDataSink** ppDataSink)
{
NuError err;
@ -706,8 +684,7 @@ bail:
/*
* Get the type of a NuDataSink.
*/
NuDataSinkType
Nu_DataSinkGetType(const NuDataSink* pDataSink)
NuDataSinkType Nu_DataSinkGetType(const NuDataSink* pDataSink)
{
Assert(pDataSink != NULL);
return pDataSink->sinkType;
@ -717,8 +694,7 @@ Nu_DataSinkGetType(const NuDataSink* pDataSink)
/*
* Return the "doExpand" parameter from any kind of sink.
*/
Boolean
Nu_DataSinkGetDoExpand(const NuDataSink* pDataSink)
Boolean Nu_DataSinkGetDoExpand(const NuDataSink* pDataSink)
{
return pDataSink->common.doExpand;
}
@ -726,8 +702,7 @@ Nu_DataSinkGetDoExpand(const NuDataSink* pDataSink)
/*
* Return the "convertEOL" parameter from any kind of sink.
*/
NuValue
Nu_DataSinkGetConvertEOL(const NuDataSink* pDataSink)
NuValue Nu_DataSinkGetConvertEOL(const NuDataSink* pDataSink)
{
return pDataSink->common.convertEOL;
}
@ -735,8 +710,7 @@ Nu_DataSinkGetConvertEOL(const NuDataSink* pDataSink)
/*
* Return the #of bytes written to the sink.
*/
uint32_t
Nu_DataSinkGetOutCount(const NuDataSink* pDataSink)
uint32_t Nu_DataSinkGetOutCount(const NuDataSink* pDataSink)
{
return pDataSink->common.outCount;
}
@ -745,8 +719,7 @@ Nu_DataSinkGetOutCount(const NuDataSink* pDataSink)
/*
* Get "pathname" from a to-file sink.
*/
const char*
Nu_DataSinkFile_GetPathname(const NuDataSink* pDataSink)
const char* Nu_DataSinkFile_GetPathname(const NuDataSink* pDataSink)
{
Assert(pDataSink != NULL);
Assert(pDataSink->sinkType == kNuDataSinkToFile);
@ -757,8 +730,7 @@ Nu_DataSinkFile_GetPathname(const NuDataSink* pDataSink)
/*
* Get "fssep" from a to-file sink.
*/
char
Nu_DataSinkFile_GetFssep(const NuDataSink* pDataSink)
char Nu_DataSinkFile_GetFssep(const NuDataSink* pDataSink)
{
Assert(pDataSink != NULL);
Assert(pDataSink->sinkType == kNuDataSinkToFile);
@ -769,8 +741,7 @@ Nu_DataSinkFile_GetFssep(const NuDataSink* pDataSink)
/*
* Get the "fp" for a file sink.
*/
FILE*
Nu_DataSinkFile_GetFP(const NuDataSink* pDataSink)
FILE* Nu_DataSinkFile_GetFP(const NuDataSink* pDataSink)
{
Assert(pDataSink != NULL);
Assert(pDataSink->sinkType == kNuDataSinkToFile);
@ -781,8 +752,7 @@ Nu_DataSinkFile_GetFP(const NuDataSink* pDataSink)
/*
* Set the "fp" for a file sink.
*/
void
Nu_DataSinkFile_SetFP(NuDataSink* pDataSink, FILE* fp)
void Nu_DataSinkFile_SetFP(NuDataSink* pDataSink, FILE* fp)
{
Assert(pDataSink != NULL);
Assert(pDataSink->sinkType == kNuDataSinkToFile);
@ -793,8 +763,7 @@ Nu_DataSinkFile_SetFP(NuDataSink* pDataSink, FILE* fp)
/*
* Close a to-file sink.
*/
void
Nu_DataSinkFile_Close(NuDataSink* pDataSink)
void Nu_DataSinkFile_Close(NuDataSink* pDataSink)
{
Assert(pDataSink != NULL);
@ -808,8 +777,8 @@ Nu_DataSinkFile_Close(NuDataSink* pDataSink)
/*
* Write a block of data to a DataSink.
*/
NuError
Nu_DataSinkPutBlock(NuDataSink* pDataSink, const uint8_t* buf, uint32_t len)
NuError Nu_DataSinkPutBlock(NuDataSink* pDataSink, const uint8_t* buf,
uint32_t len)
{
NuError err;
@ -856,8 +825,7 @@ Nu_DataSinkPutBlock(NuDataSink* pDataSink, const uint8_t* buf, uint32_t len)
/*
* Figure out if one of our earlier writes has failed.
*/
NuError
Nu_DataSinkGetError(NuDataSink* pDataSink)
NuError Nu_DataSinkGetError(NuDataSink* pDataSink)
{
NuError err = kNuErrNone;

View File

@ -117,8 +117,7 @@ typedef struct SQState {
*
* Returns kNuSQEOFToken as the value when we're out of data.
*/
static NuError
Nu_SQGetcCRC(SQState* pSqState, int* pSym)
static NuError Nu_SQGetcCRC(SQState* pSqState, int* pSym)
{
NuError err;
uint8_t c;
@ -148,8 +147,7 @@ Nu_SQGetcCRC(SQState* pSqState, int* pSym)
*
* Returns kNuSQEOFToken in "*pSum" when we reach the end of the input.
*/
static NuError
Nu_SQGetcRLE(SQState* pSqState, int* pSym)
static NuError Nu_SQGetcRLE(SQState* pSqState, int* pSym)
{
NuError err = kNuErrNone;
int likeCount, newSym;
@ -275,8 +273,7 @@ bail:
/*
* Return the greater of two integers.
*/
static int
Nu_SQMax(int a, int b)
static int Nu_SQMax(int a, int b)
{
if (a > b)
return a;
@ -289,8 +286,7 @@ Nu_SQMax(int a, int b)
* Priority is given to weight, then depth. "a" and "b" are heaps,
* so we only need to look at the root element.
*/
static int
Nu_SQCmpTrees(SQState* pSqState, int a, int b)
static int Nu_SQCmpTrees(SQState* pSqState, int a, int b)
{
if (pSqState->node[a].weight > pSqState->node[b].weight)
return true;
@ -312,8 +308,7 @@ Nu_SQCmpTrees(SQState* pSqState, int a, int b)
/*
* Recursively make a heap from a heap with a new top.
*/
static void
Nu_SQHeapAdjust(SQState* pSqState, int list[], int top, int bottom)
static void Nu_SQHeapAdjust(SQState* pSqState, int list[], int top, int bottom)
{
int k, temp;
@ -337,8 +332,7 @@ Nu_SQHeapAdjust(SQState* pSqState, int list[], int top, int bottom)
/*
* Create a heap.
*/
static void
Nu_SQHeap(SQState* pSqState, int list[], int length)
static void Nu_SQHeap(SQState* pSqState, int list[], int length)
{
int i;
@ -365,8 +359,7 @@ Nu_SQHeap(SQState* pSqState, int list[], int length)
* moving the last element over the top element and
* reheaping the shorter list.
*/
static void
Nu_SQBuildTree(SQState* pSqState, int list[], int len)
static void Nu_SQBuildTree(SQState* pSqState, int list[], int len)
{
int freenode; /* next free node in tree */
EncTreeNode* frnp; /* free node pointer */
@ -422,8 +415,7 @@ Nu_SQBuildTree(SQState* pSqState, int list[], int len)
*
* Returns zero on success, nonzero if codes are too long.
*/
static int
Nu_SQBuildEncTable(SQState* pSqState, int level, int root)
static int Nu_SQBuildEncTable(SQState* pSqState, int level, int root)
{
int l, r;
@ -470,8 +462,7 @@ Nu_SQBuildEncTable(SQState* pSqState, int level, int root)
* the codes will fit in an unsigned integer. Rescaling is
* used if necessary to limit the code length.
*/
static void
Nu_SQScale(SQState* pSqState, int ceiling)
static void Nu_SQScale(SQState* pSqState, int ceiling)
{
int i;
int wt, ovflw, divisor;
@ -510,8 +501,7 @@ Nu_SQScale(SQState* pSqState, int ceiling)
* Build a frequency table from the post-RLE input stream, then generate
* an encoding tree from the results.
*/
static NuError
Nu_SQComputeHuffTree(SQState* pSqState)
static NuError Nu_SQComputeHuffTree(SQState* pSqState)
{
NuError err = kNuErrNone;
int btreeList[kNuSQNumVals]; /* list of intermediate binary trees */
@ -610,8 +600,8 @@ bail:
* Compress data from input to output, using the values in the "code"
* and "codeLen" arrays.
*/
static NuError
Nu_SQCompressInput(SQState* pSqState, FILE* fp, long* pCompressedLen)
static NuError Nu_SQCompressInput(SQState* pSqState, FILE* fp,
long* pCompressedLen)
{
NuError err = kNuErrNone;
int sym = kNuSQEOFToken-1;
@ -661,8 +651,7 @@ bail:
/*
* Write a 16-bit value in little-endian order.
*/
static NuError
Nu_SQWriteShort(FILE* outfp, short val)
static NuError Nu_SQWriteShort(FILE* outfp, short val)
{
NuError err;
uint8_t tmpc;
@ -689,8 +678,7 @@ bail:
* it an empty file. "xsq" works fine, creating an empty tree that
* "xusq" unpacks.
*/
NuError
Nu_CompressHuffmanSQ(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
NuError Nu_CompressHuffmanSQ(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
uint32_t srcLen, uint32_t* pDstLen, uint16_t* pCrc)
{
NuError err = kNuErrNone;
@ -842,8 +830,7 @@ typedef struct USQState {
/*
* Decode the next symbol from the Huffman stream.
*/
static NuError
Nu_USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
static NuError Nu_USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
{
short val = 0;
int bits, bitPosn;
@ -879,8 +866,7 @@ Nu_USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
/*
* Read two bytes of signed data out of the buffer.
*/
static inline NuError
Nu_USQReadShort(USQState* pUsqState, short* pShort)
static inline NuError Nu_USQReadShort(USQState* pUsqState, short* pShort)
{
if (pUsqState->dataInBuffer < 2)
return kNuErrBufferUnderrun;
@ -898,8 +884,7 @@ Nu_USQReadShort(USQState* pUsqState, short* pShort)
* Because we have a stop symbol, knowing the uncompressed length of
* the file is not essential.
*/
NuError
Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, uint16_t* pCrc)
{
NuError err = kNuErrNone;

View File

@ -26,8 +26,7 @@
* This high-bit-ism was also done for disk archives by most older versions
* of ShrinkIt.
*/
void
Nu_StripHiIfAllSet(char* str)
void Nu_StripHiIfAllSet(char* str)
{
uint8_t* cp;
@ -44,8 +43,7 @@ Nu_StripHiIfAllSet(char* str)
* Decide if a thread is pre-sized (i.e. has a fixed maximum size with a
* lesser amount of uncompressed data within) based on the threadID.
*/
Boolean
Nu_IsPresizedThreadID(NuThreadID threadID)
Boolean Nu_IsPresizedThreadID(NuThreadID threadID)
{
if (threadID == kNuThreadIDFilename || threadID == kNuThreadIDComment)
return true;
@ -58,8 +56,7 @@ Nu_IsPresizedThreadID(NuThreadID threadID)
* Return an indication of whether the type of thread specified by ThreadID
* should ever be compressed. Right now, that's only data-class threads.
*/
Boolean
Nu_IsCompressibleThreadID(NuThreadID threadID)
Boolean Nu_IsCompressibleThreadID(NuThreadID threadID)
{
if (NuThreadIDGetClass(threadID) == kNuThreadClassData)
return true;
@ -72,8 +69,7 @@ Nu_IsCompressibleThreadID(NuThreadID threadID)
* Decide if the thread has a CRC, based on the record version and the
* threadID.
*/
Boolean
Nu_ThreadHasCRC(long recordVersion, NuThreadID threadID)
Boolean Nu_ThreadHasCRC(long recordVersion, NuThreadID threadID)
{
return recordVersion >= 3 &&
NuThreadIDGetClass(threadID) == kNuThreadClassData;
@ -83,8 +79,7 @@ Nu_ThreadHasCRC(long recordVersion, NuThreadID threadID)
/*
* Search through a given NuRecord for the specified thread.
*/
NuError
Nu_FindThreadByIdx(const NuRecord* pRecord, NuThreadIdx thread,
NuError Nu_FindThreadByIdx(const NuRecord* pRecord, NuThreadIdx thread,
NuThread** ppThread)
{
NuThread* pThread;
@ -108,8 +103,7 @@ Nu_FindThreadByIdx(const NuRecord* pRecord, NuThreadIdx thread,
* Search through a given NuRecord for the first thread with a matching
* threadID.
*/
NuError
Nu_FindThreadByID(const NuRecord* pRecord, NuThreadID threadID,
NuError Nu_FindThreadByID(const NuRecord* pRecord, NuThreadID threadID,
NuThread** ppThread)
{
NuThread* pThread;
@ -132,8 +126,7 @@ Nu_FindThreadByID(const NuRecord* pRecord, NuThreadID threadID,
/*
* Copy the contents of a NuThread.
*/
void
Nu_CopyThreadContents(NuThread* pDstThread, const NuThread* pSrcThread)
void Nu_CopyThreadContents(NuThread* pDstThread, const NuThread* pSrcThread)
{
Assert(pDstThread != NULL);
Assert(pSrcThread != NULL);
@ -151,8 +144,8 @@ Nu_CopyThreadContents(NuThread* pDstThread, const NuThread* pSrcThread)
/*
* Read a single thread header from the archive.
*/
static NuError
Nu_ReadThreadHeader(NuArchive* pArchive, NuThread* pThread, uint16_t* pCrc)
static NuError Nu_ReadThreadHeader(NuArchive* pArchive, NuThread* pThread,
uint16_t* pCrc)
{
FILE* fp;
@ -184,8 +177,8 @@ Nu_ReadThreadHeader(NuArchive* pArchive, NuThread* pThread, uint16_t* pCrc)
* have used a linked list like NuLib, but that doesn't really provide any
* benefit for us, and adds complexity.
*/
NuError
Nu_ReadThreadHeaders(NuArchive* pArchive, NuRecord* pRecord, uint16_t* pCrc)
NuError Nu_ReadThreadHeaders(NuArchive* pArchive, NuRecord* pRecord,
uint16_t* pCrc)
{
NuError err = kNuErrNone;
NuThread* pThread;
@ -306,9 +299,8 @@ bail:
/*
* Write a single thread header to the archive.
*/
static NuError
Nu_WriteThreadHeader(NuArchive* pArchive, const NuThread* pThread, FILE* fp,
uint16_t* pCrc)
static NuError Nu_WriteThreadHeader(NuArchive* pArchive,
const NuThread* pThread, FILE* fp, uint16_t* pCrc)
{
Assert(pArchive != NULL);
Assert(pThread != NULL);
@ -332,8 +324,7 @@ Nu_WriteThreadHeader(NuArchive* pArchive, const NuThread* pThread, FILE* fp,
* effect, we promote all threads to "real" status. We update the
* "fake" count in pRecord accordingly.
*/
NuError
Nu_WriteThreadHeaders(NuArchive* pArchive, NuRecord* pRecord, FILE* fp,
NuError Nu_WriteThreadHeaders(NuArchive* pArchive, NuRecord* pRecord, FILE* fp,
uint16_t* pCrc)
{
NuError err = kNuErrNone;
@ -366,8 +357,7 @@ bail:
* Requires that the pArchive->currentOffset be set to the offset
* immediately after the last of the thread headers.
*/
NuError
Nu_ComputeThreadData(NuArchive* pArchive, NuRecord* pRecord)
NuError Nu_ComputeThreadData(NuArchive* pArchive, NuRecord* pRecord)
{
NuThread* pThread;
long fileOffset, count;
@ -407,8 +397,7 @@ Nu_ComputeThreadData(NuArchive* pArchive, NuRecord* pRecord)
* show to the application. (Someday I'll get AndyN for putting me
* through this...)
*/
NuError
Nu_ScanThreads(NuArchive* pArchive, NuRecord* pRecord, long numThreads)
NuError Nu_ScanThreads(NuArchive* pArchive, NuRecord* pRecord, long numThreads)
{
NuError err = kNuErrNone;
NuThread* pThread;
@ -494,8 +483,7 @@ bail:
* assumes that the file pointer is set to the start of the thread's data
* already.
*/
NuError
Nu_SkipThread(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_SkipThread(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread)
{
NuError err;
@ -522,9 +510,9 @@ Nu_SkipThread(NuArchive* pArchive, const NuRecord* pRecord,
* If the archive is a stream, the stream must be positioned at the
* start of pThread's data. If not, it will be seeked first.
*/
static NuError
Nu_ExtractThreadToDataSink(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, NuProgressData* pProgress, NuDataSink* pDataSink)
static NuError Nu_ExtractThreadToDataSink(NuArchive* pArchive,
const NuRecord* pRecord, const NuThread* pThread,
NuProgressData* pProgress, NuDataSink* pDataSink)
{
NuError err;
NuFunnel* pFunnel = NULL;
@ -576,9 +564,8 @@ bail:
* filters for every thread, which means we can reject specific kinds
* of forks and/or give them different names. This is a good thing.
*/
static NuError
Nu_ExtractThreadCommon(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread, NuDataSink* pDataSink)
static NuError Nu_ExtractThreadCommon(NuArchive* pArchive,
const NuRecord* pRecord, const NuThread* pThread, NuDataSink* pDataSink)
{
NuError err = kNuErrNone;
NuSelectionProposal selProposal;
@ -785,8 +772,7 @@ bail:
*
* Streaming archives must be properly positioned.
*/
NuError
Nu_ExtractThreadBulk(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_ExtractThreadBulk(NuArchive* pArchive, const NuRecord* pRecord,
const NuThread* pThread)
{
NuError err;
@ -827,8 +813,7 @@ bail:
/*
* Extract a thread, given the IDs and a data sink.
*/
NuError
Nu_ExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuError Nu_ExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuDataSink* pDataSink)
{
NuError err;
@ -872,9 +857,8 @@ bail:
*
* If a matching threadID is found, this returns an error.
*/
static NuError
Nu_FindNoFutureThread(NuArchive* pArchive, const NuRecord* pRecord,
NuThreadID threadID)
static NuError Nu_FindNoFutureThread(NuArchive* pArchive,
const NuRecord* pRecord, NuThreadID threadID)
{
NuError err = kNuErrNone;
const NuThread* pThread;
@ -927,9 +911,8 @@ bail:
/*
* Like Nu_FindNoFutureThread, but tests against a whole class.
*/
static NuError
Nu_FindNoFutureThreadClass(NuArchive* pArchive, const NuRecord* pRecord,
long threadClass)
static NuError Nu_FindNoFutureThreadClass(NuArchive* pArchive,
const NuRecord* pRecord, long threadClass)
{
NuError err = kNuErrNone;
const NuThread* pThread;
@ -988,9 +971,8 @@ bail:
* The record and thread returned will always be from the "copy" set. An
* error result is returned if the record and thread aren't found.
*/
static NuError
Nu_FindThreadForWriteByIdx(NuArchive* pArchive, NuThreadIdx threadIdx,
NuRecord** ppFoundRecord, NuThread** ppFoundThread)
static NuError Nu_FindThreadForWriteByIdx(NuArchive* pArchive,
NuThreadIdx threadIdx, NuRecord** ppFoundRecord, NuThread** ppFoundThread)
{
NuError err;
@ -1029,8 +1011,7 @@ bail:
*
* Returns with an error (kNuErrThreadAdd) if it's not okay.
*/
NuError
Nu_OkayToAddThread(NuArchive* pArchive, const NuRecord* pRecord,
NuError Nu_OkayToAddThread(NuArchive* pArchive, const NuRecord* pRecord,
NuThreadID threadID)
{
NuError err = kNuErrNone;
@ -1094,9 +1075,8 @@ bail:
* On success, the NuThreadIdx of the newly-created record will be placed
* in "*pThreadIdx", and "pDataSource" will be owned by NufxLib.
*/
NuError
Nu_AddThread(NuArchive* pArchive, NuRecordIdx recIdx, NuThreadID threadID,
NuDataSource* pDataSource, NuThreadIdx* pThreadIdx)
NuError Nu_AddThread(NuArchive* pArchive, NuRecordIdx recIdx,
NuThreadID threadID, NuDataSource* pDataSource, NuThreadIdx* pThreadIdx)
{
NuError err;
NuRecord* pRecord;
@ -1194,8 +1174,7 @@ bail:
* You aren't allowed to update threads that have been deleted. Updating
* newly-added threads isn't possible, since they aren't really threads yet.
*/
NuError
Nu_UpdatePresizedThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuError Nu_UpdatePresizedThread(NuArchive* pArchive, NuThreadIdx threadIdx,
NuDataSource* pDataSource, long* pMaxLen)
{
NuError err;
@ -1322,8 +1301,7 @@ bail:
* later on. Besides, it's sort of handy to hang on to the filename for
* as long as possible.
*/
NuError
Nu_DeleteThread(NuArchive* pArchive, NuThreadIdx threadIdx)
NuError Nu_DeleteThread(NuArchive* pArchive, NuThreadIdx threadIdx)
{
NuError err;
NuThreadMod* pThreadMod = NULL;

View File

@ -14,8 +14,7 @@
/*
* Get a configurable parameter.
*/
NuError
Nu_GetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue)
NuError Nu_GetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue)
{
NuError err = kNuErrNone;
@ -82,8 +81,7 @@ bail:
/*
* Set a configurable parameter.
*/
NuError
Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
NuError Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
{
NuError err = kNuErrInvalidArg;
@ -225,8 +223,7 @@ bail:
* pry into pArchive to get at (like the archive type) or get the master
* header (like the number of records).
*/
NuError
Nu_GetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr)
NuError Nu_GetAttr(NuArchive* pArchive, NuAttrID ident, NuAttr* pAttr)
{
NuError err = kNuErrNone;
if (pAttr == NULL)
@ -260,8 +257,8 @@ bail:
*
* Unsupported compression types cause a warning to be flagged.
*/
NuThreadFormat
Nu_ConvertCompressValToFormat(NuArchive* pArchive, NuValue compValue)
NuThreadFormat Nu_ConvertCompressValToFormat(NuArchive* pArchive,
NuValue compValue)
{
NuThreadFormat threadFormat;
Boolean unsup = false;

View File

@ -23,9 +23,8 @@ static const char gNuBuildFlags[] = "-";
/*
* Return the version number, date built, and build flags.
*/
NuError
Nu_GetVersion(long* pMajorVersion, long* pMinorVersion, long* pBugVersion,
const char** ppBuildDate, const char** ppBuildFlags)
NuError Nu_GetVersion(long* pMajorVersion, long* pMinorVersion,
long* pBugVersion, const char** ppBuildDate, const char** ppBuildFlags)
{
if (pMajorVersion != NULL)
*pMajorVersion = kNuVersionMajor;

View File

@ -14,8 +14,7 @@ static NuError AddToArchive(NulibState* pState, NuArchive* pArchive);
/*
* Add the specified files to a new or existing archive.
*/
NuError
DoAdd(NulibState* pState)
NuError DoAdd(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;
@ -84,8 +83,7 @@ bail:
* This just results in NuAddFile calls; the deferred write operation
* isn't initiated.
*/
static NuError
AddToArchive(NulibState* pState, NuArchive* pArchive)
static NuError AddToArchive(NulibState* pState, NuArchive* pArchive)
{
NuError err = kNuErrNone;
char* const* pSpec;

View File

@ -24,8 +24,7 @@
* The buffer we return to the archive library will be overwritten the
* next time this function gets called. This is expected.
*/
static NuResult
OutputPathnameFilter(NuArchive* pArchive, void* vproposal)
static NuResult OutputPathnameFilter(NuArchive* pArchive, void* vproposal)
{
NuPathnameProposal* pathProposal = vproposal;
NulibState* pState;
@ -99,8 +98,7 @@ bail:
* first character. A fancier version would play with line disciplines
* so you wouldn't have to hit "return".
*/
static char
GetReplyChar(char defaultReply)
static char GetReplyChar(char defaultReply)
{
char tmpBuf[32];
@ -120,8 +118,7 @@ GetReplyChar(char defaultReply)
*
* String returned should be freed by the caller.
*/
static char*
GetReplyString(const char* prompt)
static char* GetReplyString(const char* prompt)
{
char buf[kMaxInputLen];
char* result;
@ -152,8 +149,7 @@ GetReplyString(const char* prompt)
*
* A pointer to a newly-allocated buffer is returned.
*/
char*
GetSimpleComment(NulibState* pState, const char* pathname, int maxLen)
char* GetSimpleComment(NulibState* pState, const char* pathname, int maxLen)
{
char* buf = NULL;
char* result;
@ -196,8 +192,8 @@ GetSimpleComment(NulibState* pState, const char* pathname, int maxLen)
*
* (Someday "spec" might be a regexp.)
*/
static Boolean
SpecMatchesRecord(NulibState* pState, const char* spec, const NuRecord* pRecord)
static Boolean SpecMatchesRecord(NulibState* pState, const char* spec,
const NuRecord* pRecord)
{
#ifdef NU_CASE_SENSITIVE
if (NState_GetModRecurse(pState))
@ -222,8 +218,7 @@ SpecMatchesRecord(NulibState* pState, const char* spec, const NuRecord* pRecord)
* extraction by criteria other than name, e.g. all text files or all
* files archived before a certain date.
*/
Boolean
IsSpecified(NulibState* pState, const NuRecord* pRecord)
Boolean IsSpecified(NulibState* pState, const NuRecord* pRecord)
{
char* const* pSpec;
int i;
@ -245,8 +240,7 @@ IsSpecified(NulibState* pState, const NuRecord* pRecord)
* General-purpose selection filter, invoked as a callback. Compares the
* selection proposal with the filenames in "filespec".
*/
NuResult
SelectionFilter(NuArchive* pArchive, void* vproposal)
NuResult SelectionFilter(NuArchive* pArchive, void* vproposal)
{
const NuSelectionProposal* selProposal = vproposal;
NulibState* pState;
@ -271,8 +265,7 @@ SelectionFilter(NuArchive* pArchive, void* vproposal)
/*
* Print a three-digit progress percentage; range is 0% to 100%.
*/
void
PrintPercentage(uint32_t total, uint32_t progress)
void PrintPercentage(uint32_t total, uint32_t progress)
{
uint32_t perc;
@ -299,8 +292,7 @@ PrintPercentage(uint32_t total, uint32_t progress)
* Show our progress, unless we're expanding to a pipe. Invoked as a
* callback by nufxlib.
*/
NuResult
ProgressUpdater(NuArchive* pArchive, void* vProgress)
NuResult ProgressUpdater(NuArchive* pArchive, void* vProgress)
{
const NuProgressData* pProgress = vProgress;
NulibState* pState;
@ -449,8 +441,7 @@ ProgressUpdater(NuArchive* pArchive, void* vProgress)
* Decide whether or not to replace an existing file (during extract)
* or record (during add).
*/
static NuResult
HandleReplaceExisting(NulibState* pState, NuArchive* pArchive,
static NuResult HandleReplaceExisting(NulibState* pState, NuArchive* pArchive,
const NuErrorStatus* pErrorStatus)
{
NuResult result = kNuOK;
@ -537,8 +528,7 @@ bail:
* Note pErrorStatus->pathname may be NULL if the error was found in the
* master header or in the record header.
*/
static NuResult
HandleBadCRC(NulibState* pState, NuArchive* pArchive,
static NuResult HandleBadCRC(NulibState* pState, NuArchive* pArchive,
const NuErrorStatus* pErrorStatus)
{
NuResult result = kNuOK;
@ -597,8 +587,7 @@ bail:
* the system equivalent of readdir to scan a directory, so deleting a
* file just means it won't get added.
*/
static NuResult
HandleAddNotFound(NulibState* pState, NuArchive* pArchive,
static NuResult HandleAddNotFound(NulibState* pState, NuArchive* pArchive,
const NuErrorStatus* pErrorStatus)
{
NuResult result = kNuOK;
@ -644,8 +633,7 @@ bail:
* Something failed, and the user may want to choose how to handle it.
* Invoked as a callback.
*/
NuResult
ErrorHandler(NuArchive* pArchive, void* vErrorStatus)
NuResult ErrorHandler(NuArchive* pArchive, void* vErrorStatus)
{
const NuErrorStatus* pErrorStatus = vErrorStatus;
NulibState* pState;
@ -722,8 +710,7 @@ ErrorHandler(NuArchive* pArchive, void* vErrorStatus)
* (This was just a test to see if it worked... NufxLib's default behavior
* is fine for NuLib2.)
*/
NuResult
ErrorMessageHandler(NuArchive* pArchive, void* vErrorMessage)
NuResult ErrorMessageHandler(NuArchive* pArchive, void* vErrorMessage)
{
const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage;
@ -752,8 +739,7 @@ static const char* kStdinArchive = "-";
*
* Uses a simplified view of the access flags.
*/
Boolean
IsRecordReadOnly(const NuRecord* pRecord)
Boolean IsRecordReadOnly(const NuRecord* pRecord)
{
if (pRecord->recAccess == 0x21L || pRecord->recAccess == 0x01L)
return true;
@ -765,8 +751,7 @@ IsRecordReadOnly(const NuRecord* pRecord)
/*
* Returns "true" if "archiveName" is the name we use to represent stdin.
*/
Boolean
IsFilenameStdin(const char* archiveName)
Boolean IsFilenameStdin(const char* archiveName)
{
Assert(archiveName != NULL);
return (strcmp(archiveName, kStdinArchive) == 0);
@ -779,8 +764,7 @@ IsFilenameStdin(const char* archiveName)
* Open the archive in read-only mode. We use "file mode" for a file, or
* "streaming mode" for stdin.
*/
NuError
OpenArchiveReadOnly(NulibState* pState)
NuError OpenArchiveReadOnly(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;
@ -896,8 +880,7 @@ bail:
*
* "Streaming mode" isn't allowed.
*/
NuError
OpenArchiveReadWrite(NulibState* pState)
NuError OpenArchiveReadWrite(NulibState* pState)
{
NuError err = kNuErrNone;
NuArchive* pArchive = NULL;

View File

@ -44,8 +44,7 @@
* Open a file read-only. We abstract this so we get "r" vs "rb" right.
* (Moves this to SysUtils.c if anybody else needs it.)
*/
NuError
OpenFileReadOnly(const char* filename, FILE** pFp)
NuError OpenFileReadOnly(const char* filename, FILE** pFp)
{
NuError err = kNuErrNone;
@ -62,8 +61,7 @@ OpenFileReadOnly(const char* filename, FILE** pFp)
*
* If no filespec was provided, then all records are "specified".
*/
Boolean
NameIsSpecified(NulibState* pState, const char* filename)
Boolean NameIsSpecified(NulibState* pState, const char* filename)
{
char* const* pSpec;
int i;
@ -154,8 +152,7 @@ typedef struct BNYEntry {
/*
* Test for the magic number on a file in SQueezed format.
*/
static inline Boolean
IsSqueezed(uint8_t one, uint8_t two)
static inline Boolean IsSqueezed(uint8_t one, uint8_t two)
{
return (one == 0x76 && two == 0xff);
}
@ -163,8 +160,7 @@ IsSqueezed(uint8_t one, uint8_t two)
/*
* Test if this entry is a directory.
*/
static inline Boolean
IsDir(BNYEntry* pEntry)
static inline Boolean IsDir(BNYEntry* pEntry)
{
/*
* NuLib and "unblu.c" compared against file type 15 (DIR), so I'm
@ -178,8 +174,7 @@ IsDir(BNYEntry* pEntry)
/*
* Initialize a BNYArchive structure.
*/
static BNYArchive*
BNYInit(NulibState* pState)
static BNYArchive* BNYInit(NulibState* pState)
{
BNYArchive* pBny;
@ -194,8 +189,7 @@ BNYInit(NulibState* pState)
/*
* Free up a BNYArchive, disposing of anything inside it.
*/
static void
BNYFree(BNYArchive* pBny)
static void BNYFree(BNYArchive* pBny)
{
/* don't need to do this on stdin, but won't really hurt */
if (pBny->fp != NULL)
@ -209,8 +203,7 @@ BNYFree(BNYArchive* pBny)
* Open a Binary II archive read-only. Might be a file on disk or a
* stream on stdin.
*/
static NuError
BNYOpenReadOnly(BNYArchive* pBny)
static NuError BNYOpenReadOnly(BNYArchive* pBny)
{
NuError err = kNuErrNone;
NulibState* pState;
@ -248,8 +241,7 @@ bail:
* Wrapper for fread(). Note the arguments resemble read(2) rather
* than fread(3S).
*/
static NuError
BNYRead(BNYArchive* pBny, void* buf, size_t nbyte)
static NuError BNYRead(BNYArchive* pBny, void* buf, size_t nbyte)
{
size_t result;
@ -270,8 +262,7 @@ BNYRead(BNYArchive* pBny, void* buf, size_t nbyte)
* and don't need to special-case anything, we only allow relative
* forward seeks.
*/
static NuError
BNYSeek(BNYArchive* pBny, long offset)
static NuError BNYSeek(BNYArchive* pBny, long offset)
{
Assert(pBny != NULL);
Assert(pBny->fp != NULL);
@ -299,8 +290,8 @@ BNYSeek(BNYArchive* pBny, long offset)
/*
* Convert from ProDOS compact date format to the expanded DateTime format.
*/
static void
BNYConvertDateTime(uint16_t prodosDate, uint16_t prodosTime, NuDateTime* pWhen)
static void BNYConvertDateTime(uint16_t prodosDate, uint16_t prodosTime,
NuDateTime* pWhen)
{
pWhen->second = 0;
pWhen->minute = prodosTime & 0x3f;
@ -320,8 +311,7 @@ BNYConvertDateTime(uint16_t prodosDate, uint16_t prodosTime, NuDateTime* pWhen)
* See the File Type Note for $e0/8000 to decipher the buffer offsets
* and meanings.
*/
static NuError
BNYDecodeHeader(BNYArchive* pBny, BNYEntry* pEntry)
static NuError BNYDecodeHeader(BNYArchive* pBny, BNYEntry* pEntry)
{
NuError err = kNuErrNone;
uint8_t* raw;
@ -406,8 +396,7 @@ bail:
* We return the new path, which is stored in NulibState's temporary
* filename buffer.
*/
const char*
BNYNormalizePath(BNYArchive* pBny, BNYEntry* pEntry)
const char* BNYNormalizePath(BNYArchive* pBny, BNYEntry* pEntry)
{
NuPathnameProposal pathProposal;
NuRecord fakeRecord;
@ -448,8 +437,7 @@ BNYNormalizePath(BNYArchive* pBny, BNYEntry* pEntry)
*
* Uses pEntry->blockBuf, which already has the first 128 bytes in it.
*/
static NuError
BNYCopyBlocks(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
static NuError BNYCopyBlocks(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
{
NuError err = kNuErrNone;
long bytesLeft;
@ -542,8 +530,7 @@ typedef struct USQState {
/*
* Decode the next symbol from the Huffman stream.
*/
static NuError
USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
static NuError USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
{
short val = 0;
int bits, bitPosn;
@ -579,8 +566,7 @@ USQDecodeHuffSymbol(USQState* pUsqState, int* pVal)
/*
* Read two bytes of signed data out of the buffer.
*/
static inline NuError
USQReadShort(USQState* pUsqState, short* pShort)
static inline NuError USQReadShort(USQState* pUsqState, short* pShort)
{
if (pUsqState->dataInBuffer < 2)
return kNuErrBufferUnderrun;
@ -598,8 +584,7 @@ USQReadShort(USQState* pUsqState, short* pShort)
* Because we have a stop symbol, knowing the uncompressed length of
* the file is not essential.
*/
static NuError
BNYUnSqueeze(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
static NuError BNYUnSqueeze(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
{
NuError err = kNuErrNone;
USQState usqState;
@ -909,8 +894,7 @@ typedef NuError (*BNYIteratorFunc)(BNYArchive* pBny, BNYEntry* pEntry,
* Iterate through a Binary II archive, calling "func" to perform
* operations on the file.
*/
static NuError
BNYIterate(NulibState* pState, BNYIteratorFunc func)
static NuError BNYIterate(NulibState* pState, BNYIteratorFunc func)
{
NuError err = kNuErrNone;
BNYArchive* pBny = NULL;
@ -1023,8 +1007,8 @@ bail:
/*
* Get a quick table of contents.
*/
static NuError
BNYListShort(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
static NuError BNYListShort(BNYArchive* pBny, BNYEntry* pEntry,
Boolean* pConsumedFlag)
{
NuError err = kNuErrNone;
@ -1036,8 +1020,8 @@ BNYListShort(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
/*
* Get a verbose listing of contents.
*/
static NuError
BNYListVerbose(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
static NuError BNYListVerbose(BNYArchive* pBny, BNYEntry* pEntry,
Boolean* pConsumedFlag)
{
NuError err = kNuErrNone;
Boolean isSqueezed, isReadOnly;
@ -1102,8 +1086,8 @@ BNYListVerbose(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
/*
* Get a verbose table of contents.
*/
static NuError
BNYListDebug(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
static NuError BNYListDebug(BNYArchive* pBny, BNYEntry* pEntry,
Boolean* pConsumedFlag)
{
NuError err = kNuErrNone;
@ -1146,8 +1130,8 @@ typedef enum { kBNYExtNormal, kBNYExtPipe, kBNYExtTest } ExtMode;
/*
* Handle "extraction" of a directory.
*/
static NuError
BNYExtractDirectory(BNYArchive* pBny, BNYEntry* pEntry, ExtMode extMode)
static NuError BNYExtractDirectory(BNYArchive* pBny, BNYEntry* pEntry,
ExtMode extMode)
{
NuError err = kNuErrNone;
const char* newName;
@ -1209,8 +1193,8 @@ bail:
/*
* Handle "extract", "extract to pipe", and "test".
*/
static NuError
BNYExtract(BNYArchive* pBny, BNYEntry* pEntry, Boolean* pConsumedFlag)
static NuError BNYExtract(BNYArchive* pBny, BNYEntry* pEntry,
Boolean* pConsumedFlag)
{
NuError err = kNuErrNone;
NulibState* pState;
@ -1370,8 +1354,7 @@ bail:
* ===========================================================================
*/
NuError
BNYDoExtract(NulibState* pState)
NuError BNYDoExtract(NulibState* pState)
{
if (NState_GetModConvertText(pState) ||
NState_GetModConvertAll(pState))
@ -1402,26 +1385,22 @@ BNYDoExtract(NulibState* pState)
return BNYIterate(pState, BNYExtract);
}
NuError
BNYDoTest(NulibState* pState)
NuError BNYDoTest(NulibState* pState)
{
return BNYIterate(pState, BNYExtract);
}
NuError
BNYDoListShort(NulibState* pState)
NuError BNYDoListShort(NulibState* pState)
{
return BNYIterate(pState, BNYListShort);
}
NuError
BNYDoListVerbose(NulibState* pState)
NuError BNYDoListVerbose(NulibState* pState)
{
return BNYIterate(pState, BNYListVerbose);
}
NuError
BNYDoListDebug(NulibState* pState)
NuError BNYDoListDebug(NulibState* pState)
{
return BNYIterate(pState, BNYListDebug);
}

View File

@ -15,8 +15,7 @@
* This uses the "bulk" delete call, allowing the SelectionFilter callback
* to do the matching against specified filenames.
*/
NuError
DoDelete(NulibState* pState)
NuError DoDelete(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;

View File

@ -17,8 +17,7 @@
* show them while we're extracting the files, we have to manually find
* and extract them.
*/
static NuError
ExtractAllRecords(NulibState* pState, NuArchive* pArchive)
static NuError ExtractAllRecords(NulibState* pState, NuArchive* pArchive)
{
NuError err;
const NuRecord* pRecord;
@ -87,8 +86,7 @@ bail:
/*
* Extract the specified files.
*/
NuError
DoExtract(NulibState* pState)
NuError DoExtract(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;
@ -135,8 +133,7 @@ bail:
/*
* Extract the specified files to stdout.
*/
NuError
DoExtractToPipe(NulibState* pState)
NuError DoExtractToPipe(NulibState* pState)
{
/* we handle the "to pipe" part farther down */
return DoExtract(pState);
@ -146,8 +143,7 @@ DoExtractToPipe(NulibState* pState)
/*
* Do an integrity check on one or more records in the archive.
*/
NuError
DoTest(NulibState* pState)
NuError DoTest(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;

View File

@ -95,8 +95,7 @@ static const struct {
/*
* Return a pointer to the three-letter representation of the file type name.
*/
const char*
GetFileTypeString(uint32_t fileType)
const char* GetFileTypeString(uint32_t fileType)
{
if (fileType < NELEM(gFileTypeNames))
return gFileTypeNames[fileType];
@ -117,8 +116,7 @@ GetFileTypeString(uint32_t fileType)
* "pathBuf" is assumed to have enough space to hold the current path
* plus kMaxPathGrowth more. It will be modified in place.
*/
static void
AddPreservationString(NulibState* pState,
static void AddPreservationString(NulibState* pState,
const NuPathnameProposal* pPathProposal, char* pathBuf)
{
char extBuf[kMaxPathGrowth +1];
@ -248,8 +246,7 @@ AddPreservationString(NulibState* pState,
* This returns the new pathname, which is held in NulibState's temporary
* pathname buffer.
*/
const char*
NormalizePath(NulibState* pState, NuPathnameProposal* pPathProposal)
const char* NormalizePath(NulibState* pState, NuPathnameProposal* pPathProposal)
{
NuError err = kNuErrNone;
char* pathBuf;
@ -357,9 +354,8 @@ bail:
* This checks the standard list of ProDOS types (which should catch things
* like "TXT" and "BIN") and the separate list of recognized extensions.
*/
static void
LookupExtension(NulibState* pState, const char* ext, uint32_t* pFileType,
uint32_t* pAuxType)
static void LookupExtension(NulibState* pState, const char* ext,
uint32_t* pFileType, uint32_t* pAuxType)
{
char uext3[4];
int i, extLen;
@ -409,9 +405,8 @@ bail:
/*
* Try to associate some meaning with the file extension.
*/
void
InterpretExtension(NulibState* pState, const char* pathName, uint32_t* pFileType,
uint32_t* pAuxType)
void InterpretExtension(NulibState* pState, const char* pathName,
uint32_t* pFileType, uint32_t* pAuxType)
{
const char* pExt;
@ -434,9 +429,8 @@ InterpretExtension(NulibState* pState, const char* pathName, uint32_t* pFileType
* We have to be careful not to trip on false-positive occurrences of '#'
* in the filename.
*/
Boolean
ExtractPreservationString(NulibState* pState, char* pathname, uint32_t* pFileType,
uint32_t* pAuxType, NuThreadID* pThreadID)
Boolean ExtractPreservationString(NulibState* pState, char* pathname,
uint32_t* pFileType, uint32_t* pAuxType, NuThreadID* pThreadID)
{
char numBuf[9];
uint32_t fileType, auxType;
@ -528,8 +522,7 @@ ExtractPreservationString(NulibState* pState, char* pathname, uint32_t* pFileTyp
* This always results in the filename staying the same length or getting
* smaller, so we can do it in place in the buffer.
*/
void
DenormalizePath(NulibState* pState, char* pathBuf)
void DenormalizePath(NulibState* pState, char* pathBuf)
{
const char* srcp;
char* dstp;
@ -585,8 +578,7 @@ DenormalizePath(NulibState* pState, char* pathBuf)
*
* Always returns a pointer to a string; never returns NULL.
*/
const char*
FilenameOnly(NulibState* pState, const char* pathname)
const char* FilenameOnly(NulibState* pState, const char* pathname)
{
const char* retstr;
const char* pSlash;
@ -645,8 +637,7 @@ bail:
* Returns a pointer to the '.' preceding the extension, or NULL if no
* extension was found.
*/
const char*
FindExtension(NulibState* pState, const char* pathname)
const char* FindExtension(NulibState* pState, const char* pathname)
{
const char* pFilename;
const char* pExt;

View File

@ -40,8 +40,7 @@ static const char* gMonths[] = {
/*
* Compute a percentage.
*/
int
ComputePercent(uint32_t totalSize, uint32_t size)
int ComputePercent(uint32_t totalSize, uint32_t size)
{
int perc;
@ -69,8 +68,7 @@ ComputePercent(uint32_t totalSize, uint32_t size)
*
* Returns "buffer" for the benefit of printf() calls.
*/
char*
FormatDateShort(const NuDateTime* pDateTime, char* buffer)
char* FormatDateShort(const NuDateTime* pDateTime, char* buffer)
{
/* is it valid? */
if (pDateTime->day > 30 || pDateTime->month > 11 || pDateTime->hour > 24 ||
@ -101,8 +99,7 @@ bail:
/*
* NuStream callback function. Displays the filename.
*/
static NuResult
ShowContentsShort(NuArchive* pArchive, void* vpRecord)
static NuResult ShowContentsShort(NuArchive* pArchive, void* vpRecord)
{
const NuRecord* pRecord = (NuRecord*) vpRecord;
NulibState* pState;
@ -142,9 +139,9 @@ bail:
* will be categorized as "unknown". We could detect the situation and
* correct it, but we might as well flag it in a user-visible way.
*/
static NuError
AnalyzeRecord(const NuRecord* pRecord, enum RecordKind* pRecordKind,
uint16_t* pFormat, uint32_t* pTotalLen, uint32_t* pTotalCompLen)
static NuError AnalyzeRecord(const NuRecord* pRecord,
enum RecordKind* pRecordKind, uint16_t* pFormat, uint32_t* pTotalLen,
uint32_t* pTotalCompLen)
{
const NuThread* pThread;
NuThreadID threadID;
@ -188,8 +185,7 @@ AnalyzeRecord(const NuRecord* pRecord, enum RecordKind* pRecordKind,
* This is intended to mimic the output of some old version of ProDOS 8
* ShrinkIt.
*/
static NuResult
ShowContentsVerbose(NuArchive* pArchive, void* vpRecord)
static NuResult ShowContentsVerbose(NuArchive* pArchive, void* vpRecord)
{
NuError err = kNuErrNone;
const NuRecord* pRecord = (NuRecord*) vpRecord;
@ -279,8 +275,7 @@ bail:
/*
* Print a short listing of the contents of an archive.
*/
NuError
DoListShort(NulibState* pState)
NuError DoListShort(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;
@ -311,8 +306,7 @@ bail:
/*
* Print a more verbose listing of the contents of an archive.
*/
NuError
DoListVerbose(NulibState* pState)
NuError DoListVerbose(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;
@ -394,8 +388,7 @@ bail:
/*
* Null callback, for those times when you don't really want to do anything.
*/
static NuResult
NullCallback(NuArchive* pArchive, void* vpRecord)
static NuResult NullCallback(NuArchive* pArchive, void* vpRecord)
{
return kNuOK;
}
@ -404,8 +397,7 @@ NullCallback(NuArchive* pArchive, void* vpRecord)
* Print very detailed output, suitable for debugging (requires that
* debug messages be enabled in nufxlib).
*/
NuError
DoListDebug(NulibState* pState)
NuError DoListDebug(NulibState* pState)
{
NuError err;
NuArchive* pArchive = NULL;

View File

@ -44,8 +44,7 @@ static const ValidCombo gValidCombos[] = {
*
* Returns NULL if not found.
*/
static const ValidCombo*
FindValidComboEntry(Command cmd)
static const ValidCombo* FindValidComboEntry(Command cmd)
{
int i;
@ -61,8 +60,7 @@ FindValidComboEntry(Command cmd)
* Determine whether the specified modifier is valid when used with the
* current command.
*/
static Boolean
IsValidModifier(Command cmd, char modifier)
static Boolean IsValidModifier(Command cmd, char modifier)
{
const ValidCombo* pvc;
@ -79,8 +77,7 @@ IsValidModifier(Command cmd, char modifier)
/*
* Determine whether the specified command can be used with stdin as input.
*/
static Boolean
IsValidOnPipe(Command cmd)
static Boolean IsValidOnPipe(Command cmd)
{
const ValidCombo* pvc;
@ -94,8 +91,7 @@ IsValidOnPipe(Command cmd)
/*
* Determine whether the specified command can be used with stdin as input.
*/
static Boolean
IsFilespecRequired(Command cmd)
static Boolean IsFilespecRequired(Command cmd)
{
const ValidCombo* pvc;
@ -114,8 +110,7 @@ IsFilespecRequired(Command cmd)
/*
* Separate the program name out of argv[0].
*/
static const char*
GetProgName(const NulibState* pState, const char* argv0)
static const char* GetProgName(const NulibState* pState, const char* argv0)
{
const char* result;
char sep;
@ -136,8 +131,7 @@ GetProgName(const NulibState* pState, const char* argv0)
/*
* Print program usage.
*/
static void
Usage(const NulibState* pState)
static void Usage(const NulibState* pState)
{
long majorVersion, minorVersion, bugVersion;
const char* nufxLibDate;
@ -184,8 +178,7 @@ Usage(const NulibState* pState)
/*
* Handle the "-h" command.
*/
NuError
DoHelp(const NulibState* pState)
NuError DoHelp(const NulibState* pState)
{
static const struct {
Command cmd;
@ -315,8 +308,7 @@ DoHelp(const NulibState* pState)
/*
* Process the command-line options. The results are placed into "pState".
*/
static int
ProcessOptions(NulibState* pState, int argc, char* const* argv)
static int ProcessOptions(NulibState* pState, int argc, char* const* argv)
{
const char* cp;
int idx;
@ -511,8 +503,7 @@ fail:
*
* Returns 0 on success, 1 on error.
*/
int
DoWork(NulibState* pState)
int DoWork(NulibState* pState)
{
NuError err;
@ -558,8 +549,7 @@ DoWork(NulibState* pState)
/*
* Entry point.
*/
int
main(int argc, char** argv)
int main(int argc, char** argv)
{
NulibState* pState = NULL;
long majorVersion, minorVersion, bugVersion;

View File

@ -16,8 +16,7 @@
* Return a pointer to the appropriate string in the system table, or NULL
* if the value is out of bounds.
*/
const char*
Nu_strerror(int errnum)
const char* Nu_strerror(int errnum)
{
extern int sys_nerr;
extern char *sys_errlist[];
@ -38,8 +37,7 @@ Nu_strerror(int errnum)
* from BSD, is available in the PGP 2.6.2 distribution, but this should
* suffice for those few systems that don't have memmove.
*/
void*
Nu_memmove(void* dst, const void* src, size_t n)
void* Nu_memmove(void* dst, const void* src, size_t n)
{
void* retval = dst;
char* srcp = (char*)src;
@ -80,8 +78,7 @@ Nu_memmove(void* dst, const void* src, size_t n)
* For our purposes here, strtol does all we need it to. Someday
* we should replace this with a "real" version.
*/
unsigned long
Nu_strtoul(const char *nptr, char **endptr, int base)
unsigned long Nu_strtoul(const char *nptr, char **endptr, int base)
{
return strtol(nptr, endptr, base);
}
@ -91,8 +88,7 @@ Nu_strtoul(const char *nptr, char **endptr, int base)
/*
* Compare two strings, case-insensitive.
*/
int
Nu_strcasecmp(const char *str1, const char *str2)
int Nu_strcasecmp(const char *str1, const char *str2)
{
while (*str1 && *str2 && toupper(*str1) == toupper(*str2))
str1++, str2++;
@ -105,8 +101,7 @@ Nu_strcasecmp(const char *str1, const char *str2)
/*
* Compare two strings, case-insensitive, stopping after "n" chars.
*/
int
Nu_strncasecmp(const char *str1, const char *str2, size_t n)
int Nu_strncasecmp(const char *str1, const char *str2, size_t n)
{
while (n && *str1 && *str2 && toupper(*str1) == toupper(*str2))
str1++, str2++, n--;

View File

@ -16,8 +16,7 @@
*
* If "format" is NULL, just the error message itself is printed.
*/
void
ReportError(NuError err, const char* format, ...)
void ReportError(NuError err, const char* format, ...)
{
const char* msg;
va_list args;
@ -62,8 +61,7 @@ ReportError(NuError err, const char* format, ...)
*/
#ifndef USE_DMALLOC
void*
Malloc(size_t size)
void* Malloc(size_t size)
{
void* _result;
@ -77,16 +75,14 @@ Malloc(size_t size)
return _result;
}
void*
Calloc(size_t size)
void* Calloc(size_t size)
{
void* _cresult = Malloc(size);
memset(_cresult, 0, size);
return _cresult;
}
void*
Realloc(void* ptr, size_t size)
void* Realloc(void* ptr, size_t size)
{
void* _result;
@ -100,8 +96,7 @@ Realloc(void* ptr, size_t size)
return _result;
}
void
Free(void* ptr)
void Free(void* ptr)
{
if (ptr != NULL)
free(ptr);
@ -111,8 +106,7 @@ Free(void* ptr)
/*
* This gets called when a buffer DataSource is no longer needed.
*/
NuResult
FreeCallback(NuArchive* pArchive, void* args)
NuResult FreeCallback(NuArchive* pArchive, void* args)
{
DBUG(("+++ free callback 0x%08lx\n", (long) args));
Free(args);

View File

@ -15,8 +15,7 @@ static const char* gProgramVersion = "2.2.2";
/*
* Allocate and initialize the semi-global Nulib2 state object.
*/
NuError
NState_Init(NulibState** ppState)
NuError NState_Init(NulibState** ppState)
{
Assert(ppState != NULL);
@ -41,8 +40,7 @@ NState_Init(NulibState** ppState)
/*
* A little extra initialization, performed after arguments are parsed.
*/
NuError
NState_ExtraInit(NulibState* pState)
NuError NState_ExtraInit(NulibState* pState)
{
NuError err;
NuValue convertEOL;
@ -74,8 +72,7 @@ NState_ExtraInit(NulibState* pState)
/*
* Free up the state structure and its contents.
*/
void
NState_Free(NulibState* pState)
void NState_Free(NulibState* pState)
{
if (pState == NULL)
return;
@ -91,8 +88,7 @@ NState_Free(NulibState* pState)
#ifdef DEBUG_MSGS
void
NState_DebugDump(const NulibState* pState)
void NState_DebugDump(const NulibState* pState)
{
/* this table will break if the code changes, but it's just for debugging */
static const char* kCommandNames[] = {
@ -162,139 +158,117 @@ NState_DebugDump(const NulibState* pState)
* ===========================================================================
*/
char
NState_GetSystemPathSeparator(const NulibState* pState)
char NState_GetSystemPathSeparator(const NulibState* pState)
{
return pState->systemPathSeparator;
}
char
NState_GetAltSystemPathSeparator(const NulibState* pState)
char NState_GetAltSystemPathSeparator(const NulibState* pState)
{
return pState->altSystemPathSeparator;
}
const char*
NState_GetProgramVersion(const NulibState* pState)
const char* NState_GetProgramVersion(const NulibState* pState)
{
return pState->programVersion;
}
NuArchive*
NState_GetNuArchive(const NulibState* pState)
NuArchive* NState_GetNuArchive(const NulibState* pState)
{
return pState->pArchive;
}
void
NState_SetNuArchive(NulibState* pState, NuArchive* pArchive)
void NState_SetNuArchive(NulibState* pState, NuArchive* pArchive)
{
pState->pArchive = pArchive;
}
Boolean
NState_GetSuppressOutput(const NulibState* pState)
Boolean NState_GetSuppressOutput(const NulibState* pState)
{
return pState->suppressOutput;
}
void
NState_SetSuppressOutput(NulibState* pState, Boolean doSuppress)
void NState_SetSuppressOutput(NulibState* pState, Boolean doSuppress)
{
pState->suppressOutput = doSuppress;
}
Boolean
NState_GetInputUnavailable(const NulibState* pState)
Boolean NState_GetInputUnavailable(const NulibState* pState)
{
return pState->inputUnavailable;
}
void
NState_SetInputUnavailable(NulibState* pState, Boolean isUnavailable)
void NState_SetInputUnavailable(NulibState* pState, Boolean isUnavailable)
{
pState->inputUnavailable = isUnavailable;
}
NuRecordIdx
NState_GetRenameFromIdx(const NulibState* pState)
NuRecordIdx NState_GetRenameFromIdx(const NulibState* pState)
{
return pState->renameFromIdx;
}
void
NState_SetRenameFromIdx(NulibState* pState, NuRecordIdx recordIdx)
void NState_SetRenameFromIdx(NulibState* pState, NuRecordIdx recordIdx)
{
pState->renameFromIdx = recordIdx;
}
char*
NState_GetRenameToStr(const NulibState* pState)
char* NState_GetRenameToStr(const NulibState* pState)
{
return pState->renameToStr;
}
void
NState_SetRenameToStr(NulibState* pState, char* str)
void NState_SetRenameToStr(NulibState* pState, char* str)
{
Free(pState->renameToStr);
pState->renameToStr = str;
}
NuDataSink*
NState_GetPipeSink(const NulibState* pState)
NuDataSink* NState_GetPipeSink(const NulibState* pState)
{
return pState->pPipeSink;
}
NuDataSink*
NState_GetCommentSink(const NulibState* pState)
NuDataSink* NState_GetCommentSink(const NulibState* pState)
{
return pState->pCommentSink;
}
long
NState_GetMatchCount(const NulibState* pState)
long NState_GetMatchCount(const NulibState* pState)
{
return pState->matchCount;
}
void
NState_SetMatchCount(NulibState* pState, long count)
void NState_SetMatchCount(NulibState* pState, long count)
{
pState->matchCount = count;
}
void
NState_IncMatchCount(NulibState* pState)
void NState_IncMatchCount(NulibState* pState)
{
pState->matchCount++;
}
void
NState_AddToTotals(NulibState* pState, long len, long compLen)
void NState_AddToTotals(NulibState* pState, long len, long compLen)
{
pState->totalLen += len;
pState->totalCompLen += compLen;
}
void
NState_GetTotals(NulibState* pState, long* pTotalLen, long* pTotalCompLen)
void NState_GetTotals(NulibState* pState, long* pTotalLen, long* pTotalCompLen)
{
*pTotalLen = pState->totalLen;
*pTotalCompLen = pState->totalCompLen;
}
long
NState_GetTempPathnameLen(NulibState* pState)
long NState_GetTempPathnameLen(NulibState* pState)
{
return pState->tempPathnameAlloc;
}
void
NState_SetTempPathnameLen(NulibState* pState, long len)
void NState_SetTempPathnameLen(NulibState* pState, long len)
{
char* newBuf;
@ -319,237 +293,198 @@ NState_SetTempPathnameLen(NulibState* pState, long len)
}
}
char*
NState_GetTempPathnameBuf(NulibState* pState)
char* NState_GetTempPathnameBuf(NulibState* pState)
{
return pState->tempPathnameBuf;
}
Command
NState_GetCommand(const NulibState* pState)
Command NState_GetCommand(const NulibState* pState)
{
return pState->command;
}
void
NState_SetCommand(NulibState* pState, Command cmd)
void NState_SetCommand(NulibState* pState, Command cmd)
{
pState->command = cmd;
}
const char*
NState_GetArchiveFilename(const NulibState* pState)
const char* NState_GetArchiveFilename(const NulibState* pState)
{
return pState->archiveFilename;
}
void
NState_SetArchiveFilename(NulibState* pState, const char* archiveFilename)
void NState_SetArchiveFilename(NulibState* pState, const char* archiveFilename)
{
pState->archiveFilename = archiveFilename;
}
char* const*
NState_GetFilespecPointer(const NulibState* pState)
char* const* NState_GetFilespecPointer(const NulibState* pState)
{
return pState->filespecPointer;
}
void
NState_SetFilespecPointer(NulibState* pState, char* const* filespecPointer)
void NState_SetFilespecPointer(NulibState* pState, char* const* filespecPointer)
{
pState->filespecPointer = filespecPointer;
}
long
NState_GetFilespecCount(const NulibState* pState)
long NState_GetFilespecCount(const NulibState* pState)
{
return pState->filespecCount;
}
void
NState_SetFilespecCount(NulibState* pState, long filespecCount)
void NState_SetFilespecCount(NulibState* pState, long filespecCount)
{
pState->filespecCount = filespecCount;
}
Boolean
NState_GetModUpdate(const NulibState* pState)
Boolean NState_GetModUpdate(const NulibState* pState)
{
return pState->modUpdate;
}
void
NState_SetModUpdate(NulibState* pState, Boolean val)
void NState_SetModUpdate(NulibState* pState, Boolean val)
{
pState->modUpdate = val;
}
Boolean
NState_GetModFreshen(const NulibState* pState)
Boolean NState_GetModFreshen(const NulibState* pState)
{
return pState->modFreshen;
}
void
NState_SetModFreshen(NulibState* pState, Boolean val)
void NState_SetModFreshen(NulibState* pState, Boolean val)
{
pState->modFreshen = val;
}
Boolean
NState_GetModRecurse(const NulibState* pState)
Boolean NState_GetModRecurse(const NulibState* pState)
{
return pState->modRecurse;
}
void
NState_SetModRecurse(NulibState* pState, Boolean val)
void NState_SetModRecurse(NulibState* pState, Boolean val)
{
pState->modRecurse = val;
}
Boolean
NState_GetModJunkPaths(const NulibState* pState)
Boolean NState_GetModJunkPaths(const NulibState* pState)
{
return pState->modJunkPaths;
}
void
NState_SetModJunkPaths(NulibState* pState, Boolean val)
void NState_SetModJunkPaths(NulibState* pState, Boolean val)
{
pState->modJunkPaths = val;
}
Boolean
NState_GetModNoCompression(const NulibState* pState)
Boolean NState_GetModNoCompression(const NulibState* pState)
{
return pState->modNoCompression;
}
void
NState_SetModNoCompression(NulibState* pState, Boolean val)
void NState_SetModNoCompression(NulibState* pState, Boolean val)
{
pState->modNoCompression = val;
}
Boolean
NState_GetModCompressDeflate(const NulibState* pState)
Boolean NState_GetModCompressDeflate(const NulibState* pState)
{
return pState->modCompressDeflate;
}
void
NState_SetModCompressDeflate(NulibState* pState, Boolean val)
void NState_SetModCompressDeflate(NulibState* pState, Boolean val)
{
pState->modCompressDeflate = val;
}
Boolean
NState_GetModCompressBzip2(const NulibState* pState)
Boolean NState_GetModCompressBzip2(const NulibState* pState)
{
return pState->modCompressBzip2;
}
void
NState_SetModCompressBzip2(NulibState* pState, Boolean val)
void NState_SetModCompressBzip2(NulibState* pState, Boolean val)
{
pState->modCompressBzip2 = val;
}
Boolean
NState_GetModComments(const NulibState* pState)
Boolean NState_GetModComments(const NulibState* pState)
{
return pState->modComments;
}
void
NState_SetModComments(NulibState* pState, Boolean val)
void NState_SetModComments(NulibState* pState, Boolean val)
{
pState->modComments = val;
}
Boolean
NState_GetModBinaryII(const NulibState* pState)
Boolean NState_GetModBinaryII(const NulibState* pState)
{
return pState->modBinaryII;
}
void
NState_SetModBinaryII(NulibState* pState, Boolean val)
void NState_SetModBinaryII(NulibState* pState, Boolean val)
{
pState->modBinaryII = val;
}
Boolean
NState_GetModConvertText(const NulibState* pState)
Boolean NState_GetModConvertText(const NulibState* pState)
{
return pState->modConvertText;
}
void
NState_SetModConvertText(NulibState* pState, Boolean val)
void NState_SetModConvertText(NulibState* pState, Boolean val)
{
pState->modConvertText = val;
}
Boolean
NState_GetModConvertAll(const NulibState* pState)
Boolean NState_GetModConvertAll(const NulibState* pState)
{
return pState->modConvertAll;
}
void
NState_SetModConvertAll(NulibState* pState, Boolean val)
void NState_SetModConvertAll(NulibState* pState, Boolean val)
{
pState->modConvertAll = val;
}
Boolean
NState_GetModOverwriteExisting(const NulibState* pState)
Boolean NState_GetModOverwriteExisting(const NulibState* pState)
{
return pState->modOverwriteExisting;
}
void
NState_SetModOverwriteExisting(NulibState* pState, Boolean val)
void NState_SetModOverwriteExisting(NulibState* pState, Boolean val)
{
pState->modOverwriteExisting = val;
}
Boolean
NState_GetModAddAsDisk(const NulibState* pState)
Boolean NState_GetModAddAsDisk(const NulibState* pState)
{
return pState->modAddAsDisk;
}
void
NState_SetModAddAsDisk(NulibState* pState, Boolean val)
void NState_SetModAddAsDisk(NulibState* pState, Boolean val)
{
pState->modAddAsDisk = val;
}
Boolean
NState_GetModPreserveType(const NulibState* pState)
Boolean NState_GetModPreserveType(const NulibState* pState)
{
return pState->modPreserveType;
}
void
NState_SetModPreserveType(NulibState* pState, Boolean val)
void NState_SetModPreserveType(NulibState* pState, Boolean val)
{
pState->modPreserveType = val;
}
Boolean
NState_GetModPreserveTypeExtended(const NulibState* pState)
Boolean NState_GetModPreserveTypeExtended(const NulibState* pState)
{
return pState->modPreserveTypeExtended;
}
void
NState_SetModPreserveTypeExtended(NulibState* pState, Boolean val)
void NState_SetModPreserveTypeExtended(NulibState* pState, Boolean val)
{
pState->modPreserveTypeExtended = val;
}

View File

@ -71,9 +71,8 @@
* as well just let the filesystem truncate if it gets too long, rather
* than worry about truncating it cleverly.
*/
static NuError
UNIXNormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen)
static NuError UNIXNormalizeFileName(NulibState* pState, const char* srcp,
long srcLen, char fssep, char** pDstp, long dstLen)
{
char* dstp = *pDstp;
@ -130,9 +129,8 @@ static const char* fatReservedNames4[] = {
/*
* Filename normalization for Win32 filesystems. You can't use [ \/:*?"<>| ].
*/
static NuError
Win32NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen)
static NuError Win32NormalizeFileName(NulibState* pState, const char* srcp,
long srcLen, char fssep, char** pDstp, long dstLen)
{
char* dstp = *pDstp;
const char* startp = srcp;
@ -219,8 +217,7 @@ Win32NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
*
* The output buffer must be able to hold 3x the original string length.
*/
NuError
NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
NuError NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen)
{
NuError err;
@ -247,9 +244,8 @@ NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
/*
* Normalize a directory name to local filesystem conventions.
*/
NuError
NormalizeDirectoryName(NulibState* pState, const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen)
NuError NormalizeDirectoryName(NulibState* pState, const char* srcp,
long srcLen, char fssep, char** pDstp, long dstLen)
{
/* in general, directories and filenames are the same */
return NormalizeFileName(pState, srcp, srcLen, fssep, pDstp, dstLen);
@ -265,8 +261,7 @@ NormalizeDirectoryName(NulibState* pState, const char* srcp, long srcLen,
* under GS/OS it has to be in the same directory. Not sure what Mac OS
* or Windows requires, so it's safest to just put it in the same dir.
*/
char*
MakeTempArchiveName(NulibState* pState)
char* MakeTempArchiveName(NulibState* pState)
{
const char* archivePathname;
char fssep;
@ -353,9 +348,8 @@ bail:
*
* [ Someday we may want to modify this to handle symbolic links. ]
*/
NuError
CheckFileStatus(const char* pathname, struct stat* psb, Boolean* pExists,
Boolean* pIsReadable, Boolean* pIsDir)
NuError CheckFileStatus(const char* pathname, struct stat* psb,
Boolean* pExists, Boolean* pIsReadable, Boolean* pIsDir)
{
NuError err = kNuErrNone;
int cc;
@ -398,8 +392,7 @@ bail:
/*
* Convert from time in seconds to DateTime format.
*/
static void
UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
static void UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
{
struct tm* ptm;
@ -423,8 +416,7 @@ UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime)
* Replace "oldc" with "newc". If we find an instance of "newc" already
* in the string, replace it with "newSubst".
*/
static void
ReplaceFssep(char* str, char oldc, char newc, char newSubst)
static void ReplaceFssep(char* str, char oldc, char newc, char newSubst)
{
while (*str != '\0') {
if (*str == oldc)
@ -439,9 +431,8 @@ ReplaceFssep(char* str, char oldc, char newc, char newSubst)
* Set the contents of a NuFileDetails structure, based on the pathname
* and characteristics of the file.
*/
static NuError
GetFileDetails(NulibState* pState, const char* pathname, struct stat* psb,
NuFileDetails* pDetails)
static NuError GetFileDetails(NulibState* pState, const char* pathname,
struct stat* psb, NuFileDetails* pDetails)
{
Boolean wasPreserved;
Boolean doJunk = false;
@ -621,8 +612,7 @@ GetFileDetails(NulibState* pState, const char* pathname, struct stat* psb,
* Do the system-independent part of the file add, including things like
* adding comments.
*/
NuError
DoAddFile(NulibState* pState, NuArchive* pArchive, const char* pathname,
NuError DoAddFile(NulibState* pState, NuArchive* pArchive, const char* pathname,
const NuFileDetails* pDetails)
{
NuError err;
@ -707,8 +697,8 @@ static NuError UNIXAddFile(NulibState* pState, NuArchive* pArchive,
* If a subdirectory is found, follow it; otherwise, call UNIXAddFile to
* add the file.
*/
static NuError
UNIXAddDirectory(NulibState* pState, NuArchive* pArchive, const char* dirName)
static NuError UNIXAddDirectory(NulibState* pState, NuArchive* pArchive,
const char* dirName)
{
NuError err = kNuErrNone;
DIR* dirp = NULL;
@ -775,8 +765,8 @@ bail:
*
* Returns with an error if the file doesn't exist or isn't readable.
*/
static NuError
UNIXAddFile(NulibState* pState, NuArchive* pArchive, const char* pathname)
static NuError UNIXAddFile(NulibState* pState, NuArchive* pArchive,
const char* pathname)
{
NuError err = kNuErrNone;
Boolean exists, isDir, isReadable;
@ -848,8 +838,7 @@ static const char* kWildMatchAll = "*.*";
/*
* Prepare a directory for reading.
*/
static Win32dirent*
OpenDir(const char* name)
static Win32dirent* OpenDir(const char* name)
{
Win32dirent* dir = NULL;
char* tmpStr = NULL;
@ -896,8 +885,7 @@ failed:
*
* Returns a NULL pointer after the last entry has been read.
*/
static Win32dirent*
ReadDir(Win32dirent* dir)
static Win32dirent* ReadDir(Win32dirent* dir)
{
if (dir->d_first)
dir->d_first = 0;
@ -916,8 +904,7 @@ ReadDir(Win32dirent* dir)
/*
* Close a directory.
*/
static void
CloseDir(Win32dirent* dir)
static void CloseDir(Win32dirent* dir)
{
if (dir == NULL)
return;
@ -939,8 +926,8 @@ static NuError Win32AddFile(NulibState* pState, NuArchive* pArchive,
* If a subdirectory is found, follow it; otherwise, call Win32AddFile to
* add the file.
*/
static NuError
Win32AddDirectory(NulibState* pState, NuArchive* pArchive, const char* dirName)
static NuError Win32AddDirectory(NulibState* pState, NuArchive* pArchive,
const char* dirName)
{
NuError err = kNuErrNone;
Win32dirent* dirp = NULL;
@ -1005,8 +992,8 @@ bail:
*
* Returns with an error if the file doesn't exist or isn't readable.
*/
static NuError
Win32AddFile(NulibState* pState, NuArchive* pArchive, const char* pathname)
static NuError Win32AddFile(NulibState* pState, NuArchive* pArchive,
const char* pathname)
{
NuError err = kNuErrNone;
Boolean exists, isDir, isReadable;
@ -1076,8 +1063,7 @@ bail_quiet:
* from the directory read call and won't have to check it again in
* GSOSAddFile. ]
*/
NuError
AddFile(NulibState* pState, NuArchive* pArchive, const char* pathname)
NuError AddFile(NulibState* pState, NuArchive* pArchive, const char* pathname)
{
#if defined(UNIX_LIKE)
return UNIXAddFile(pState, pArchive, pathname);
@ -1094,8 +1080,7 @@ AddFile(NulibState* pState, NuArchive* pArchive, const char* pathname)
*
* Currently only used by Binary2.c.
*/
NuError
Mkdir(const char* dir)
NuError Mkdir(const char* dir)
{
NuError err = kNuErrNone;
@ -1126,8 +1111,7 @@ bail:
*
* Currently only used by Binary2.c.
*/
NuError
TestFileExistence(const char* fileName, Boolean* pIsDir)
NuError TestFileExistence(const char* fileName, Boolean* pIsDir)
{
NuError err = kNuErrNone;
Assert(fileName != NULL);
@ -1160,4 +1144,3 @@ bail:
return err;
}