From 3a6856edcaaa8ce88b280fed06a91bc6789cab4b Mon Sep 17 00:00:00 2001 From: Paul Cruz Date: Mon, 19 Jun 2017 17:43:16 -0700 Subject: [PATCH] changed scope to avoid errors --- tests/decodecorpus.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/decodecorpus.c b/tests/decodecorpus.c index f5cfd628..7d91a1c7 100644 --- a/tests/decodecorpus.c +++ b/tests/decodecorpus.c @@ -1316,30 +1316,31 @@ static size_t testDecodeWithDict(U32 seed, size_t dictSize) goto dictTestCleanup; } } - - frame_t fr; { - size_t dictContentSize = dictSize-dictSize/4; - BYTE* const dictContent = fullDict+dictSize/4; - dictInfo const info = initDictInfo(1, dictContentSize, dictContent, dictID); - seed = generateFrame(seed, &fr, info); - } - - { - ZSTD_DCtx* const dctx = ZSTD_createDCtx(); + frame_t fr; { - size_t const returnValue = ZSTD_decompress_usingDict(dctx, DECOMPRESSED_BUFFER, MAX_DECOMPRESSED_SIZE, - fr.dataStart, (BYTE*)fr.data - (BYTE*)fr.dataStart, - fullDict, dictSize); - if (ZSTD_isError(returnValue)) { - errorDetected = returnValue; - goto dictTestCleanup; - } + size_t dictContentSize = dictSize-dictSize/4; + BYTE* const dictContent = fullDict+dictSize/4; + dictInfo const info = initDictInfo(1, dictContentSize, dictContent, dictID); + seed = generateFrame(seed, &fr, info); } - if (memcmp(DECOMPRESSED_BUFFER, fr.srcStart, (BYTE*)fr.src - (BYTE*)fr.srcStart) != 0) { - errorDetected = ERROR(corruption_detected); - goto dictTestCleanup; + { + ZSTD_DCtx* const dctx = ZSTD_createDCtx(); + { + size_t const returnValue = ZSTD_decompress_usingDict(dctx, DECOMPRESSED_BUFFER, MAX_DECOMPRESSED_SIZE, + fr.dataStart, (BYTE*)fr.data - (BYTE*)fr.dataStart, + fullDict, dictSize); + if (ZSTD_isError(returnValue)) { + errorDetected = returnValue; + goto dictTestCleanup; + } + } + + if (memcmp(DECOMPRESSED_BUFFER, fr.srcStart, (BYTE*)fr.src - (BYTE*)fr.srcStart) != 0) { + errorDetected = ERROR(corruption_detected); + goto dictTestCleanup; + } } }