mirror of
https://github.com/fadden/nulib2.git
synced 2024-12-27 17:29:57 +00:00
Added support for 12-bit and 16-bit LZC (UNIX "compress") compression format.
This commit is contained in:
parent
105c85fcd6
commit
18a61d2d31
@ -1,3 +1,6 @@
|
||||
2002/09/27 fadden
|
||||
- added support for 12-bit and 16-bit LZC (UNIX compress)
|
||||
|
||||
2002/09/26 fadden
|
||||
- added support for SQueezed files (both compress and expand)
|
||||
|
||||
|
@ -195,7 +195,16 @@ Nu_CompressToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
|
||||
err = Nu_CompressLZW2(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
case kNuThreadFormatLZC12:
|
||||
err = Nu_CompressLZC12(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
case kNuThreadFormatLZC16:
|
||||
err = Nu_CompressLZC16(pArchive, pStraw, dstFp, srcLen, &dstLen,
|
||||
&threadCrc);
|
||||
break;
|
||||
default:
|
||||
/* should've been blocked in Value.c */
|
||||
Assert(0);
|
||||
err = kNuErrInternal;
|
||||
goto bail;
|
||||
|
@ -171,9 +171,7 @@ Nu_ExpandStream(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
break;
|
||||
case kNuThreadFormatLZC12:
|
||||
case kNuThreadFormatLZC16:
|
||||
err = kNuErrBadFormat;
|
||||
Nu_ReportError(NU_BLOB, kNuErrNone,
|
||||
"LZC-compressed threads not supported");
|
||||
err = Nu_ExpandLZC(pArchive, pRecord, pThread, infp, pFunnel, pCalcCrc);
|
||||
break;
|
||||
default:
|
||||
err = kNuErrBadFormat;
|
||||
@ -190,7 +188,7 @@ Nu_ExpandStream(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
if (pCalcCrc != nil) {
|
||||
if (calcCrc != pThread->thThreadCRC) {
|
||||
if (!Nu_ShouldIgnoreBadCRC(pArchive, pRecord, kNuErrBadThreadCRC)) {
|
||||
err = kNuErrBadThreadCRC;
|
||||
err = kNuErrBadDataCRC;
|
||||
Nu_ReportError(NU_BLOB, err, "expected 0x%04x, got 0x%04x",
|
||||
pThread->thThreadCRC, calcCrc);
|
||||
goto bail;
|
||||
|
@ -27,11 +27,13 @@ GCC_FLAGS = -Wall -Wwrite-strings -Wstrict-prototypes -Wpointer-arith -Wshadow
|
||||
CFLAGS = @BUILD_FLAGS@ -I. @DEFS@
|
||||
|
||||
SRCS = Archive.c ArchiveIO.c Compress.c Crc16.c Debug.c Deferred.c \
|
||||
Entry.c Expand.c FileIO.c Funnel.c Lzw.c MiscStuff.c MiscUtils.c \
|
||||
Record.c SourceSink.c Squeeze.c Thread.c Value.c Version.c
|
||||
Entry.c Expand.c FileIO.c Funnel.c Lzc.c Lzw.c MiscStuff.c \
|
||||
MiscUtils.c Record.c SourceSink.c Squeeze.c Thread.c Value.c \
|
||||
Version.c
|
||||
OBJS = Archive.o ArchiveIO.o Compress.o Crc16.o Debug.o Deferred.o \
|
||||
Entry.o Expand.o FileIO.o Funnel.o Lzw.o MiscStuff.o MiscUtils.o \
|
||||
Record.o SourceSink.o Squeeze.o Thread.o Value.o Version.o
|
||||
Entry.o Expand.o FileIO.o Funnel.o Lzc.o Lzw.o MiscStuff.o \
|
||||
MiscUtils.o Record.o SourceSink.o Squeeze.o Thread.o Value.o \
|
||||
Version.o
|
||||
|
||||
STATIC_PRODUCT = libnufx.a
|
||||
SHARED_PRODUCT = libnufx.so
|
||||
|
@ -631,13 +631,21 @@ NuError Nu_StrawRead(NuArchive* pArchive, NuStraw* pStraw, uchar* buffer,
|
||||
long len);
|
||||
NuError Nu_StrawRewind(NuArchive* pArchive, NuStraw* pStraw);
|
||||
|
||||
/* Lzc.c */
|
||||
NuError Nu_CompressLZC12(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc);
|
||||
NuError Nu_CompressLZC16(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc);
|
||||
NuError Nu_ExpandLZC(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, ushort* pThreadCrc);
|
||||
|
||||
/* Lzw.c */
|
||||
NuError Nu_CompressLZW1(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc);
|
||||
NuError Nu_CompressLZW2(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
|
||||
ulong srcLen, ulong* pDstLen, ushort* pCrc);
|
||||
NuError Nu_ExpandLZW(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, ushort* pCrc);
|
||||
const NuThread* pThread, FILE* infp, NuFunnel* pFunnel, ushort* pThreadCrc);
|
||||
|
||||
/* MiscUtils.c */
|
||||
extern const char* kNufxLibName;
|
||||
|
@ -208,10 +208,8 @@ Nu_ConvertCompressValToFormat(NuArchive* pArchive, NuValue compValue)
|
||||
case kNuCompressLZW1: threadFormat = kNuThreadFormatLZW1; break;
|
||||
case kNuCompressLZW2: threadFormat = kNuThreadFormatLZW2; break;
|
||||
case kNuCompressSQ: threadFormat = kNuThreadFormatHuffmanSQ; break;
|
||||
case kNuCompressLZC12: threadFormat = kNuThreadFormatLZC12;
|
||||
unsup = true; break;
|
||||
case kNuCompressLZC16: threadFormat = kNuThreadFormatLZC16;
|
||||
unsup = true; break;
|
||||
case kNuCompressLZC12: threadFormat = kNuThreadFormatLZC12; break;
|
||||
case kNuCompressLZC16: threadFormat = kNuThreadFormatLZC16; break;
|
||||
default:
|
||||
Assert(false);
|
||||
Nu_ReportError(NU_BLOB, kNuErrInvalidArg,
|
||||
@ -221,7 +219,7 @@ Nu_ConvertCompressValToFormat(NuArchive* pArchive, NuValue compValue)
|
||||
|
||||
if (unsup) {
|
||||
Nu_ReportError(NU_BLOB, kNuErrNone,
|
||||
"Unsupported compression type 0x%04x requested (%ld)",
|
||||
"Unsupported compression type 0x%04x requested (%ld), using none",
|
||||
threadFormat, compValue);
|
||||
return kNuThreadFormatUncompressed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user