[prev in list] [next in list] [prev in thread] [next in thread]
List: pyamf-commits
Subject: [pyamf-commits] r1620 - pyamf/branches/gerard-cpyamf-225/cpyamf
From: commits () pyamf ! org (SVN commit logs for PyAMF)
Date: 2008-08-28 8:58:08
Message-ID: 20080828085808.65AC424001 () mail ! collab ! eu
[Download RAW message or body]
Author: gerard
Date: 2008-08-28 10:58:08 +0200 (Thu, 28 Aug 2008)
New Revision: 1620
Modified:
pyamf/branches/gerard-cpyamf-225/cpyamf/util.c
Log:
More build fixes, this time to do with Py_ssize_t
Modified: pyamf/branches/gerard-cpyamf-225/cpyamf/util.c
===================================================================
--- pyamf/branches/gerard-cpyamf-225/cpyamf/util.c 2008-08-28 08:50:13 UTC (rev 1619)
+++ pyamf/branches/gerard-cpyamf-225/cpyamf/util.c 2008-08-28 08:58:08 UTC (rev 1620)
@@ -6,6 +6,12 @@
#include <stdio.h>
#include <structmember.h>
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
/* Useful Forward Declarations */
static PyObject * BufferedByteStream_tell(BufferedByteStream *);
static PyObject * BufferedByteStream_at_eof(BufferedByteStream *);
@@ -396,7 +402,7 @@
BufferedByteStream_write(BufferedByteStream *self, PyObject *obj)
{
char *buffer;
- long length;
+ Py_ssize_t length;
if(!self->buffer) {
PyErr_SetString(PyExc_ValueError, "buffer is closed");
@@ -975,7 +981,7 @@
{
PyObject *encoded_string = NULL;
char *buf = NULL;
- long len = -1;
+ Py_ssize_t len = -1;
if(!self->buffer) {
PyErr_SetString(PyExc_ValueError, "buffer is closed");
@@ -1076,7 +1082,7 @@
return result;
}
static PySequenceMethods BufferedByteStream_sequencemethods = {
- (long(*)(PyObject*))BufferedByteStream___len__, /*sq_length*/
+ (Py_ssize_t(*)(PyObject*))BufferedByteStream___len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
@@ -1186,7 +1192,7 @@
{
/* Copy data from a Python string */
char *str = NULL;
- long len = 0;
+ Py_ssize_t len = 0;
if (!PyString_AsStringAndSize(buf_obj, &str, &len))
{
PycStringIO->cwrite(self->buffer, str, len);
@@ -1197,7 +1203,7 @@
/* Copy data from a Python object with callable attribute getvalue. */
PyObject *val = PyObject_CallMethod(buf_obj, "getvalue", NULL);
char *str = NULL;
- long len = 0;
+ Py_ssize_t len = 0;
val = PyObject_CallMethod(buf_obj, "getvalue", NULL);
if (!PyString_AsStringAndSize(val, &str, &len))
@@ -1217,7 +1223,7 @@
val = PyObject_CallMethod(buf_obj, "read", NULL);
str = NULL;
- long len = 0;
+ Py_ssize_t len = 0;
if (!PyString_AsStringAndSize(val, &str, &len))
PycStringIO->cwrite(self->buffer, str, len);
Py_XDECREF(val);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic