Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-132983: Clean-ups for_zstd
#133670
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0c3c667
e02f66c
686ae61
7ea1ac1
9774338
d1dea98
ac1e39c
1a54bf3
9cb7a3d
663e666
dd1380d
fcd6561
06a4723
ef2634d
ff28bf2
3d3dbf7
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -33,9 +33,6 @@ set_zstd_error(const _zstd_state* const state, | ||
case ERR_COMPRESS: | ||
msg = "Unable to compress zstd data: %s"; | ||
break; | ||
case ERR_LOAD_D_DICT: | ||
msg = "Unable to load zstd dictionary or prefix for decompression: %s"; | ||
@@ -151,19 +148,19 @@ set_parameter_error(const _zstd_state* const state, int is_compress, | ||
} | ||
if (ZSTD_isError(bounds.error)) { | ||
PyErr_Format(state->ZstdError, | ||
"Zstd %s parameter \"%s\" is invalid.", | ||
type, name); | ||
return; | ||
} | ||
/* Error message */ | ||
PyErr_Format(state->ZstdError, | ||
"Error when setting zstd %s parameter \"%s\", it " | ||
"should %d <= value <= %d, provided value is %d. " | ||
"(%d-bit build)", | ||
type, name, | ||
bounds.lowerBound, bounds.upperBound, value_v, | ||
8*(int)sizeof(Py_ssize_t)); | ||
} | ||
static inline _zstd_state* | ||
@@ -558,150 +555,81 @@ static PyMethodDef _zstd_methods[] = { | ||
}; | ||
static inline int | ||
add_vars_to_module(PyObject *m) | ||
{ | ||
#define ADD_INT_MACRO(MACRO) \ | ||
if (PyModule_AddIntConstant((m), #MACRO, (MACRO)) < 0) { \ | ||
return -1; \ | ||
} | ||
/*zstd_version_number, int */ | ||
if (PyModule_AddIntConstant(m, "zstd_version_number", | ||
ZSTD_versionNumber()) < 0) { | ||
return -1; | ||
} | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
/* zstd_version, str */ | ||
if (PyModule_AddStringConstant(m, "zstd_version", | ||
ZSTD_versionString()) < 0) { | ||
return -1; | ||
} | ||
/* ZSTD_CLEVEL_DEFAULT, int */ | ||
#if ZSTD_VERSION_NUMBER >= 10500 | ||
if (PyModule_AddIntConstant(m, "ZSTD_CLEVEL_DEFAULT", | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
ZSTD_defaultCLevel()) < 0) { | ||
return -1; | ||
} | ||
#else | ||
ADD_INT_MACRO(ZSTD_CLEVEL_DEFAULT); | ||
#endif | ||
/* ZSTD_DStreamOutSize, int */ | ||
if (PyModule_Add(m, "ZSTD_DStreamOutSize", | ||
PyLong_FromSize_t(ZSTD_DStreamOutSize())) < 0) { | ||
return -1; | ||
} | ||
/*Add zstd compression parameters. All should also be in cp_list. */ | ||
ADD_INT_MACRO(ZSTD_c_compressionLevel); | ||
ADD_INT_MACRO(ZSTD_c_windowLog); | ||
ADD_INT_MACRO(ZSTD_c_hashLog); | ||
ADD_INT_MACRO(ZSTD_c_chainLog); | ||
ADD_INT_MACRO(ZSTD_c_searchLog); | ||
ADD_INT_MACRO(ZSTD_c_minMatch); | ||
ADD_INT_MACRO(ZSTD_c_targetLength); | ||
ADD_INT_MACRO(ZSTD_c_strategy); | ||
ADD_INT_MACRO(ZSTD_c_enableLongDistanceMatching); | ||
ADD_INT_MACRO(ZSTD_c_ldmHashLog); | ||
ADD_INT_MACRO(ZSTD_c_ldmMinMatch); | ||
ADD_INT_MACRO(ZSTD_c_ldmBucketSizeLog); | ||
ADD_INT_MACRO(ZSTD_c_ldmHashRateLog); | ||
ADD_INT_MACRO(ZSTD_c_contentSizeFlag); | ||
ADD_INT_MACRO(ZSTD_c_checksumFlag); | ||
ADD_INT_MACRO(ZSTD_c_dictIDFlag); | ||
ADD_INT_MACRO(ZSTD_c_nbWorkers); | ||
ADD_INT_MACRO(ZSTD_c_jobSize); | ||
ADD_INT_MACRO(ZSTD_c_overlapLog); | ||
/* Add zstd decompression parameters. All should also be in dp_list. */ | ||
ADD_INT_MACRO(ZSTD_d_windowLogMax); | ||
/* ZSTD_strategy enum */ | ||
ADD_INT_MACRO(ZSTD_fast); | ||
ADD_INT_MACRO(ZSTD_dfast); | ||
ADD_INT_MACRO(ZSTD_greedy); | ||
ADD_INT_MACRO(ZSTD_lazy); | ||
ADD_INT_MACRO(ZSTD_lazy2); | ||
ADD_INT_MACRO(ZSTD_btlazy2); | ||
ADD_INT_MACRO(ZSTD_btopt); | ||
ADD_INT_MACRO(ZSTD_btultra); | ||
ADD_INT_MACRO(ZSTD_btultra2); | ||
#undef ADD_INT_MACRO | ||
return 0; | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.