Skip to content

Commit 2665153

Browse files
Merge pull request #187 from sergey-dryabzhinsky/Issue-186-fix-unused-parameter-warning
UPW
2 parents 4cfa300 + 6284dee commit 2665153

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ If paths to header file ``zstd.h`` and libraries is uncommon - use common ``buil
256256

257257
>>> $ python setup.py build_ext --external --include-dirs /opt/zstd/usr/include --libraries zstd --library-dirs /opt/zstd/lib clean
258258

259-
But If you want to build with bundled distribution of libzstd just add ``--
259+
But If you want to force build with bundled distribution of libzstd just add ``--
260260
libzstd-bundled`` option
261261

262262
>>> $ python setup.py build_ext --libzstd-bundled clean
@@ -265,6 +265,15 @@ When using a PEP 517 builder you can use ``ZSTD_BUNDLED`` environment variable i
265265

266266
>>> $ ZSTD_BUNDLED=1 python -m build -w
267267

268+
If you want to check if build w/o any warnings just add ``--
269+
all-warnings`` option
270+
271+
>>> $ python setup.py build_ext --all-warnings clean
272+
273+
When using a PEP 517 builder you can use ``ZSTD_WARNINGS`` environment variable instead:
274+
275+
>>> $ ZSTD_WARNINGS=1 python -m build -w
276+
268277
Install from pypi
269278
-----------------
270279

src/python-zstd.c

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
*/
5454
static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
5555
{
56-
56+
UNUSED(self);
57+
5758
PyObject *result;
5859
const char *source;
5960
Py_ssize_t source_size;
@@ -147,6 +148,7 @@ static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
147148
*/
148149
static PyObject *py_zstd_uncompress(PyObject* self, PyObject *args)
149150
{
151+
UNUSED(self);
150152

151153
PyObject *result;
152154
const char *source, *src;
@@ -204,7 +206,7 @@ static PyObject *py_zstd_uncompress(PyObject* self, PyObject *args)
204206
error = 1;
205207
// }
206208
} else if (cSize != dest_size) {
207-
PyErr_Format(ZstdError, "Decompression error: length mismatch -> decomp %lu != %lu [header]", (uint64_t)cSize, dest_size);
209+
PyErr_Format(ZstdError, "Decompression error: length mismatch -> decomp %llu != %llu [header]", (uint64_t)cSize, dest_size);
208210
error = 1;
209211
}
210212
} else {
@@ -230,10 +232,11 @@ static PyObject *py_zstd_uncompress(PyObject* self, PyObject *args)
230232
*/
231233
static PyObject *py_zstd_check(PyObject* self, PyObject *args)
232234
{
235+
UNUSED(self);
233236
//PyObject *result;
234237
const char *source, *src;
235238
Py_ssize_t source_size, ss, seek_frame;
236-
int64_t dest_size, frame_size, error=0;
239+
uint64_t dest_size, frame_size, error=0;
237240
//char error = 0;
238241
//size_t cSize;
239242

@@ -277,6 +280,9 @@ static PyObject *py_zstd_check(PyObject* self, PyObject *args)
277280
*/
278281
static PyObject *py_zstd_module_version(PyObject* self, PyObject *args)
279282
{
283+
UNUSED(self);
284+
UNUSED(args);
285+
280286
#if PY_MAJOR_VERSION >= 3
281287
return PyUnicode_FromFormat("%s", xstr(VERSION));
282288
#else
@@ -289,6 +295,9 @@ static PyObject *py_zstd_module_version(PyObject* self, PyObject *args)
289295
*/
290296
static PyObject *py_zstd_library_version(PyObject* self, PyObject *args)
291297
{
298+
UNUSED(self);
299+
UNUSED(args);
300+
292301
#if PY_MAJOR_VERSION >= 3
293302
return PyUnicode_FromFormat("%s", ZSTD_versionString());
294303
#else
@@ -301,6 +310,9 @@ static PyObject *py_zstd_library_version(PyObject* self, PyObject *args)
301310
*/
302311
static PyObject *py_zstd_library_version_int(PyObject* self, PyObject *args)
303312
{
313+
UNUSED(self);
314+
UNUSED(args);
315+
304316
return Py_BuildValue("i", ZSTD_VERSION_NUMBER);
305317
}
306318

@@ -309,6 +321,9 @@ static PyObject *py_zstd_library_version_int(PyObject* self, PyObject *args)
309321
*/
310322
static PyObject *py_zstd_library_legacy_format_support(PyObject* self, PyObject *args)
311323
{
324+
UNUSED(self);
325+
UNUSED(args);
326+
312327
return Py_BuildValue("i", ZSTD_LEGACY_SUPPORT);
313328
}
314329

@@ -317,6 +332,9 @@ static PyObject *py_zstd_library_legacy_format_support(PyObject* self, PyObject
317332
*/
318333
static PyObject *py_zstd_library_external(PyObject* self, PyObject *args)
319334
{
335+
UNUSED(self);
336+
UNUSED(args);
337+
320338
return Py_BuildValue("i", LIBZSTD_EXTERNAL);
321339
}
322340

@@ -326,6 +344,9 @@ static PyObject *py_zstd_library_external(PyObject* self, PyObject *args)
326344
*/
327345
static PyObject *py_zstd_with_threads(PyObject* self, PyObject *args)
328346
{
347+
UNUSED(self);
348+
UNUSED(args);
349+
329350
return Py_BuildValue("i", ZSTD_MULTITHREAD);
330351
}
331352

@@ -335,6 +356,9 @@ static PyObject *py_zstd_with_threads(PyObject* self, PyObject *args)
335356
*/
336357
static PyObject *py_zstd_with_asm(PyObject* self, PyObject *args)
337358
{
359+
UNUSED(self);
360+
UNUSED(args);
361+
338362
return Py_BuildValue("i", ! ZSTD_DISABLE_ASM);
339363
}
340364

@@ -345,6 +369,9 @@ static PyObject *py_zstd_with_asm(PyObject* self, PyObject *args)
345369
*/
346370
static PyObject *py_zstd_threads_count(PyObject* self, PyObject *args)
347371
{
372+
UNUSED(self);
373+
UNUSED(args);
374+
348375
int32_t threads = UTIL_countPhysicalCores();
349376

350377
return Py_BuildValue("i", threads);
@@ -355,6 +382,9 @@ static PyObject *py_zstd_threads_count(PyObject* self, PyObject *args)
355382
*/
356383
static PyObject *py_zstd_max_threads_count(PyObject* self, PyObject *args)
357384
{
385+
UNUSED(self);
386+
UNUSED(args);
387+
358388
return Py_BuildValue("i", ZSTDMT_NBWORKERS_MAX);
359389
}
360390

@@ -363,6 +393,9 @@ static PyObject *py_zstd_max_threads_count(PyObject* self, PyObject *args)
363393
*/
364394
static PyObject *py_zstd_min_compression_level(PyObject* self, PyObject *args)
365395
{
396+
UNUSED(self);
397+
UNUSED(args);
398+
366399
return Py_BuildValue("i", ZSTD_MIN_CLEVEL);
367400
}
368401

@@ -371,6 +404,9 @@ static PyObject *py_zstd_min_compression_level(PyObject* self, PyObject *args)
371404
*/
372405
static PyObject *py_zstd_max_compression_level(PyObject* self, PyObject *args)
373406
{
407+
UNUSED(self);
408+
UNUSED(args);
409+
374410
return Py_BuildValue("i", ZSTD_MAX_CLEVEL);
375411
}
376412

0 commit comments

Comments
 (0)