diff --git a/contrib/seekable_format/examples/seekable_decompression.c b/contrib/seekable_format/examples/seekable_decompression.c index 9cd232922..7050e0fa5 100644 --- a/contrib/seekable_format/examples/seekable_decompression.c +++ b/contrib/seekable_format/examples/seekable_decompression.c @@ -84,7 +84,7 @@ static void fseek_orDie(FILE* file, long int offset, int origin) { } -static void decompressFile_orDie(const char* fname, unsigned startOffset, unsigned endOffset) +static void decompressFile_orDie(const char* fname, off_t startOffset, off_t endOffset) { FILE* const fin = fopen_orDie(fname, "rb"); FILE* const fout = stdout; @@ -129,8 +129,8 @@ int main(int argc, const char** argv) { const char* const inFilename = argv[1]; - unsigned const startOffset = (unsigned) atoi(argv[2]); - unsigned const endOffset = (unsigned) atoi(argv[3]); + off_t const startOffset = atoll(argv[2]); + off_t const endOffset = atoll(argv[3]); decompressFile_orDie(inFilename, startOffset, endOffset); } diff --git a/contrib/seekable_format/zstdseek_decompress.c b/contrib/seekable_format/zstdseek_decompress.c index 2b109b9d0..b4c48754e 100644 --- a/contrib/seekable_format/zstdseek_decompress.c +++ b/contrib/seekable_format/zstdseek_decompress.c @@ -313,8 +313,8 @@ static size_t ZSTD_seekable_loadSeekTable(ZSTD_seekable* zs) /* compute cumulative positions */ for (; idx < numFrames; idx++) { if (pos + sizePerEntry > SEEKABLE_BUFF_SIZE) { - U32 const toRead = MIN(remaining, SEEKABLE_BUFF_SIZE); U32 const offset = SEEKABLE_BUFF_SIZE - pos; + U32 const toRead = MIN(remaining, SEEKABLE_BUFF_SIZE - offset); memmove(zs->inBuff, zs->inBuff + pos, offset); /* move any data we haven't read yet */ CHECK_IO(src.read(src.opaque, zs->inBuff+offset, toRead)); remaining -= toRead;