From 2a409302cd5d494835cdc8b262f2a10f19ddf9e0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 12 Jul 2023 11:55:24 +0530 Subject: [PATCH] LIT Output: Fix error converting anything to LIT on Windows. Fixes #2026795 [can't convert epub to lit](https://bugs.launchpad.net/calibre/+bug/2026795) --- src/calibre/utils/lzx/compressor.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/calibre/utils/lzx/compressor.c b/src/calibre/utils/lzx/compressor.c index 6f43bbc3c9..fb507e6882 100644 --- a/src/calibre/utils/lzx/compressor.c +++ b/src/calibre/utils/lzx/compressor.c @@ -309,18 +309,10 @@ Compressor_compress(Compressor *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"data", "flush", NULL}; char *data = NULL; - unsigned int inlen = 0; + Py_ssize_t inlen = 0; int flush = 0; - if (!PyArg_ParseTupleAndKeywords( -#if PYTHON_MAJOR_VERSION >= 3 - args, kwds, "y#|b", kwlist, &data, &inlen, &flush)) { -#else - args, kwds, "s#|b", kwlist, &data, &inlen, &flush)) { -#endif - return NULL; - } - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "y#|p", kwlist, &data, &inlen, &flush)) return NULL; return Compressor_compress__(self, data, inlen, flush); }