fixed multiple minor warnings for XCode
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ INCLUDEDIR=$(PREFIX)/include
|
|||||||
CPPFLAGS= -I. -I./common
|
CPPFLAGS= -I. -I./common
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \
|
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \
|
||||||
-Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef
|
-Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wdocumentation
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -503,7 +503,7 @@ MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePt
|
|||||||
BIT_flushBits(bitC);
|
BIT_flushBits(bitC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*<===== Decompression =====>*/
|
/* ====== Decompression ====== */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
U16 tableLog;
|
U16 tableLog;
|
||||||
|
|||||||
@@ -2599,7 +2599,7 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity)
|
|||||||
BYTE* op = ostart;
|
BYTE* op = ostart;
|
||||||
size_t fhSize = 0;
|
size_t fhSize = 0;
|
||||||
|
|
||||||
if (cctx->stage == ZSTDcs_created) return ERROR(stage_wrong); /*< not even init ! */
|
if (cctx->stage == ZSTDcs_created) return ERROR(stage_wrong); /* init missing */
|
||||||
|
|
||||||
/* special case : empty frame */
|
/* special case : empty frame */
|
||||||
if (cctx->stage == ZSTDcs_init) {
|
if (cctx->stage == ZSTDcs_init) {
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the suffix array of a given string.
|
* Constructs the suffix array of a given string.
|
||||||
* @param T[0..n-1] The input string.
|
* @param T [0..n-1] The input string.
|
||||||
* @param SA[0..n-1] The output array of suffixes.
|
* @param SA [0..n-1] The output array of suffixes.
|
||||||
* @param n The length of the given string.
|
* @param n The length of the given string.
|
||||||
* @param openMP enables OpenMP optimization.
|
* @param openMP enables OpenMP optimization.
|
||||||
* @return 0 if no error occurred, -1 or -2 otherwise.
|
* @return 0 if no error occurred, -1 or -2 otherwise.
|
||||||
@@ -47,9 +47,9 @@ divsufsort(const unsigned char *T, int *SA, int n, int openMP);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the burrows-wheeler transformed string of a given string.
|
* Constructs the burrows-wheeler transformed string of a given string.
|
||||||
* @param T[0..n-1] The input string.
|
* @param T [0..n-1] The input string.
|
||||||
* @param U[0..n-1] The output string. (can be T)
|
* @param U [0..n-1] The output string. (can be T)
|
||||||
* @param A[0..n-1] The temporary array. (can be NULL)
|
* @param A [0..n-1] The temporary array. (can be NULL)
|
||||||
* @param n The length of the given string.
|
* @param n The length of the given string.
|
||||||
* @param num_indexes The length of secondary indexes array. (can be NULL)
|
* @param num_indexes The length of secondary indexes array. (can be NULL)
|
||||||
* @param indexes The secondary indexes array. (can be NULL)
|
* @param indexes The secondary indexes array. (can be NULL)
|
||||||
|
|||||||
+6
-10
@@ -1685,7 +1685,6 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
switch(LLtype)
|
switch(LLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
LLlog = 0;
|
LLlog = 0;
|
||||||
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
||||||
@@ -1693,17 +1692,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
LLlog = LLbits;
|
LLlog = LLbits;
|
||||||
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxLL;
|
{ U32 max = MaxLL;
|
||||||
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
||||||
if (LLlog > LLFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
if (LLlog > LLFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(Offtype)
|
switch(Offtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
Offlog = 0;
|
Offlog = 0;
|
||||||
if (ip > iend-2) return (size_t)-ZSTD_ERROR_SrcSize; /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return (size_t)-ZSTD_ERROR_SrcSize; /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -1712,17 +1710,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
Offlog = Offbits;
|
Offlog = Offbits;
|
||||||
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxOff;
|
{ U32 max = MaxOff;
|
||||||
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
||||||
if (Offlog > OffFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
if (Offlog > OffFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(MLtype)
|
switch(MLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
MLlog = 0;
|
MLlog = 0;
|
||||||
if (ip > iend-2) return (size_t)-ZSTD_ERROR_SrcSize; /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return (size_t)-ZSTD_ERROR_SrcSize; /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -1731,14 +1728,13 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
MLlog = MLbits;
|
MLlog = MLbits;
|
||||||
FSE_buildDTable_raw(DTableML, MLbits); break;
|
FSE_buildDTable_raw(DTableML, MLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxML;
|
{ U32 max = MaxML;
|
||||||
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
if (FSE_isError(headerSize)) return (size_t)-ZSTD_ERROR_GENERIC;
|
||||||
if (MLlog > MLFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
if (MLlog > MLFSELog) return (size_t)-ZSTD_ERROR_corruption;
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableML, norm, max, MLlog);
|
FSE_buildDTable(DTableML, norm, max, MLlog);
|
||||||
}
|
} } }
|
||||||
}
|
|
||||||
|
|
||||||
return ip-istart;
|
return ip-istart;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-10
@@ -3100,7 +3100,6 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
switch(LLtype)
|
switch(LLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
LLlog = 0;
|
LLlog = 0;
|
||||||
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
||||||
@@ -3108,17 +3107,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
LLlog = LLbits;
|
LLlog = LLbits;
|
||||||
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxLL;
|
{ U32 max = MaxLL;
|
||||||
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(Offtype)
|
switch(Offtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
Offlog = 0;
|
Offlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3128,17 +3126,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
Offlog = Offbits;
|
Offlog = Offbits;
|
||||||
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxOff;
|
{ U32 max = MaxOff;
|
||||||
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(MLtype)
|
switch(MLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
MLlog = 0;
|
MLlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3147,14 +3144,13 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
MLlog = MLbits;
|
MLlog = MLbits;
|
||||||
FSE_buildDTable_raw(DTableML, MLbits); break;
|
FSE_buildDTable_raw(DTableML, MLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxML;
|
{ U32 max = MaxML;
|
||||||
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableML, norm, max, MLlog);
|
FSE_buildDTable(DTableML, norm, max, MLlog);
|
||||||
}
|
} } }
|
||||||
}
|
|
||||||
|
|
||||||
return ip-istart;
|
return ip-istart;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-10
@@ -2742,7 +2742,6 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
switch(LLtype)
|
switch(LLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
LLlog = 0;
|
LLlog = 0;
|
||||||
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
||||||
@@ -2750,17 +2749,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
LLlog = LLbits;
|
LLlog = LLbits;
|
||||||
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxLL;
|
{ U32 max = MaxLL;
|
||||||
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(Offtype)
|
switch(Offtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
Offlog = 0;
|
Offlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -2770,17 +2768,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
Offlog = Offbits;
|
Offlog = Offbits;
|
||||||
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxOff;
|
{ U32 max = MaxOff;
|
||||||
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(MLtype)
|
switch(MLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
MLlog = 0;
|
MLlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -2789,14 +2786,13 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
MLlog = MLbits;
|
MLlog = MLbits;
|
||||||
FSE_buildDTable_raw(DTableML, MLbits); break;
|
FSE_buildDTable_raw(DTableML, MLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxML;
|
{ U32 max = MaxML;
|
||||||
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableML, norm, max, MLlog);
|
FSE_buildDTable(DTableML, norm, max, MLlog);
|
||||||
}
|
} } }
|
||||||
}
|
|
||||||
|
|
||||||
return ip-istart;
|
return ip-istart;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-11
@@ -3145,7 +3145,6 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
switch(LLtype)
|
switch(LLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
LLlog = 0;
|
LLlog = 0;
|
||||||
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
||||||
@@ -3153,17 +3152,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
LLlog = LLbits;
|
LLlog = LLbits;
|
||||||
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxLL;
|
{ U32 max = MaxLL;
|
||||||
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(Offtype)
|
switch(Offtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
Offlog = 0;
|
Offlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3173,17 +3171,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
Offlog = Offbits;
|
Offlog = Offbits;
|
||||||
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxOff;
|
{ U32 max = MaxOff;
|
||||||
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(MLtype)
|
switch(MLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case bt_rle :
|
case bt_rle :
|
||||||
MLlog = 0;
|
MLlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3192,14 +3189,13 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|||||||
MLlog = MLbits;
|
MLlog = MLbits;
|
||||||
FSE_buildDTable_raw(DTableML, MLbits); break;
|
FSE_buildDTable_raw(DTableML, MLbits); break;
|
||||||
default :
|
default :
|
||||||
max = MaxML;
|
{ U32 max = MaxML;
|
||||||
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
||||||
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSE_buildDTable(DTableML, norm, max, MLlog);
|
FSE_buildDTable(DTableML, norm, max, MLlog);
|
||||||
}
|
} } }
|
||||||
}
|
|
||||||
|
|
||||||
return ip-istart;
|
return ip-istart;
|
||||||
}
|
}
|
||||||
@@ -3701,7 +3697,7 @@ static void ZSTD_decompress_insertDictionary(ZSTD_DCtx* ctx, const void* dict, s
|
|||||||
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
||||||
* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input.
|
* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input.
|
||||||
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst .
|
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst .
|
||||||
* @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
* return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
||||||
* or 0 when a frame is completely decoded
|
* or 0 when a frame is completely decoded
|
||||||
* or an error code, which can be tested using ZBUFF_isError().
|
* or an error code, which can be tested using ZBUFF_isError().
|
||||||
*
|
*
|
||||||
|
|||||||
+7
-10
@@ -3333,7 +3333,6 @@ size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* dumps
|
|||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
switch(LLtype)
|
switch(LLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case FSEv05_ENCODING_RLE :
|
case FSEv05_ENCODING_RLE :
|
||||||
LLlog = 0;
|
LLlog = 0;
|
||||||
FSEv05_buildDTable_rle(DTableLL, *ip++);
|
FSEv05_buildDTable_rle(DTableLL, *ip++);
|
||||||
@@ -3346,17 +3345,16 @@ size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* dumps
|
|||||||
break;
|
break;
|
||||||
case FSEv05_ENCODING_DYNAMIC :
|
case FSEv05_ENCODING_DYNAMIC :
|
||||||
default : /* impossible */
|
default : /* impossible */
|
||||||
max = MaxLL;
|
{ U32 max = MaxLL;
|
||||||
headerSize = FSEv05_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
headerSize = FSEv05_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
||||||
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (LLlog > LLFSEv05Log) return ERROR(corruption_detected);
|
if (LLlog > LLFSEv05Log) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSEv05_buildDTable(DTableLL, norm, max, LLlog);
|
FSEv05_buildDTable(DTableLL, norm, max, LLlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(Offtype)
|
switch(Offtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case FSEv05_ENCODING_RLE :
|
case FSEv05_ENCODING_RLE :
|
||||||
Offlog = 0;
|
Offlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3370,17 +3368,16 @@ size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* dumps
|
|||||||
break;
|
break;
|
||||||
case FSEv05_ENCODING_DYNAMIC :
|
case FSEv05_ENCODING_DYNAMIC :
|
||||||
default : /* impossible */
|
default : /* impossible */
|
||||||
max = MaxOff;
|
{ U32 max = MaxOff;
|
||||||
headerSize = FSEv05_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
headerSize = FSEv05_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
||||||
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (Offlog > OffFSEv05Log) return ERROR(corruption_detected);
|
if (Offlog > OffFSEv05Log) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSEv05_buildDTable(DTableOffb, norm, max, Offlog);
|
FSEv05_buildDTable(DTableOffb, norm, max, Offlog);
|
||||||
}
|
} }
|
||||||
|
|
||||||
switch(MLtype)
|
switch(MLtype)
|
||||||
{
|
{
|
||||||
U32 max;
|
|
||||||
case FSEv05_ENCODING_RLE :
|
case FSEv05_ENCODING_RLE :
|
||||||
MLlog = 0;
|
MLlog = 0;
|
||||||
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
||||||
@@ -3394,13 +3391,13 @@ size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* dumps
|
|||||||
break;
|
break;
|
||||||
case FSEv05_ENCODING_DYNAMIC :
|
case FSEv05_ENCODING_DYNAMIC :
|
||||||
default : /* impossible */
|
default : /* impossible */
|
||||||
max = MaxML;
|
{ U32 max = MaxML;
|
||||||
headerSize = FSEv05_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
headerSize = FSEv05_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
||||||
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
|
||||||
if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
|
if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
|
||||||
ip += headerSize;
|
ip += headerSize;
|
||||||
FSEv05_buildDTable(DTableML, norm, max, MLlog);
|
FSEv05_buildDTable(DTableML, norm, max, MLlog);
|
||||||
} }
|
} } }
|
||||||
|
|
||||||
return ip-istart;
|
return ip-istart;
|
||||||
}
|
}
|
||||||
@@ -4030,7 +4027,7 @@ static size_t ZBUFFv05_limitCopy(void* dst, size_t maxDstSize, const void* src,
|
|||||||
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
||||||
* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input.
|
* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input.
|
||||||
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst .
|
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst .
|
||||||
* @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
* return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
||||||
* or 0 when a frame is completely decoded
|
* or 0 when a frame is completely decoded
|
||||||
* or an error code, which can be tested using ZBUFFv05_isError().
|
* or an error code, which can be tested using ZBUFFv05_isError().
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1383,7 +1383,7 @@ static unsigned char FSEv06_decodeSymbolFast(FSEv06_DState_t* DStatePtr, BITv06_
|
|||||||
*******************************************/
|
*******************************************/
|
||||||
|
|
||||||
|
|
||||||
/*<===== Decompression =====>*/
|
/* ====== Decompression ====== */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
U16 tableLog;
|
U16 tableLog;
|
||||||
|
|||||||
@@ -1147,7 +1147,7 @@ static unsigned char FSEv07_decodeSymbolFast(FSEv07_DState_t* DStatePtr, BITv07_
|
|||||||
/* faster, but works only if nbBits is always >= 1 (otherwise, result will be corrupted) */
|
/* faster, but works only if nbBits is always >= 1 (otherwise, result will be corrupted) */
|
||||||
|
|
||||||
|
|
||||||
/*<===== Decompression =====>*/
|
/* ====== Decompression ====== */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
U16 tableLog;
|
U16 tableLog;
|
||||||
|
|||||||
+3
-3
@@ -116,7 +116,7 @@ ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readab
|
|||||||
* Explicit memory management
|
* Explicit memory management
|
||||||
***************************************/
|
***************************************/
|
||||||
/** Compression context */
|
/** Compression context */
|
||||||
typedef struct ZSTD_CCtx_s ZSTD_CCtx; /*< incomplete type */
|
typedef struct ZSTD_CCtx_s ZSTD_CCtx;
|
||||||
ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void);
|
ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void);
|
||||||
ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
|
ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
|
|||||||
ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel);
|
ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel);
|
||||||
|
|
||||||
/** Decompression context */
|
/** Decompression context */
|
||||||
typedef struct ZSTD_DCtx_s ZSTD_DCtx; /*< incomplete type */
|
typedef struct ZSTD_DCtx_s ZSTD_DCtx;
|
||||||
ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void);
|
ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void);
|
||||||
ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ static const size_t ZSTD_skippableHeaderSize = 8; /* magic number + skippable f
|
|||||||
|
|
||||||
|
|
||||||
/*--- Types ---*/
|
/*--- Types ---*/
|
||||||
typedef enum { ZSTD_fast, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2, ZSTD_btlazy2, ZSTD_btopt } ZSTD_strategy; /*< from faster to stronger */
|
typedef enum { ZSTD_fast, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2, ZSTD_btlazy2, ZSTD_btopt } ZSTD_strategy; /* from faster to stronger */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */
|
unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@
|
|||||||
#define MB *(1 <<20)
|
#define MB *(1 <<20)
|
||||||
#define GB *(1U<<30)
|
#define GB *(1U<<30)
|
||||||
|
|
||||||
static const size_t maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t)(1ULL << ((sizeof(size_t)*8)-30));
|
static const size_t maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t)(1ULL << ((sizeof(size_t)*8)-31));
|
||||||
|
|
||||||
static U32 g_compressibilityDefault = 50;
|
static U32 g_compressibilityDefault = 50;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -478,8 +478,8 @@ int main(int argCount, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* No input filename ==> use stdin and stdout */
|
/* No input filename ==> use stdin and stdout */
|
||||||
filenameIdx += !filenameIdx; /*< default input is stdin */
|
filenameIdx += !filenameIdx; /* filenameTable[0] is stdin by default */
|
||||||
if (!strcmp(filenameTable[0], stdinmark) && !outFileName) outFileName = stdoutmark; /*< when input is stdin, default output is stdout */
|
if (!strcmp(filenameTable[0], stdinmark) && !outFileName) outFileName = stdoutmark; /* when input is stdin, default output is stdout */
|
||||||
|
|
||||||
/* Check if input/output defined as console; trigger an error in this case */
|
/* Check if input/output defined as console; trigger an error in this case */
|
||||||
if (!strcmp(filenameTable[0], stdinmark) && IS_CONSOLE(stdin) ) CLEAN_RETURN(badusage(programName));
|
if (!strcmp(filenameTable[0], stdinmark) && IS_CONSOLE(stdin) ) CLEAN_RETURN(badusage(programName));
|
||||||
|
|||||||
Reference in New Issue
Block a user