Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSTD_findDecompressedSize is ZSTDLIB_STATIC_API #50

Closed
mkitti opened this issue May 20, 2024 · 1 comment
Closed

ZSTD_findDecompressedSize is ZSTDLIB_STATIC_API #50

mkitti opened this issue May 20, 2024 · 1 comment

Comments

@mkitti
Copy link
Member

mkitti commented May 20, 2024

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.

@nhz2
Copy link
Member

nhz2 commented Oct 8, 2024

Fixed by #63

@nhz2 nhz2 closed this as completed Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants