Address comments and make sure all prototypes are rendered by gen_html
This commit is contained in:
parent
0f7bd772e6
commit
35186e65b0
@ -16,8 +16,6 @@ static const unsigned ZSTD_seekTableFooterSize = 9;
|
|||||||
/* Limit the maximum size to avoid any potential issues storing the compressed size */
|
/* Limit the maximum size to avoid any potential issues storing the compressed size */
|
||||||
#define ZSTD_SEEKABLE_MAX_FRAME_DECOMPRESSED_SIZE 0x80000000U
|
#define ZSTD_SEEKABLE_MAX_FRAME_DECOMPRESSED_SIZE 0x80000000U
|
||||||
|
|
||||||
#define ZSTD_SEEKABLE_FRAMEINDEX_TOOLARGE (0ULL-2)
|
|
||||||
|
|
||||||
/*-****************************************************************************
|
/*-****************************************************************************
|
||||||
* Seekable Format
|
* Seekable Format
|
||||||
*
|
*
|
||||||
@ -137,14 +135,14 @@ ZSTDLIB_API size_t ZSTD_seekable_initFile(ZSTD_seekable* zs, FILE* src);
|
|||||||
ZSTDLIB_API size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t dstSize, unsigned long long offset);
|
ZSTDLIB_API size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t dstSize, unsigned long long offset);
|
||||||
ZSTDLIB_API size_t ZSTD_seekable_decompressFrame(ZSTD_seekable* zs, void* dst, size_t dstSize, unsigned frameIndex);
|
ZSTDLIB_API size_t ZSTD_seekable_decompressFrame(ZSTD_seekable* zs, void* dst, size_t dstSize, unsigned frameIndex);
|
||||||
|
|
||||||
|
#define ZSTD_SEEKABLE_FRAMEINDEX_TOOLARGE (0ULL-2)
|
||||||
/*===== Seek Table access functions =====*/
|
/*===== Seek Table access functions =====*/
|
||||||
ZSTDLIB_API unsigned ZSTD_seekable_getNumFrames(ZSTD_seekable* const zs);
|
ZSTDLIB_API unsigned ZSTD_seekable_getNumFrames(ZSTD_seekable* const zs);
|
||||||
ZSTDLIB_API unsigned long long ZSTD_seekable_getFrameCompressedOffset(ZSTD_seekable* const zs, unsigned frameIndex);
|
ZSTDLIB_API unsigned long long ZSTD_seekable_getFrameCompressedOffset(ZSTD_seekable* const zs, unsigned frameIndex);
|
||||||
ZSTDLIB_API unsigned long long ZSTD_seekable_getFrameDecompressedOffset(ZSTD_seekable* const zs, unsigned frameIndex);
|
ZSTDLIB_API unsigned long long ZSTD_seekable_getFrameDecompressedOffset(ZSTD_seekable* const zs, unsigned frameIndex);
|
||||||
ZSTDLIB_API size_t ZSTD_seekable_getFrameCompressedSize(ZSTD_seekable* const zs, unsigned frameIndex);
|
ZSTDLIB_API size_t ZSTD_seekable_getFrameCompressedSize(ZSTD_seekable* const zs, unsigned frameIndex);
|
||||||
ZSTDLIB_API size_t ZSTD_seekable_getFrameDecompressedSize(ZSTD_seekable* const zs, unsigned frameIndex);
|
ZSTDLIB_API size_t ZSTD_seekable_getFrameDecompressedSize(ZSTD_seekable* const zs, unsigned frameIndex);
|
||||||
|
ZSTDLIB_API unsigned ZSTD_seekable_offsetToFrameIndex(ZSTD_seekable* const zs, unsigned long long offset);
|
||||||
ZSTDLIB_API unsigned ZSTD_seekable_offsetToFrame(ZSTD_seekable* const zs, unsigned long long offset);
|
|
||||||
|
|
||||||
/*===== Seekable advanced I/O API =====*/
|
/*===== Seekable advanced I/O API =====*/
|
||||||
typedef int(ZSTD_seekable_read)(void* opaque, void* buffer, size_t n);
|
typedef int(ZSTD_seekable_read)(void* opaque, void* buffer, size_t n);
|
||||||
@ -154,7 +152,6 @@ typedef struct {
|
|||||||
ZSTD_seekable_read* read;
|
ZSTD_seekable_read* read;
|
||||||
ZSTD_seekable_seek* seek;
|
ZSTD_seekable_seek* seek;
|
||||||
} ZSTD_seekable_customFile;
|
} ZSTD_seekable_customFile;
|
||||||
|
|
||||||
ZSTDLIB_API size_t ZSTD_seekable_initAdvanced(ZSTD_seekable* zs, ZSTD_seekable_customFile src);
|
ZSTDLIB_API size_t ZSTD_seekable_initAdvanced(ZSTD_seekable* zs, ZSTD_seekable_customFile src);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
|
@ -192,11 +192,11 @@ size_t ZSTD_seekable_free(ZSTD_seekable* zs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ZSTD_seekable_offsetToFrame() :
|
/** ZSTD_seekable_offsetToFrameIndex() :
|
||||||
* Performs a binary search to find the last frame with a decompressed offset
|
* Performs a binary search to find the last frame with a decompressed offset
|
||||||
* <= pos
|
* <= pos
|
||||||
* @return : the frame's index */
|
* @return : the frame's index */
|
||||||
U32 ZSTD_seekable_offsetToFrame(ZSTD_seekable* const zs, U64 pos)
|
U32 ZSTD_seekable_offsetToFrameIndex(ZSTD_seekable* const zs, U64 pos)
|
||||||
{
|
{
|
||||||
U32 lo = 0;
|
U32 lo = 0;
|
||||||
U32 hi = zs->seekTable.tableLen;
|
U32 hi = zs->seekTable.tableLen;
|
||||||
@ -373,7 +373,7 @@ size_t ZSTD_seekable_initAdvanced(ZSTD_seekable* zs, ZSTD_seekable_customFile sr
|
|||||||
|
|
||||||
size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, U64 offset)
|
size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, U64 offset)
|
||||||
{
|
{
|
||||||
U32 targetFrame = ZSTD_seekable_offsetToFrame(zs, offset);
|
U32 targetFrame = ZSTD_seekable_offsetToFrameIndex(zs, offset);
|
||||||
do {
|
do {
|
||||||
/* check if we can continue from a previous decompress job */
|
/* check if we can continue from a previous decompress job */
|
||||||
if (targetFrame != zs->curFrame || offset != zs->decompressedOffset) {
|
if (targetFrame != zs->curFrame || offset != zs->decompressedOffset) {
|
||||||
@ -422,7 +422,7 @@ size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, U64 of
|
|||||||
|
|
||||||
if (zs->decompressedOffset < offset + len) {
|
if (zs->decompressedOffset < offset + len) {
|
||||||
/* go back to the start and force a reset of the stream */
|
/* go back to the start and force a reset of the stream */
|
||||||
targetFrame = ZSTD_seekable_offsetToFrame(zs, zs->decompressedOffset);
|
targetFrame = ZSTD_seekable_offsetToFrameIndex(zs, zs->decompressedOffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user