File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -151,12 +151,21 @@ ZSTDLIB_API const char* ZSTD_versionString(void);
151
151
/* **************************************
152
152
* Simple Core API
153
153
***************************************/
154
- /* ! ZSTD_compress() :
155
- * Compresses `src` content as a single zstd compressed frame into already allocated `dst`.
156
- * NOTE: Providing `dstCapacity >= ZSTD_compressBound(srcSize)` guarantees that zstd will have
157
- * enough space to successfully compress the data.
158
- * @return : compressed size written into `dst` (<= `dstCapacity),
159
- * or an error code if it fails (which can be tested using ZSTD_isError()). */
154
+ /* !
155
+ * Compresses @p src using the given @p compressionLevel and writes the result into @p dst.
156
+ *
157
+ * @param src The data to compress of size @p srcSize.
158
+ * @param dst The output buffer of isze @p dstCapacity.
159
+ *
160
+ * @returns The compressed size or an error that can be checked with [ZSTD_isError()][ZSTD_isError].
161
+ *
162
+ * @note Compression is guaranteed to succeed (with the exception of OOMs) if
163
+ * @p dstCapacity is at least `ZSTD_compressBound(srcSize)`.
164
+ *
165
+ * @note It is common to use @p srcSize as the @p dstCapacity. In this case you should check to see
166
+ * if `ZSTD_isError(ret) && ZSTD_getErrorCode(ret) == ZSTD_error_dstSize_tooSmall` then the
167
+ * @p src wasn't compressible.
168
+ */
160
169
ZSTDLIB_API size_t ZSTD_compress ( void * dst, size_t dstCapacity,
161
170
const void * src, size_t srcSize,
162
171
int compressionLevel);
You can’t perform that action at this time.
0 commit comments