From 0f4ffa7166303d79221af954600d8cfe0afa1d01 Mon Sep 17 00:00:00 2001 From: emmanuel-marty Date: Sun, 12 May 2019 23:21:50 +0200 Subject: [PATCH] Clean up check for emitting a single raw block --- src/lzsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lzsa.c b/src/lzsa.c index a5096bf..5069bbc 100755 --- a/src/lzsa.c +++ b/src/lzsa.c @@ -204,6 +204,7 @@ static int do_compress(const char *pszInFilename, const char *pszOutFilename, co } int nPreviousBlockSize = 0; + int nNumBlocks = 0; if (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); 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"); bError = true; break; @@ -281,6 +282,7 @@ static int do_compress(const char *pszInFilename, const char *pszOutFilename, co } nPreviousBlockSize = nInDataSize; + nNumBlocks++; } if (!bError && !feof(f_in) && nOriginalSize >= 1024 * 1024) {