Fix bug in frame decompress example
authorCedric De Brito <cdebrito@nvidia.com>
Mon, 2 Jul 2018 12:35:04 +0000 (14:35 +0200)
committerCedric De Brito <cdebrito@nvidia.com>
Mon, 2 Jul 2018 12:35:04 +0000 (14:35 +0200)
The decompression was failing as the srcEnd pointer in
decompress_file_internal was wrongly computed beyond
the end of the memory block.
We need to account for the fact that the header ("info")
was already read in the calling function ("alreadyConsumed").

examples/frameCompress.c

index 9bfea48..0f8910d 100644 (file)
@@ -260,7 +260,7 @@ decompress_file_allocDst(FILE* f_in, FILE* f_out,
     int const decompressionResult = decompress_file_internal(
                         f_in, f_out,
                         dctx,
-                        src, srcCapacity, readSize, consumedSize,
+                        src, srcCapacity, readSize-consumedSize, consumedSize,
                         dst, dstCapacity);
 
     free(dst);