mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
Test new ZSTD_findFrameCompressedSize and update documentation
This commit is contained in:
@ -137,6 +137,23 @@ static int testFrameDecoding(void)
|
||||
DISPLAY("ERROR: ZSTD_decompressBound: decompressed bound too small\n");
|
||||
return 1;
|
||||
}
|
||||
{ const char* ip = COMPRESSED;
|
||||
size_t remainingSize = COMPRESSED_SIZE;
|
||||
while (1) {
|
||||
size_t frameSize = ZSTD_findFrameCompressedSize(ip, remainingSize);
|
||||
if (ZSTD_isError(frameSize)) {
|
||||
DISPLAY("ERROR: ZSTD_findFrameCompressedSize: %s\n", ZSTD_getErrorName(frameSize));
|
||||
return 1;
|
||||
}
|
||||
if (frameSize > remainingSize) {
|
||||
DISPLAY("ERROR: ZSTD_findFrameCompressedSize: expected frameSize to align with src buffer");
|
||||
return 1;
|
||||
}
|
||||
ip += frameSize;
|
||||
remainingSize -= frameSize;
|
||||
if (remainingSize == 0) break;
|
||||
}
|
||||
}
|
||||
DISPLAY("Frame Decoding OK\n");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user