From 9097f7b1562081f7adc6653670885eb795904fc8 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 28 Aug 2016 16:25:56 -0700 Subject: [PATCH] fixed versionsTest --- programs/legacy/fileio_legacy.c | 9 ++++----- tests/test-zstd-versions.py | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/programs/legacy/fileio_legacy.c b/programs/legacy/fileio_legacy.c index c07b6e59..69d6db55 100644 --- a/programs/legacy/fileio_legacy.c +++ b/programs/legacy/fileio_legacy.c @@ -155,7 +155,6 @@ unsigned long long FIOv01_decompressFrame(FILE* foutput, FILE* finput) BYTE* const oend = outBuff + outBuffSize; U64 filesize = 0; size_t toRead; - size_t sizeCheck; ZSTDv01_Dctx* dctx = ZSTDv01_createDCtx(); @@ -164,8 +163,8 @@ unsigned long long FIOv01_decompressFrame(FILE* foutput, FILE* finput) /* restore header, already read from input */ MEM_writeLE32(inBuff, ZSTDv01_magicNumberLE); - sizeCheck = ZSTDv01_decompressContinue(dctx, NULL, 0, inBuff, sizeof(ZSTDv01_magicNumberLE)); /* Decode frame header */ - if (ZSTDv01_isError(sizeCheck)) EXM_THROW(42, "Error decoding legacy header"); + { size_t const sizeCheck = ZSTDv01_decompressContinue(dctx, NULL, 0, inBuff, sizeof(ZSTDv01_magicNumberLE)); /* Decode frame header */ + if (ZSTDv01_isError(sizeCheck)) EXM_THROW(42, "Error decoding legacy header"); } /* Main decompression Loop */ toRead = ZSTDv01_nextSrcSizeToDecompress(dctx); @@ -185,8 +184,8 @@ unsigned long long FIOv01_decompressFrame(FILE* foutput, FILE* finput) if (decodedSize) { /* not a header */ /* Write block */ - sizeCheck = fwrite(op, 1, decodedSize, foutput); - if (sizeCheck != decodedSize) EXM_THROW(46, "Write error : unable to write data block to destination file"); + { size_t const sizeCheck = fwrite(op, 1, decodedSize, foutput); + if (sizeCheck != decodedSize) EXM_THROW(46, "Write error : unable to write data block to destination file"); } filesize += decodedSize; op += decodedSize; if (op==oend) op = outBuff; diff --git a/tests/test-zstd-versions.py b/tests/test-zstd-versions.py index 6cea8546..4ee778fe 100755 --- a/tests/test-zstd-versions.py +++ b/tests/test-zstd-versions.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Test zstd interoperability between versions""" -# Based on LZ4 version test script, by Takayuki Matsuoka +# Copyright Yann Collet, Przemyslaw Skibinski and Takayuki Matsuoka +# License GPLv2 import filecmp import glob @@ -152,6 +153,7 @@ def decompress_zst(tag): print('OK ') else: print('command does not work') + dec_error = 1 return dec_error @@ -261,6 +263,6 @@ if __name__ == '__main__': print(zstd + ' : ' + repr(os.path.getsize(zstd)) + ', ' + sha1_of_file(zstd)) if error_code != 0: - print('==== ERROR !!! =====') + print('====== ERROR !!! =======') sys.exit(error_code)