Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows 64 bit issues #54

Merged
merged 8 commits into from
Mar 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tk/tkImaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
static Imaging
ImagingFind(const char* name)
{
long id;
Py_ssize_t id;

/* FIXME: use CObject instead? */
id = atol(name);
Expand Down
2 changes: 1 addition & 1 deletion _imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -2985,7 +2985,7 @@ _getattr_bands(ImagingObject* self, void* closure)
static PyObject*
_getattr_id(ImagingObject* self, void* closure)
{
return PyInt_FromLong((long) self->image);
return PyInt_FromSsize_t((Py_ssize_t) self->image);
}

static PyObject*
Expand Down
6 changes: 3 additions & 3 deletions _imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ buildProofTransform(PyObject *self, PyObject *args)
static PyObject *
cms_transform_apply(CmsTransformObject *self, PyObject *args)
{
long idIn;
long idOut;
Py_ssize_t idIn;
Py_ssize_t idOut;
Imaging im;
Imaging imOut;

int result;

if (!PyArg_ParseTuple(args, "ll:apply", &idIn, &idOut))
if (!PyArg_ParseTuple(args, "nn:apply", &idIn, &idOut))
return NULL;

im = (Imaging) idIn;
Expand Down
4 changes: 2 additions & 2 deletions _imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ font_render(FontObject* self, PyObject* args)
/* render string into given buffer (the buffer *must* have
the right size, or this will crash) */
PyObject* string;
long id;
Py_ssize_t id;
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;

#if PY_VERSION_HEX >= 0x03000000
Expand Down
8 changes: 4 additions & 4 deletions _imagingmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ _unop(PyObject* self, PyObject* args)
Imaging im1;
void (*unop)(Imaging, Imaging);

long op, i0, i1;
if (!PyArg_ParseTuple(args, "lll", &op, &i0, &i1))
Py_ssize_t op, i0, i1;
if (!PyArg_ParseTuple(args, "nnn", &op, &i0, &i1))
return NULL;

out = (Imaging) i0;
Expand All @@ -197,8 +197,8 @@ _binop(PyObject* self, PyObject* args)
Imaging im2;
void (*binop)(Imaging, Imaging, Imaging);

long op, i0, i1, i2;
if (!PyArg_ParseTuple(args, "llll", &op, &i0, &i1, &i2))
Py_ssize_t op, i0, i1, i2;
if (!PyArg_ParseTuple(args, "nnnn", &op, &i0, &i1, &i2))
return NULL;

out = (Imaging) i0;
Expand Down
4 changes: 2 additions & 2 deletions _imagingtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ _tkinit(PyObject* self, PyObject* args)
{
Tcl_Interp* interp;

long arg;
Py_ssize_t arg;
int is_interp;
if (!PyArg_ParseTuple(args, "li", &arg, &is_interp))
if (!PyArg_ParseTuple(args, "ni", &arg, &is_interp))
return NULL;

if (is_interp)
Expand Down
8 changes: 4 additions & 4 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ static BOOL CALLBACK list_windows_callback(HWND hwnd, LPARAM lParam)
GetWindowRect(hwnd, &outer);

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,
outer.left, outer.top, outer.right, outer.bottom
);
Expand Down Expand Up @@ -735,15 +735,15 @@ PyImaging_CreateWindowWin32(PyObject* self, PyObject* args)

/* register window callback */
Py_INCREF(callback);
SetWindowLong(wnd, 0, (LONG) callback);
SetWindowLong(wnd, sizeof(callback), (LONG) PyThreadState_Get());
SetWindowLongPtr(wnd, 0, (LONG_PTR) callback);
SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR) PyThreadState_Get());

Py_BEGIN_ALLOW_THREADS
ShowWindow(wnd, SW_SHOWNORMAL);
SetForegroundWindow(wnd); /* to make sure it's visible */
Py_END_ALLOW_THREADS

return Py_BuildValue("l", (long) wnd);
return Py_BuildValue("n", (Py_ssize_t) wnd);
}

PyObject*
Expand Down