Fix a few places where ints were passed to PyArg_Parse instead of Py_ssize_t

This commit is contained in:
Kovid Goyal 2021-12-01 10:55:09 +05:30
parent 055f5b0979
commit 872613f5f3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 8 additions and 7 deletions

View File

@ -372,7 +372,7 @@ usbobserver_has_mtp_interface(io_service_t usb_device) {
static PyObject* static PyObject*
usbobserver_is_mtp(PyObject *self, PyObject * args) { usbobserver_is_mtp(PyObject *self, PyObject * args) {
int serial_sz = 0; Py_ssize_t serial_sz = 0;
long vendor_id = 0, product_id = 0, bcd = 0; long vendor_id = 0, product_id = 0, bcd = 0;
char *serial = NULL, buf[500] = {0}; char *serial = NULL, buf[500] = {0};
CFNumberRef num = NULL; CFNumberRef num = NULL;

View File

@ -152,7 +152,7 @@ decompress(PyObject *self, PyObject *args)
{ {
unsigned char *inbuf; unsigned char *inbuf;
unsigned char *outbuf; unsigned char *outbuf;
unsigned int inlen; Py_ssize_t inlen;
unsigned int outlen; unsigned int outlen;
int err; int err;
memory_file source; memory_file source;

View File

@ -17,7 +17,7 @@ static PyObject *
msdes_deskey(PyObject *self, PyObject *args) msdes_deskey(PyObject *self, PyObject *args)
{ {
unsigned char *key = NULL; unsigned char *key = NULL;
unsigned int len = 0; Py_ssize_t len = 0;
short int edf = 0; short int edf = 0;
if (!PyArg_ParseTuple(args, "y#h", &key, &len, &edf)) { if (!PyArg_ParseTuple(args, "y#h", &key, &len, &edf)) {
@ -44,8 +44,8 @@ msdes_des(PyObject *self, PyObject *args)
{ {
unsigned char *inbuf = NULL; unsigned char *inbuf = NULL;
unsigned char *outbuf = NULL; unsigned char *outbuf = NULL;
unsigned int len = 0; Py_ssize_t len = 0;
unsigned int off = 0; Py_ssize_t off = 0;
PyObject *retval = NULL; PyObject *retval = NULL;
if (!PyArg_ParseTuple(args, "y#", &inbuf, &len)) { if (!PyArg_ParseTuple(args, "y#", &inbuf, &len)) {

View File

@ -376,7 +376,7 @@ error:
static PyObject * static PyObject *
PDFDoc_set_xmp_metadata(PDFDoc *self, PyObject *args) { PDFDoc_set_xmp_metadata(PDFDoc *self, PyObject *args) {
const char *raw = NULL; const char *raw = NULL;
long len = 0; Py_ssize_t len = 0;
PoDoFo::PdfObject *metadata = NULL, *catalog = NULL; PoDoFo::PdfObject *metadata = NULL, *catalog = NULL;
PoDoFo::PdfStream *str = NULL; PoDoFo::PdfStream *str = NULL;
TVecFilters compressed(1); TVecFilters compressed(1);

View File

@ -959,7 +959,8 @@ is_wow64_process(PyObject *self, PyObject *args) {
static PyObject* static PyObject*
write_file(PyObject *self, PyObject *args) { write_file(PyObject *self, PyObject *args) {
int size, offset = 0; int offset = 0;
Py_ssize_t size;
const char *data; const char *data;
HANDLE handle; HANDLE handle;
if (!PyArg_ParseTuple(args, "O&y#|i", convert_handle, &handle, &data, &size, &offset)) return NULL; if (!PyArg_ParseTuple(args, "O&y#|i", convert_handle, &handle, &data, &size, &offset)) return NULL;