1- /*
2- Low level interface to Meta's zstd library for use in the compression.zstd
3- Python module.
4- */
1+ /* Low level interface to the Zstandard algorthm & the zstd library. */
52
63#ifndef Py_BUILD_CORE_BUILTIN
74# define Py_BUILD_CORE_MODULE 1
@@ -34,17 +31,17 @@ set_zstd_error(const _zstd_state* const state,
3431 switch (type )
3532 {
3633 case ERR_DECOMPRESS :
37- msg = "Unable to decompress zstd data: %s" ;
34+ msg = "Unable to decompress Zstandard data: %s" ;
3835 break ;
3936 case ERR_COMPRESS :
40- msg = "Unable to compress zstd data: %s" ;
37+ msg = "Unable to compress Zstandard data: %s" ;
4138 break ;
4239
4340 case ERR_LOAD_D_DICT :
44- msg = "Unable to load zstd dictionary or prefix for decompression: %s" ;
41+ msg = "Unable to load Zstandard dictionary or prefix for decompression: %s" ;
4542 break ;
4643 case ERR_LOAD_C_DICT :
47- msg = "Unable to load zstd dictionary or prefix for compression: %s" ;
44+ msg = "Unable to load Zstandard dictionary or prefix for compression: %s" ;
4845 break ;
4946
5047 case ERR_GET_C_BOUNDS :
@@ -58,10 +55,10 @@ set_zstd_error(const _zstd_state* const state,
5855 break ;
5956
6057 case ERR_TRAIN_DICT :
61- msg = "Unable to train zstd dictionary: %s" ;
58+ msg = "Unable to train the Zstandard dictionary: %s" ;
6259 break ;
6360 case ERR_FINALIZE_DICT :
64- msg = "Unable to finalize zstd dictionary: %s" ;
61+ msg = "Unable to finalize the Zstandard dictionary: %s" ;
6562 break ;
6663
6764 default :
@@ -187,13 +184,13 @@ _zstd.train_dict
187184 The size of the dictionary.
188185 /
189186
190- Internal function, train a zstd dictionary on sample data.
187+ Internal function, train a Zstandard dictionary on sample data.
191188[clinic start generated code]*/
192189
193190static PyObject *
194191_zstd_train_dict_impl (PyObject * module , PyBytesObject * samples_bytes ,
195192 PyObject * samples_sizes , Py_ssize_t dict_size )
196- /*[clinic end generated code: output=8e87fe43935e8f77 input=70fcd8937f2528b6 ]*/
193+ /*[clinic end generated code: output=8e87fe43935e8f77 input=829e31fbbf3454b0 ]*/
197194{
198195 // TODO(emmatyping): The preamble and suffix to this function and _finalize_dict
199196 // are pretty similar. We should see if we can refactor them to share that code.
@@ -295,15 +292,15 @@ _zstd.finalize_dict
295292 Optimize for a specific zstd compression level, 0 means default.
296293 /
297294
298- Internal function, finalize a zstd dictionary.
295+ Internal function, finalize a Zstandard dictionary.
299296[clinic start generated code]*/
300297
301298static PyObject *
302299_zstd_finalize_dict_impl (PyObject * module , PyBytesObject * custom_dict_bytes ,
303300 PyBytesObject * samples_bytes ,
304301 PyObject * samples_sizes , Py_ssize_t dict_size ,
305302 int compression_level )
306- /*[clinic end generated code: output=f91821ba5ae85bda input=130d1508adb55ba1 ]*/
303+ /*[clinic end generated code: output=f91821ba5ae85bda input=11af97dcc7608059 ]*/
307304{
308305 Py_ssize_t chunks_number ;
309306 size_t * chunk_sizes = NULL ;
@@ -457,9 +454,9 @@ _zstd_get_frame_size_impl(PyObject *module, Py_buffer *frame_buffer)
457454 if (ZSTD_isError (frame_size )) {
458455 _zstd_state * const mod_state = get_zstd_state (module );
459456 PyErr_Format (mod_state -> ZstdError ,
460- "Error when finding the compressed size of a zstd frame. "
461- "Make sure the frame_buffer argument starts from the "
462- "beginning of a frame, and its length not less than this "
457+ "Error when finding the compressed size of a Zstandard frame. "
458+ "Ensure the frame_buffer argument starts from the "
459+ "beginning of a frame, and its length is not less than this "
463460 "complete frame. Zstd error message: %s." ,
464461 ZSTD_getErrorName (frame_size ));
465462 return NULL ;
@@ -494,9 +491,9 @@ _zstd_get_frame_info_impl(PyObject *module, Py_buffer *frame_buffer)
494491 _zstd_state * const mod_state = get_zstd_state (module );
495492 PyErr_SetString (mod_state -> ZstdError ,
496493 "Error when getting information from the header of "
497- "a zstd frame. Make sure the frame_buffer argument "
494+ "a Zstandard frame. Ensure the frame_buffer argument "
498495 "starts from the beginning of a frame, and its length "
499- "not less than the frame header (6~18 bytes)." );
496+ "is not less than the frame header (6~18 bytes)." );
500497 return NULL ;
501498 }
502499
0 commit comments