From 631883f62fb3303671bce9e7e6c26c25cfe25f82 Mon Sep 17 00:00:00 2001 From: Jason Erickson Date: Wed, 23 Feb 2011 15:11:27 -0700 Subject: [PATCH] Windows MSVC: Fix data loss compiler warnings Fixed MSVC compiler warnings where it was indicating a conversion from a larger data type to smaller data type might have data loss. --- psycopg/lobject_type.c | 5 +++-- psycopg/xid_type.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/psycopg/lobject_type.c b/psycopg/lobject_type.c index 51c41d35..ba45de2d 100644 --- a/psycopg/lobject_type.c +++ b/psycopg/lobject_type.c @@ -124,10 +124,11 @@ static PyObject * psyco_lobj_read(lobjectObject *self, PyObject *args) { PyObject *res; - int where, end, size = -1; + int where, end; + Py_ssize_t size = -1; char *buffer; - if (!PyArg_ParseTuple(args, "|i", &size)) return NULL; + if (!PyArg_ParseTuple(args, "|" CONV_CODE_PY_SSIZE_T, &size)) return NULL; EXC_IF_LOBJ_CLOSED(self); EXC_IF_LOBJ_LEVEL0(self); diff --git a/psycopg/xid_type.c b/psycopg/xid_type.c index 82d6d899..9e95fd1b 100644 --- a/psycopg/xid_type.c +++ b/psycopg/xid_type.c @@ -100,7 +100,8 @@ static int xid_init(XidObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = {"format_id", "gtrid", "bqual", NULL}; - int format_id, i, gtrid_len, bqual_len; + int format_id; + size_t i, gtrid_len, bqual_len; const char *gtrid, *bqual; PyObject *tmp;