Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@terrelln
Copy link
Contributor

The simple compression functions are intended to ignore the advanced
parameters, but they were accidentally using them. All the
ZSTD_parameters were set correctly, but any extra parameters were
used as-is. E.g. ZSTD_c_format.

This PR makes all the simple single-pass functions listed below ignore
the advanced parameters, as intended.

  • ZSTD_compressCCtx()
  • ZSTD_compress_usingDict()
  • ZSTD_compress_usingCDict()
  • ZSTD_compress_advanced()
  • ZSTD_compress_usingCDict_advanced()

It also adds a test case that ensures that each of these functions
ignore the advanced parameters.

|| pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER
|| pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
|| cdict->compressionLevel == 0 )
&& (params.attachDictPref != ZSTD_dictForceLoad) ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixhandte note this small behavior change with regards to attaching dictionaries. This function is used by ZSTD_compress_usingCDict*(), which doesn't use requestedParams anymore.

return 0;
}

/* ZSTD_assignParamsToCCtxParams() :
Copy link
Contributor

@Cyan4973 Cyan4973 Feb 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: update name in code comment

The simple compression functions are intended to ignore the advanced
parameters, but they were accidentally using them. All the
`ZSTD_parameters` were set correctly, but any extra parameters were
used as-is. E.g. `ZSTD_c_format`.

This PR makes all the simple single-pass functions listed below ignore
the advanced parameters, as intended.

* `ZSTD_compressCCtx()`
* `ZSTD_compress_usingDict()`
* `ZSTD_compress_usingCDict()`
* `ZSTD_compress_advanced()`
* `ZSTD_compress_usingCDict_advanced()`

It also adds a test case that ensures that each of these functions
ignore the advanced parameters.
@terrelln terrelln merged commit bb6ca68 into facebook:dev Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants