mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-01-11 12:30:24 +00:00
Clean up check for emitting a single raw block
This commit is contained in:
parent
c96594680a
commit
0f4ffa7166
@ -204,6 +204,7 @@ static int do_compress(const char *pszInFilename, const char *pszOutFilename, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
int nPreviousBlockSize = 0;
|
int nPreviousBlockSize = 0;
|
||||||
|
int nNumBlocks = 0;
|
||||||
|
|
||||||
if (nDictionaryDataSize)
|
if (nDictionaryDataSize)
|
||||||
nPreviousBlockSize = nDictionaryDataSize;
|
nPreviousBlockSize = nDictionaryDataSize;
|
||||||
@ -217,7 +218,7 @@ static int do_compress(const char *pszInFilename, const char *pszOutFilename, co
|
|||||||
|
|
||||||
nInDataSize = (int)fread(pInData + BLOCK_SIZE, 1, BLOCK_SIZE, f_in);
|
nInDataSize = (int)fread(pInData + BLOCK_SIZE, 1, BLOCK_SIZE, f_in);
|
||||||
if (nInDataSize > 0) {
|
if (nInDataSize > 0) {
|
||||||
if (nPreviousBlockSize && (nOptions & OPT_RAW) != 0 && !nDictionaryDataSize) {
|
if ((nOptions & OPT_RAW) != 0 && nNumBlocks) {
|
||||||
fprintf(stderr, "error: raw blocks can only be used with files <= 64 Kb\n");
|
fprintf(stderr, "error: raw blocks can only be used with files <= 64 Kb\n");
|
||||||
bError = true;
|
bError = true;
|
||||||
break;
|
break;
|
||||||
@ -281,6 +282,7 @@ static int do_compress(const char *pszInFilename, const char *pszOutFilename, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
nPreviousBlockSize = nInDataSize;
|
nPreviousBlockSize = nInDataSize;
|
||||||
|
nNumBlocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bError && !feof(f_in) && nOriginalSize >= 1024 * 1024) {
|
if (!bError && !feof(f_in) && nOriginalSize >= 1024 * 1024) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user