summaryrefslogtreecommitdiff
path: root/psycopg/lobject_int.c
diff options
context:
space:
mode:
authorJason Erickson <jerickso@stickpeople.com>2015-06-08 11:37:23 -0600
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-03-10 12:02:00 +0000
commit2cdc8d61a2da9f02c5b61daca6c83b61aca386f3 (patch)
treee7a191772dec629baf64c7a02a694b579c0479cf /psycopg/lobject_int.c
parentab5d8f419069bec1c35329fd67b9fe76fbbce4c8 (diff)
downloadpsycopg2-2cdc8d61a2da9f02c5b61daca6c83b61aca386f3.tar.gz
Fix Windows 64bit lobject support for very (>2GB) large objects
The type 'long' with Windows Visual C is 32bits in size for both 32bit and 64bit platforms. Changed type of variables that could be > 2GB from long to Py_ssize_t.
Diffstat (limited to 'psycopg/lobject_int.c')
-rw-r--r--psycopg/lobject_int.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c
index 8788c10..279ef1e 100644
--- a/psycopg/lobject_int.c
+++ b/psycopg/lobject_int.c
@@ -376,12 +376,12 @@ lobject_read(lobjectObject *self, char *buf, size_t len)
/* lobject_seek - move the current position in the lo */
-RAISES_NEG long
-lobject_seek(lobjectObject *self, long pos, int whence)
+RAISES_NEG Py_ssize_t
+lobject_seek(lobjectObject *self, Py_ssize_t pos, int whence)
{
PGresult *pgres = NULL;
char *error = NULL;
- long where;
+ Py_ssize_t where;
Dprintf("lobject_seek: fd = %d, pos = %ld, whence = %d",
self->fd, pos, whence);
@@ -391,12 +391,12 @@ lobject_seek(lobjectObject *self, long pos, int whence)
#ifdef HAVE_LO64
if (self->conn->server_version < 90300) {
- where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence);
+ where = (Py_ssize_t)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence);
} else {
- where = lo_lseek64(self->conn->pgconn, self->fd, pos, whence);
+ where = (Py_ssize_t)lo_lseek64(self->conn->pgconn, self->fd, pos, whence);
}
#else
- where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence);
+ where = (Py_ssize_t)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence);
#endif
Dprintf("lobject_seek: where = %ld", where);
if (where < 0)
@@ -412,12 +412,12 @@ lobject_seek(lobjectObject *self, long pos, int whence)
/* lobject_tell - tell the current position in the lo */
-RAISES_NEG long
+RAISES_NEG Py_ssize_t
lobject_tell(lobjectObject *self)
{
PGresult *pgres = NULL;
char *error = NULL;
- long where;
+ Py_ssize_t where;
Dprintf("lobject_tell: fd = %d", self->fd);
@@ -426,12 +426,12 @@ lobject_tell(lobjectObject *self)
#ifdef HAVE_LO64
if (self->conn->server_version < 90300) {
- where = (long)lo_tell(self->conn->pgconn, self->fd);
+ where = (Py_ssize_t)lo_tell(self->conn->pgconn, self->fd);
} else {
- where = lo_tell64(self->conn->pgconn, self->fd);
+ where = (Py_ssize_t)lo_tell64(self->conn->pgconn, self->fd);
}
#else
- where = (long)lo_tell(self->conn->pgconn, self->fd);
+ where = (Py_ssize_t)lo_tell(self->conn->pgconn, self->fd);
#endif
Dprintf("lobject_tell: where = %ld", where);
if (where < 0)