Switch Unconditional RETURN_ERROR_IF Calls to RETURN_ERROR

This commit is contained in:
W. Felix Handte
2019-01-28 12:45:34 -05:00
parent a3538bbc6f
commit 800c87fed0
2 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -251,7 +251,7 @@ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, s
zfhPtr->frameType = ZSTD_skippableFrame; zfhPtr->frameType = ZSTD_skippableFrame;
return 0; return 0;
} }
RETURN_ERROR_IF(1, prefix_unknown); RETURN_ERROR(prefix_unknown);
} }
/* ensure there is enough `srcSize` to fully read/decode frame header */ /* ensure there is enough `srcSize` to fully read/decode frame header */
@@ -520,7 +520,7 @@ static size_t ZSTD_copyRawBlock(void* dst, size_t dstCapacity,
DEBUGLOG(5, "ZSTD_copyRawBlock"); DEBUGLOG(5, "ZSTD_copyRawBlock");
if (dst == NULL) { if (dst == NULL) {
if (srcSize == 0) return 0; if (srcSize == 0) return 0;
RETURN_ERROR_IF(1, dstBuffer_null); RETURN_ERROR(dstBuffer_null);
} }
RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall); RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall);
memcpy(dst, src, srcSize); memcpy(dst, src, srcSize);
@@ -533,7 +533,7 @@ static size_t ZSTD_setRleBlock(void* dst, size_t dstCapacity,
{ {
if (dst == NULL) { if (dst == NULL) {
if (regenSize == 0) return 0; if (regenSize == 0) return 0;
RETURN_ERROR_IF(1, dstBuffer_null); RETURN_ERROR(dstBuffer_null);
} }
RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall); RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall);
memset(dst, b, regenSize); memset(dst, b, regenSize);
@@ -595,7 +595,7 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx,
break; break;
case bt_reserved : case bt_reserved :
default: default:
RETURN_ERROR_IF(1, corruption_detected); RETURN_ERROR(corruption_detected);
} }
if (ZSTD_isError(decodedSize)) return decodedSize; if (ZSTD_isError(decodedSize)) return decodedSize;
@@ -865,7 +865,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
break; break;
case bt_reserved : /* should never happen */ case bt_reserved : /* should never happen */
default: default:
RETURN_ERROR_IF(1, corruption_detected); RETURN_ERROR(corruption_detected);
} }
if (ZSTD_isError(rSize)) return rSize; if (ZSTD_isError(rSize)) return rSize;
DEBUGLOG(5, "ZSTD_decompressContinue: decoded size from block : %u", (unsigned)rSize); DEBUGLOG(5, "ZSTD_decompressContinue: decoded size from block : %u", (unsigned)rSize);
@@ -919,7 +919,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
default: default:
assert(0); /* impossible */ assert(0); /* impossible */
RETURN_ERROR_IF(1, GENERIC); /* some compiler require default to do something */ RETURN_ERROR(GENERIC); /* some compiler require default to do something */
} }
} }
@@ -1327,7 +1327,7 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value
return 0; return 0;
default:; default:;
} }
RETURN_ERROR_IF(1, parameter_unsupported); RETURN_ERROR(parameter_unsupported);
} }
size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset) size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset)
@@ -1617,7 +1617,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
default: default:
assert(0); /* impossible */ assert(0); /* impossible */
RETURN_ERROR_IF(1, GENERIC); /* some compiler require default to do something */ RETURN_ERROR(GENERIC); /* some compiler require default to do something */
} } } }
/* result */ /* result */
+2 -2
View File
@@ -227,7 +227,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,
return lhSize+1; return lhSize+1;
} }
default: default:
RETURN_ERROR_IF(1, corruption_detected, "impossible"); RETURN_ERROR(corruption_detected, "impossible");
} }
} }
} }
@@ -470,7 +470,7 @@ static size_t ZSTD_buildSeqTable(ZSTD_seqSymbol* DTableSpace, const ZSTD_seqSymb
} }
default : default :
assert(0); assert(0);
RETURN_ERROR_IF(1, GENERIC, "impossible"); RETURN_ERROR(GENERIC, "impossible");
} }
} }