Merge pull request #54 from cgohlke/patch-2

Fix Windows 64 bit issues
This commit is contained in:
Alex Clark ☺ 2013-03-05 10:54:08 -08:00
commit 5b369a71c5
7 changed files with 17 additions and 17 deletions

View File

@ -58,7 +58,7 @@
static Imaging static Imaging
ImagingFind(const char* name) ImagingFind(const char* name)
{ {
long id; Py_ssize_t id;
/* FIXME: use CObject instead? */ /* FIXME: use CObject instead? */
id = atol(name); id = atol(name);

View File

@ -2995,7 +2995,7 @@ _getattr_bands(ImagingObject* self, void* closure)
static PyObject* static PyObject*
_getattr_id(ImagingObject* self, void* closure) _getattr_id(ImagingObject* self, void* closure)
{ {
return PyInt_FromLong((long) self->image); return PyInt_FromSsize_t((Py_ssize_t) self->image);
} }
static PyObject* static PyObject*

View File

@ -376,14 +376,14 @@ buildProofTransform(PyObject *self, PyObject *args)
static PyObject * static PyObject *
cms_transform_apply(CmsTransformObject *self, PyObject *args) cms_transform_apply(CmsTransformObject *self, PyObject *args)
{ {
long idIn; Py_ssize_t idIn;
long idOut; Py_ssize_t idOut;
Imaging im; Imaging im;
Imaging imOut; Imaging imOut;
int result; int result;
if (!PyArg_ParseTuple(args, "ll:apply", &idIn, &idOut)) if (!PyArg_ParseTuple(args, "nn:apply", &idIn, &idOut))
return NULL; return NULL;
im = (Imaging) idIn; im = (Imaging) idIn;

View File

@ -293,9 +293,9 @@ font_render(FontObject* self, PyObject* args)
/* render string into given buffer (the buffer *must* have /* render string into given buffer (the buffer *must* have
the right size, or this will crash) */ the right size, or this will crash) */
PyObject* string; PyObject* string;
long id; Py_ssize_t id;
int mask = 0; int mask = 0;
if (!PyArg_ParseTuple(args, "Ol|i:render", &string, &id, &mask)) if (!PyArg_ParseTuple(args, "On|i:render", &string, &id, &mask))
return NULL; return NULL;
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000

View File

@ -174,8 +174,8 @@ _unop(PyObject* self, PyObject* args)
Imaging im1; Imaging im1;
void (*unop)(Imaging, Imaging); void (*unop)(Imaging, Imaging);
long op, i0, i1; Py_ssize_t op, i0, i1;
if (!PyArg_ParseTuple(args, "lll", &op, &i0, &i1)) if (!PyArg_ParseTuple(args, "nnn", &op, &i0, &i1))
return NULL; return NULL;
out = (Imaging) i0; out = (Imaging) i0;
@ -197,8 +197,8 @@ _binop(PyObject* self, PyObject* args)
Imaging im2; Imaging im2;
void (*binop)(Imaging, Imaging, Imaging); void (*binop)(Imaging, Imaging, Imaging);
long op, i0, i1, i2; Py_ssize_t op, i0, i1, i2;
if (!PyArg_ParseTuple(args, "llll", &op, &i0, &i1, &i2)) if (!PyArg_ParseTuple(args, "nnnn", &op, &i0, &i1, &i2))
return NULL; return NULL;
out = (Imaging) i0; out = (Imaging) i0;

View File

@ -35,9 +35,9 @@ _tkinit(PyObject* self, PyObject* args)
{ {
Tcl_Interp* interp; Tcl_Interp* interp;
long arg; Py_ssize_t arg;
int is_interp; int is_interp;
if (!PyArg_ParseTuple(args, "li", &arg, &is_interp)) if (!PyArg_ParseTuple(args, "ni", &arg, &is_interp))
return NULL; return NULL;
if (is_interp) if (is_interp)

View File

@ -399,7 +399,7 @@ static BOOL CALLBACK list_windows_callback(HWND hwnd, LPARAM lParam)
GetWindowRect(hwnd, &outer); GetWindowRect(hwnd, &outer);
item = Py_BuildValue( item = Py_BuildValue(
"lN(iiii)(iiii)", (long) hwnd, title, "nN(iiii)(iiii)", (Py_ssize_t) hwnd, title,
inner.left, inner.top, inner.right, inner.bottom, inner.left, inner.top, inner.right, inner.bottom,
outer.left, outer.top, outer.right, outer.bottom outer.left, outer.top, outer.right, outer.bottom
); );
@ -735,15 +735,15 @@ PyImaging_CreateWindowWin32(PyObject* self, PyObject* args)
/* register window callback */ /* register window callback */
Py_INCREF(callback); Py_INCREF(callback);
SetWindowLong(wnd, 0, (LONG) callback); SetWindowLongPtr(wnd, 0, (LONG_PTR) callback);
SetWindowLong(wnd, sizeof(callback), (LONG) PyThreadState_Get()); SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR) PyThreadState_Get());
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
ShowWindow(wnd, SW_SHOWNORMAL); ShowWindow(wnd, SW_SHOWNORMAL);
SetForegroundWindow(wnd); /* to make sure it's visible */ SetForegroundWindow(wnd); /* to make sure it's visible */
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return Py_BuildValue("l", (long) wnd); return Py_BuildValue("n", (Py_ssize_t) wnd);
} }
PyObject* PyObject*