Skip to content

ZSTD_findDecompressedSize is ZSTDLIB_STATIC_API #50

@mkitti

Description

@mkitti

Here is the declaration of ZSTD_findDecompressedSize which is to used to implement TranscodingStreams.expectedsize:

ZSTDLIB_STATIC_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);

https://github.com/facebook/zstd/blob/78955f5f9ddb3601566884ce217d91c132f5edc1/lib/zstd.h#L1455

This appears to come with the following warning.

/****************************************************************************************
 *   experimental API (static linking only)
 ****************************************************************************************
 * The following symbols and constants
 * are not planned to join "stable API" status in the near future.
 * They can still change in future versions.
 * Some of them are planned to remain in the static_only section indefinitely.
 * Some of them might be removed in the future (especially when redundant with existing stable functions)
 * ***************************************************************************************/

https://github.com/facebook/zstd/blob/78955f5f9ddb3601566884ce217d91c132f5edc1/lib/zstd.h#L1193-L1200

An implementation that uses ZSTD_getFrameContentSize may be more stable directly. ZSTD_getFrameContentSize only obtains the size of the first frame while ZSTD_findDecompressedSize appears to iterate over many frames, using ZSTD_getFrameContentSize for each frame, accumulating the total. In theory, we could write the equivalent function if needed.

This is only going to be a problem if someone ever tries to use CodecZstd.jl with libzstd built with ZSTDLIB_STATIC_API set to something that hides the static symbols.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions