Skip to content

Commit

Permalink
Fix asserts in DeflateZstd so they fire as intended.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCallow committed Jan 30, 2022
1 parent c9f68f0 commit b2c73d2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/writer2.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,22 @@ ktxTexture2_DeflateZstd(ktxTexture2* This, ktx_uint32_t compressionLevel)
case ZSTD_error_parameter_outOfBound:
return KTX_INVALID_VALUE;
case ZSTD_error_dstSize_tooSmall:
#ifdef DEBUG
assert(false && "Deflate dstSize too small.");
#else
return KTX_OUT_OF_MEMORY;
#endif
case ZSTD_error_workSpace_tooSmall:
#ifdef DEBUG
assert(true); // inflatedDataCapacity too small.
assert(false && "Deflate workspace too small.");
#else
return KTX_OUT_OF_MEMORY;
#endif
case ZSTD_error_memory_allocation:
return KTX_OUT_OF_MEMORY;
default:
// The remaining errors look they should only occur during
// decompression but just in case.
// The remaining errors look like they should only
// occur during decompression but just in case.
#ifdef DEBUG
assert(true);
#else
Expand Down

0 comments on commit b2c73d2

Please sign in to comment.