File python-pygame-1.8.0-pep353.diff of Package python-pygame
--- src/base.c
+++ src/base.c
@@ -117,7 +117,7 @@
init (PyObject* self)
{
PyObject *allmodules, *moduleslist, *dict, *func, *result, *mod;
- int loop, num;
+ Py_ssize_t loop, num;
int success=0, fail=0;
if (!CheckSDLVersions ())
@@ -175,7 +175,7 @@
{
PyObject* quit;
PyObject* privatefuncs;
- int num;
+ Py_ssize_t num;
if (!quitfunctions)
return;
@@ -345,7 +345,7 @@
static int
RGBAFromObj (PyObject* obj, Uint8* RGBA)
{
- int length;
+ Py_ssize_t length;
Uint32 val;
if (PyTuple_Check (obj) && PyTuple_Size (obj) == 1)
return RGBAFromObj (PyTuple_GET_ITEM (obj, 0), RGBA);
--- src/display.c
+++ src/display.c
@@ -685,7 +685,7 @@
{
PyObject* seq;
PyObject* r;
- int loop, num, count;
+ Py_ssize_t loop, num, count;
SDL_Rect* rects;
if (PyTuple_Size (arg) != 1)
return RAISE
@@ -750,7 +750,7 @@
SDL_Palette* pal;
SDL_Color* colors;
PyObject* list, *item = NULL;
- int i, len;
+ Py_ssize_t i, len;
int r, g, b;
VIDEO_INIT_CHECK ();
@@ -774,7 +774,7 @@
if (!PySequence_Check (list))
return RAISE (PyExc_ValueError, "Argument must be a sequence type");
- len = MIN (pal->ncolors, PySequence_Length (list));
+ len = MIN ((Py_ssize_t)pal->ncolors, PySequence_Length (list));
colors = (SDL_Color*)malloc (len * sizeof (SDL_Color));
if (!colors)
--- src/draw.c
+++ src/draw.c
@@ -196,7 +196,8 @@
Uint8 rgba[4];
Uint32 color;
int closed, blend;
- int result, loop, length, drawn;
+ int result;
+ Py_ssize_t loop, length, drawn;
float startx, starty;
/*get all the arguments*/
@@ -285,7 +286,8 @@
Uint8 rgba[4];
Uint32 color;
int closed;
- int result, loop, length, drawn;
+ int result;
+ Py_ssize_t loop, length, drawn;
int startx, starty;
/*get all the arguments*/
@@ -536,7 +538,8 @@
SDL_Surface* surf;
Uint8 rgba[4];
Uint32 color;
- int width=0, length, loop, numpoints;
+ int width=0;
+ Py_ssize_t length, loop, numpoints;
int *xlist, *ylist;
int x, y, top, left, bottom, right, result;
--- src/event.c
+++ src/event.c
@@ -428,7 +428,7 @@
(unaryfunc)NULL, /*negative*/
(unaryfunc)NULL, /*pos*/
(unaryfunc)NULL, /*abs*/
- (inquiry)event_nonzero, /*nonzero*/
+ (lenfunc)event_nonzero, /*nonzero*/
(unaryfunc)NULL, /*invert*/
(binaryfunc)NULL, /*lshift*/
(binaryfunc)NULL, /*rshift*/
@@ -614,7 +614,7 @@
{
SDL_Event event;
int mask = 0;
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -660,7 +660,7 @@
{
SDL_Event event;
int mask = 0;
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type, *list, *e;
int val;
@@ -720,7 +720,7 @@
SDL_Event event;
int result;
int mask = 0;
- int loop, num, noargs=0;
+ Py_ssize_t loop, num, noargs=0;
PyObject* type;
int val;
@@ -793,7 +793,7 @@
static PyObject*
set_allowed (PyObject* self, PyObject* args)
{
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -833,7 +833,7 @@
static PyObject*
set_blocked (PyObject* self, PyObject* args)
{
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -873,7 +873,7 @@
static PyObject*
get_blocked (PyObject* self, PyObject* args)
{
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
int isblocked = 0;
--- src/mouse.c
+++ src/mouse.c
@@ -108,7 +108,7 @@
int w, h, spotx, spoty;
PyObject *xormask, *andmask;
Uint8 *xordata=NULL, *anddata=NULL;
- int xorsize, andsize, loop;
+ Py_ssize_t xorsize, andsize, loop;
int val;
SDL_Cursor *lastcursor, *cursor = NULL;
--- src/rect.c
+++ src/rect.c
@@ -284,7 +284,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
int t, l, b, r;
@@ -326,7 +326,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
int t, l, b, r;
@@ -401,7 +401,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
PyObject* ret = NULL;
@@ -442,7 +442,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
PyObject* ret = NULL;
@@ -807,7 +807,8 @@
PyRectObject *self = (PyRectObject *) _self;
PyObject *list;
int* data = (int*)&self->r;
- int numitems, loop, l = 4;
+ Py_ssize_t numitems, loop;
+ int l = 4;
if (ihigh < 0)
ihigh += l;
@@ -840,7 +841,8 @@
{
PyRectObject *self = (PyRectObject *) _self;
int* data = (int*)&self->r;
- int numitems, loop, l = 4;
+ Py_ssize_t numitems, loop;
+ int l = 4;
int val;
if (!PySequence_Check (v))
@@ -948,7 +950,7 @@
(unaryfunc)NULL, /*negative*/
(unaryfunc)NULL, /*pos*/
(unaryfunc)NULL, /*abs*/
- (inquiry)rect_nonzero, /*nonzero*/
+ (lenfunc)rect_nonzero, /*nonzero*/
(unaryfunc)NULL, /*invert*/
(binaryfunc)NULL, /*lshift*/
(binaryfunc)NULL, /*rshift*/
--- src/surface.c
+++ src/surface.c
@@ -753,7 +753,7 @@
SDL_Palette *pal = surf->format->palette;
SDL_Color *colors;
PyObject *list, *item;
- int i, len;
+ Py_ssize_t i, len;
int r, g, b;
if (!PyArg_ParseTuple (args, "O", &list))
@@ -770,7 +770,7 @@
return RAISE (PyExc_SDLError,
"cannot set palette without pygame.display initialized");
- len = MIN (pal->ncolors, PySequence_Length (list));
+ len = MIN ((Py_ssize_t)pal->ncolors, PySequence_Length (list));
colors = (SDL_Color *) malloc (len * sizeof (SDL_Color));
if (!colors)