14
0
forked from pool/python-pygame
OBS User unknown
2007-01-15 23:34:12 +00:00
committed by Git OBS Bridge
commit 9514629c36
8 changed files with 633 additions and 0 deletions

View File

@@ -0,0 +1,361 @@
--- src/base.c
+++ src/base.c
@@ -155,7 +155,7 @@
static PyObject* init(PyObject* self,PyObject* args)
{
PyObject *allmodules, *moduleslist, *dict, *func, *result, *mod;
- int loop, num;
+ Py_ssize_t loop, num;
int success=0, fail=0;
if(!PyArg_ParseTuple(args, ""))
@@ -215,7 +215,7 @@
{
PyObject* quit;
PyObject* privatefuncs;
- int num;
+ Py_ssize_t num;
if(!quitfunctions)
return;
@@ -414,7 +414,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
@@ -895,7 +895,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(PyExc_ValueError, "update requires a rectstyle or sequence of recstyles");
@@ -966,7 +966,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();
@@ -991,7 +991,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
@@ -240,7 +240,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*/
@@ -347,7 +348,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*/
@@ -658,7 +660,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
@@ -424,7 +424,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*/
@@ -534,7 +534,7 @@
if(keywords)
{
PyObject *key, *value;
- int pos = 0;
+ Py_ssize_t pos = 0;
while(PyDict_Next(keywords, &pos, &key, &value))
PyDict_SetItem(dict, key, value);
}
@@ -721,7 +721,7 @@
{
SDL_Event event;
int mask = 0;
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -776,7 +776,7 @@
{
SDL_Event event;
int mask = 0;
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type, *list, *e;
int val;
@@ -846,7 +846,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;
@@ -934,7 +934,7 @@
static PyObject* set_allowed(PyObject* self, PyObject* args)
{
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -978,7 +978,7 @@
static PyObject* set_blocked(PyObject* self, PyObject* args)
{
- int loop, num;
+ Py_ssize_t loop, num;
PyObject* type;
int val;
@@ -1020,7 +1020,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/image.c
+++ src/image.c
@@ -291,7 +291,8 @@
PyObject *surfobj, *string=NULL;
char *format, *data, *pixels;
SDL_Surface *surf, *temp=NULL;
- int w, h, color, len, flipped=0;
+ int w, h, color, flipped=0;
+ Py_ssize_t len;
int Rmask, Gmask, Bmask, Amask, Rshift, Gshift, Bshift, Ashift, Rloss, Gloss, Bloss, Aloss;
int hascolorkey, colorkey;
@@ -605,7 +606,8 @@
PyObject *string;
char *format, *data;
SDL_Surface *surf = NULL;
- int w, h, len, flipped=0;
+ int w, h, flipped=0;
+ Py_ssize_t len;
int loopw, looph;
if(!PyArg_ParseTuple(arg, "O!(ii)s|i", &PyString_Type, &string, &w, &h, &format, &flipped))
@@ -729,8 +731,9 @@
PyObject *buffer;
char *format, *data;
SDL_Surface *surf = NULL;
- int w, h, len;
- PyObject *surfobj;
+ int w, h;
+ PyObject *surfobj;
+ Py_ssize_t len;
if(!PyArg_ParseTuple(arg, "O(ii)s|i", &buffer, &w, &h, &format))
return NULL;
--- src/mouse.c
+++ src/mouse.c
@@ -202,7 +202,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
@@ -323,7 +323,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;
@@ -372,7 +372,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;
@@ -475,7 +475,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
PyObject* ret = NULL;
@@ -525,7 +525,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop, size;
+ Py_ssize_t loop, size;
PyObject* list, *obj;
PyObject* ret = NULL;
@@ -589,7 +589,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop=0;
+ Py_ssize_t loop=0;
PyObject* dict, *key, *val;
PyObject* ret = NULL;
@@ -598,7 +598,7 @@
if(!PyDict_Check(dict))
return RAISE(PyExc_TypeError, "Argument must be a dict with rectstyle keys.");
- while(PyDict_Next(dict, &loop, &key, &val))
+ while(PyDict_Next(dict, &loop, &key, &val))
{
if(!(argrect = GameRect_FromObject(key, &temp)))
{
@@ -640,7 +640,7 @@
{
PyRectObject* self = (PyRectObject*)oself;
GAME_Rect *argrect, temp;
- int loop=0;
+ Py_ssize_t loop=0;
PyObject* dict, *key, *val;
PyObject* ret = NULL;
@@ -653,7 +653,7 @@
if(!ret)
return NULL;
- while(PyDict_Next(dict, &loop, &key, &val))
+ while(PyDict_Next(dict, &loop, &key, &val))
{
if(!(argrect = GameRect_FromObject(key, &temp)))
{
@@ -974,7 +974,8 @@
{
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;
if (ilow < 0) ilow += l;
@@ -997,7 +998,8 @@
static int rect_ass_slice(PyRectObject *self, int ilow, int ihigh, PyObject *v)
{
int* data = (int*)&self->r;
- int numitems, loop, l = 4;
+ Py_ssize_t numitems, loop;
+ int l = 4;
int val;
if(!PySequence_Check(v))
@@ -1031,13 +1033,13 @@
}
static PySequenceMethods rect_as_sequence = {
- (inquiry)rect_length, /*length*/
+ (lenfunc)rect_length, /*length*/
(binaryfunc)NULL, /*concat*/
- (intargfunc)NULL, /*repeat*/
- (intargfunc)rect_item, /*item*/
- (intintargfunc)rect_slice, /*slice*/
- (intobjargproc)rect_ass_item, /*ass_item*/
- (intintobjargproc)rect_ass_slice, /*ass_slice*/
+ (ssizeargfunc)NULL, /*repeat*/
+ (ssizeargfunc)rect_item, /*item*/
+ (ssizessizeargfunc)rect_slice, /*slice*/
+ (ssizeobjargproc)rect_ass_item, /*ass_item*/
+ (ssizessizeobjargproc)rect_ass_slice, /*ass_slice*/
};
@@ -1094,7 +1096,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
@@ -433,7 +433,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))
@@ -448,7 +448,7 @@
if(!SDL_WasInit(SDL_INIT_VIDEO))
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)
@@ -1353,7 +1353,7 @@
if(rect && kw)
{
PyObject *key, *value;
- int pos=0;
+ Py_ssize_t pos=0;
while(PyDict_Next(kw, &pos, &key, &value))
{
if((PyObject_SetAttr(rect, key, value) == -1))