mirror of
https://github.com/fadden/nulib2.git
synced 2024-12-27 17:29:57 +00:00
Added support for "ignore LZW/II length" flag.
Now at version 2.1.0.
This commit is contained in:
parent
d8b35fd9c6
commit
987ce8855e
@ -96,6 +96,7 @@ Nu_NuArchiveNew(NuArchive** ppArchive)
|
||||
(*ppArchive)->valStripHighASCII = false;
|
||||
/* bug: this can't be set by application! */
|
||||
(*ppArchive)->valJunkSkipMax = kDefaultJunkSkipMax;
|
||||
(*ppArchive)->valIgnoreLZW2Len = false;
|
||||
|
||||
(*ppArchive)->messageHandlerFunc = gNuGlobalErrorMessageHandler;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2005/09/17 fadden
|
||||
- Added "kNuValIgnoreLZW2Len" flag, which enables NuLib2 to handle
|
||||
archives created by an unknown but badly broken program.
|
||||
- Fixed build for gcc v4.0.
|
||||
|
||||
2004/10/11 ***** v2.0.3 shipped *****
|
||||
|
||||
2004/09/25 fadden
|
||||
|
@ -1200,7 +1200,7 @@ main_loop:
|
||||
|
||||
bail:
|
||||
/*DBUG_LZW(("### end of block\n"));*/
|
||||
if (inbuf != inbufend) {
|
||||
if (expectedInputUsed != (unsigned int) -1 && inbuf != inbufend) {
|
||||
/* data was corrupted; if we keep going this will get worse */
|
||||
DBUG(("--- inbuf != inbufend in ExpandLZW2 (diff=%d)\n",
|
||||
inbufend - inbuf));
|
||||
@ -1481,7 +1481,11 @@ Nu_ExpandLZW(NuArchive* pArchive, const NuRecord* pRecord,
|
||||
if (!isType2) {
|
||||
err = Nu_ExpandLZW1(lzwState, rleLen);
|
||||
} else {
|
||||
if (lzwState->dataInBuffer < lzwLen) {
|
||||
if (pArchive->valIgnoreLZW2Len) {
|
||||
/* some badly-formed archives need this -- not sure
|
||||
what's creating them, possibly a Mac program */
|
||||
lzwLen = (unsigned int) -1;
|
||||
} else if (lzwState->dataInBuffer < lzwLen) {
|
||||
/* rare -- GSHK will do this if you don't let it finish */
|
||||
err = kNuErrBufferUnderrun;
|
||||
Nu_ReportError(NU_BLOB, err, "not enough compressed data "
|
||||
|
@ -32,8 +32,8 @@ extern "C" {
|
||||
* fixes.
|
||||
*/
|
||||
#define kNuVersionMajor 2
|
||||
#define kNuVersionMinor 0
|
||||
#define kNuVersionBug 3
|
||||
#define kNuVersionMinor 1
|
||||
#define kNuVersionBug 0
|
||||
|
||||
|
||||
/*
|
||||
@ -269,7 +269,8 @@ typedef enum NuValueID {
|
||||
kNuValueMimicSHK = 10,
|
||||
kNuValueMaskDataless = 11,
|
||||
kNuValueStripHighASCII = 12,
|
||||
kNuValueJunkSkipMax = 13
|
||||
kNuValueJunkSkipMax = 13,
|
||||
kNuValueIgnoreLZW2Len = 14
|
||||
} NuValueID;
|
||||
typedef unsigned long NuValue;
|
||||
|
||||
|
@ -156,6 +156,7 @@ struct NuArchive {
|
||||
NuValue valOnlyUpdateOlder; /* modify original arc in place? */
|
||||
NuValue valStripHighASCII; /* during EOL conv, strip hi bit? */
|
||||
NuValue valJunkSkipMax; /* scan this far for header */
|
||||
NuValue valIgnoreLZW2Len; /* don't verify LZW/II len field */
|
||||
|
||||
/* callback functions */
|
||||
NuCallback selectionFilterFunc;
|
||||
|
@ -62,6 +62,9 @@ Nu_GetValue(NuArchive* pArchive, NuValueID ident, NuValue* pValue)
|
||||
case kNuValueJunkSkipMax:
|
||||
*pValue = pArchive->valJunkSkipMax;
|
||||
break;
|
||||
case kNuValueIgnoreLZW2Len:
|
||||
*pValue = pArchive->valIgnoreLZW2Len;
|
||||
break;
|
||||
default:
|
||||
err = kNuErrInvalidArg;
|
||||
Nu_ReportError(NU_BLOB, err, "Unknown ValueID %d requested", ident);
|
||||
@ -186,6 +189,14 @@ Nu_SetValue(NuArchive* pArchive, NuValueID ident, NuValue value)
|
||||
}
|
||||
pArchive->valJunkSkipMax = value;
|
||||
break;
|
||||
case kNuValueIgnoreLZW2Len:
|
||||
if (value != true && value != false) {
|
||||
Nu_ReportError(NU_BLOB, err,
|
||||
"Invalid kNuValueIgnoreLZW2Len value %ld", value);
|
||||
goto bail;
|
||||
}
|
||||
pArchive->valIgnoreLZW2Len = value;
|
||||
break;
|
||||
default:
|
||||
Nu_ReportError(NU_BLOB, err, "Unknown ValueID %d requested", ident);
|
||||
goto bail;
|
||||
|
Loading…
Reference in New Issue
Block a user