diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-04-02 18:26:33 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-04-02 18:26:33 (GMT) |
commit | b0aaec5706237c1086afbbbb9327be59509a6d83 (patch) | |
tree | 4ca3c7e378cd98882105354d197d4d4783f53632 /Modules | |
parent | 187ae561667f82142edbe7beaa612381b6bb0827 (diff) | |
download | cpython-b0aaec5706237c1086afbbbb9327be59509a6d83.zip cpython-b0aaec5706237c1086afbbbb9327be59509a6d83.tar.gz cpython-b0aaec5706237c1086afbbbb9327be59509a6d83.tar.bz2 |
Convert more METH_OLDARGS & PyArg_Parse()
Please review.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/clmodule.c | 70 | ||||
-rw-r--r-- | Modules/imageop.c | 60 | ||||
-rw-r--r-- | Modules/sgimodule.c | 8 |
3 files changed, 69 insertions, 69 deletions
diff --git a/Modules/clmodule.c b/Modules/clmodule.c index c8526c4..ef3d77a 100644 --- a/Modules/clmodule.c +++ b/Modules/clmodule.c @@ -104,7 +104,7 @@ cl_CompressImage(PyObject *self, PyObject *args) char *frameBuffer; PyObject *compressedBuffer; - if (!PyArg_Parse(args, "(iiiifs#)", &compressionScheme, + if (!PyArg_ParseTuple(args, "iiiifs#", &compressionScheme, &width, &height, &originalFormat, &compressionRatio, &frameBuffer, &frameBufferSize)) @@ -149,7 +149,7 @@ cl_DecompressImage(PyObject *self, PyObject *args) int compressedBufferSize, frameBufferSize; PyObject *frameBuffer; - if (!PyArg_Parse(args, "(iiiis#)", &compressionScheme, &width, &height, + if (!PyArg_ParseTuple(args, "iiiis#", &compressionScheme, &width, &height, &originalFormat, &compressedBuffer, &compressedBufferSize)) return NULL; @@ -670,7 +670,7 @@ doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *), int scheme; clobject *new; - if (!PyArg_Parse(args, "i", &scheme)) + if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; new = PyObject_New(clobject, &Cltype); @@ -711,7 +711,7 @@ cl_QueryScheme(PyObject *self, PyObject *args) int headerlen; int scheme; - if (!PyArg_Parse(args, "s#", &header, &headerlen)) + if (!PyArg_ParseTuple(args, "s#", &header, &headerlen)) return NULL; scheme = clQueryScheme(header); @@ -728,7 +728,7 @@ cl_QueryMaxHeaderSize(PyObject *self, PyObject *args) { int scheme; - if (!PyArg_Parse(args, "i", &scheme)) + if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; return PyInt_FromLong(clQueryMaxHeaderSize(scheme)); @@ -743,7 +743,7 @@ cl_QueryAlgorithms(PyObject *self, PyObject *args) PyObject *list; int i; - if (!PyArg_Parse(args, "i", &algorithmMediaType)) + if (!PyArg_ParseTuple(args, "i", &algorithmMediaType)) return NULL; error_handler_called = 0; @@ -791,7 +791,7 @@ cl_QuerySchemeFromName(PyObject *self, PyObject *args) char *name; int scheme; - if (!PyArg_Parse(args, "(is)", &algorithmMediaType, &name)) + if (!PyArg_ParseTuple(args, "is", &algorithmMediaType, &name)) return NULL; error_handler_called = 0; @@ -810,7 +810,7 @@ cl_GetAlgorithmName(PyObject *self, PyObject *args) int scheme; char *name; - if (!PyArg_Parse(args, "i", &scheme)) + if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; name = clGetAlgorithmName(scheme); @@ -829,9 +829,9 @@ do_set(PyObject *self, PyObject *args, int (*func)(int, int, int)) float fvalue; int is_float = 0; - if (!PyArg_Parse(args, "(iii)", &scheme, ¶mID, &value)) { + if (!PyArg_ParseTuple(args, "iii", &scheme, ¶mID, &value)) { PyErr_Clear(); - if (!PyArg_Parse(args, "(iif)", &scheme, ¶mID, &fvalue)) { + if (!PyArg_ParseTuple(args, "iif", &scheme, ¶mID, &fvalue)) { PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "bad argument list (format '(iii)' or '(iif)')"); @@ -884,7 +884,7 @@ cl_SetMax(PyObject *self, PyObject *args) static PyObject *cl_##name(PyObject *self, PyObject *args) \ { \ int x; \ - if (!PyArg_Parse(args, "i", &x)) return NULL; \ + if (!PyArg_ParseTuple(args, "i", &x)) return NULL; \ return Py##handler(CL_##name(x)); \ } @@ -892,7 +892,7 @@ static PyObject *cl_##name(PyObject *self, PyObject *args) \ static PyObject *cl_##name(PyObject *self, PyObject *args) \ { \ int a1, a2; \ - if (!PyArg_Parse(args, "(ii)", &a1, &a2)) return NULL; \ + if (!PyArg_ParseTuple(args, "ii", &a1, &a2)) return NULL; \ return Py##handler(CL_##name(a1, a2)); \ } @@ -926,30 +926,30 @@ cvt_type(PyObject *self, PyObject *args) #endif static PyMethodDef cl_methods[] = { - {"CompressImage", cl_CompressImage, METH_OLDARGS}, - {"DecompressImage", cl_DecompressImage, METH_OLDARGS}, - {"GetAlgorithmName", cl_GetAlgorithmName, METH_OLDARGS}, - {"OpenCompressor", cl_OpenCompressor, METH_OLDARGS}, - {"OpenDecompressor", cl_OpenDecompressor, METH_OLDARGS}, - {"QueryAlgorithms", cl_QueryAlgorithms, METH_OLDARGS}, - {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_OLDARGS}, - {"QueryScheme", cl_QueryScheme, METH_OLDARGS}, - {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_OLDARGS}, - {"SetDefault", cl_SetDefault, METH_OLDARGS}, - {"SetMax", cl_SetMax, METH_OLDARGS}, - {"SetMin", cl_SetMin, METH_OLDARGS}, - {"BytesPerSample", cl_BytesPerSample, METH_OLDARGS}, - {"BytesPerPixel", cl_BytesPerPixel, METH_OLDARGS}, - {"AudioFormatName", cl_AudioFormatName, METH_OLDARGS}, - {"VideoFormatName", cl_VideoFormatName, METH_OLDARGS}, - {"AlgorithmNumber", cl_AlgorithmNumber, METH_OLDARGS}, - {"AlgorithmType", cl_AlgorithmType, METH_OLDARGS}, - {"Algorithm", cl_Algorithm, METH_OLDARGS}, - {"ParamNumber", cl_ParamNumber, METH_OLDARGS}, - {"ParamType", cl_ParamType, METH_OLDARGS}, - {"ParamID", cl_ParamID, METH_OLDARGS}, + {"CompressImage", cl_CompressImage, METH_VARARGS}, + {"DecompressImage", cl_DecompressImage, METH_VARARGS}, + {"GetAlgorithmName", cl_GetAlgorithmName, METH_VARARGS}, + {"OpenCompressor", cl_OpenCompressor, METH_VARARGS}, + {"OpenDecompressor", cl_OpenDecompressor, METH_VARARGS}, + {"QueryAlgorithms", cl_QueryAlgorithms, METH_VARARGS}, + {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_VARARGS}, + {"QueryScheme", cl_QueryScheme, METH_VARARGS}, + {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_VARARGS}, + {"SetDefault", cl_SetDefault, METH_VARARGS}, + {"SetMax", cl_SetMax, METH_VARARGS}, + {"SetMin", cl_SetMin, METH_VARARGS}, + {"BytesPerSample", cl_BytesPerSample, METH_VARARGS}, + {"BytesPerPixel", cl_BytesPerPixel, METH_VARARGS}, + {"AudioFormatName", cl_AudioFormatName, METH_VARARGS}, + {"VideoFormatName", cl_VideoFormatName, METH_VARARGS}, + {"AlgorithmNumber", cl_AlgorithmNumber, METH_VARARGS}, + {"AlgorithmType", cl_AlgorithmType, METH_VARARGS}, + {"Algorithm", cl_Algorithm, METH_VARARGS}, + {"ParamNumber", cl_ParamNumber, METH_VARARGS}, + {"ParamType", cl_ParamType, METH_VARARGS}, + {"ParamID", cl_ParamID, METH_VARARGS}, #ifdef CLDEBUG - {"cvt_type", cvt_type, METH_OLDARGS}, + {"cvt_type", cvt_type, METH_VARARGS}, #endif {NULL, NULL} /* Sentinel */ }; diff --git a/Modules/imageop.c b/Modules/imageop.c index ca31040..7b925b8 100644 --- a/Modules/imageop.c +++ b/Modules/imageop.c @@ -35,7 +35,7 @@ imageop_crop(PyObject *self, PyObject *args) int ix, iy, xstep, ystep; PyObject *rv; - if ( !PyArg_Parse(args, "(s#iiiiiii)", &cp, &len, &size, &x, &y, + if ( !PyArg_ParseTuple(args, "s#iiiiiii", &cp, &len, &size, &x, &y, &newx1, &newy1, &newx2, &newy2) ) return 0; @@ -90,7 +90,7 @@ imageop_scale(PyObject *self, PyObject *args) int oix, oiy; PyObject *rv; - if ( !PyArg_Parse(args, "(s#iiiii)", + if ( !PyArg_ParseTuple(args, "s#iiiii", &cp, &len, &size, &x, &y, &newx, &newy) ) return 0; @@ -136,7 +136,7 @@ imageop_tovideo(PyObject *self, PyObject *args) PyObject *rv; - if ( !PyArg_Parse(args, "(s#iii)", &cp, &len, &width, &maxx, &maxy) ) + if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &width, &maxx, &maxy) ) return 0; if ( width != 1 && width != 4 ) { @@ -190,7 +190,7 @@ imageop_grey2mono(PyObject *self, PyObject *args) int i, bit; - if ( !PyArg_Parse(args, "(s#iii)", &cp, &len, &x, &y, &tres) ) + if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) ) return 0; if ( x*y != len ) { @@ -231,7 +231,7 @@ imageop_grey2grey4(PyObject *self, PyObject *args) int pos; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; if ( x*y != len ) { @@ -270,7 +270,7 @@ imageop_grey2grey2(PyObject *self, PyObject *args) int pos; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; if ( x*y != len ) { @@ -308,7 +308,7 @@ imageop_dither2mono(PyObject *self, PyObject *args) int i, bit; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; if ( x*y != len ) { @@ -354,7 +354,7 @@ imageop_dither2grey2(PyObject *self, PyObject *args) int sum = 0, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; if ( x*y != len ) { @@ -393,7 +393,7 @@ imageop_mono2grey(PyObject *self, PyObject *args) PyObject *rv; int i, bit; - if ( !PyArg_Parse(args, "(s#iiii)", &cp, &len, &x, &y, &v0, &v1) ) + if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) ) return 0; nlen = x*y; @@ -430,7 +430,7 @@ imageop_grey22grey(PyObject *self, PyObject *args) PyObject *rv; int i, pos, value = 0, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -466,7 +466,7 @@ imageop_grey42grey(PyObject *self, PyObject *args) PyObject *rv; int i, pos, value = 0, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -503,7 +503,7 @@ imageop_rgb2rgb8(PyObject *self, PyObject *args) int i, r, g, b; Py_UInt32 value, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -545,7 +545,7 @@ imageop_rgb82rgb(PyObject *self, PyObject *args) int i, r, g, b; Py_UInt32 value, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -586,7 +586,7 @@ imageop_rgb2grey(PyObject *self, PyObject *args) int i, r, g, b; Py_UInt32 value, nvalue; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -622,7 +622,7 @@ imageop_grey2rgb(PyObject *self, PyObject *args) int i; Py_UInt32 value; - if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; @@ -677,21 +677,21 @@ imageop_mul(object *self, object *args) */ static PyMethodDef imageop_methods[] = { - { "crop", imageop_crop, METH_OLDARGS }, - { "scale", imageop_scale, METH_OLDARGS }, - { "grey2mono", imageop_grey2mono, METH_OLDARGS }, - { "grey2grey2", imageop_grey2grey2, METH_OLDARGS }, - { "grey2grey4", imageop_grey2grey4, METH_OLDARGS }, - { "dither2mono", imageop_dither2mono, METH_OLDARGS }, - { "dither2grey2", imageop_dither2grey2, METH_OLDARGS }, - { "mono2grey", imageop_mono2grey, METH_OLDARGS }, - { "grey22grey", imageop_grey22grey, METH_OLDARGS }, - { "grey42grey", imageop_grey42grey, METH_OLDARGS }, - { "tovideo", imageop_tovideo, METH_OLDARGS }, - { "rgb2rgb8", imageop_rgb2rgb8, METH_OLDARGS }, - { "rgb82rgb", imageop_rgb82rgb, METH_OLDARGS }, - { "rgb2grey", imageop_rgb2grey, METH_OLDARGS }, - { "grey2rgb", imageop_grey2rgb, METH_OLDARGS }, + { "crop", imageop_crop, METH_VARARGS }, + { "scale", imageop_scale, METH_VARARGS }, + { "grey2mono", imageop_grey2mono, METH_VARARGS }, + { "grey2grey2", imageop_grey2grey2, METH_VARARGS }, + { "grey2grey4", imageop_grey2grey4, METH_VARARGS }, + { "dither2mono", imageop_dither2mono, METH_VARARGS }, + { "dither2grey2", imageop_dither2grey2, METH_VARARGS }, + { "mono2grey", imageop_mono2grey, METH_VARARGS }, + { "grey22grey", imageop_grey22grey, METH_VARARGS }, + { "grey42grey", imageop_grey42grey, METH_VARARGS }, + { "tovideo", imageop_tovideo, METH_VARARGS }, + { "rgb2rgb8", imageop_rgb2rgb8, METH_VARARGS }, + { "rgb82rgb", imageop_rgb82rgb, METH_VARARGS }, + { "rgb2grey", imageop_rgb2grey, METH_VARARGS }, + { "grey2rgb", imageop_grey2rgb, METH_VARARGS }, { 0, 0 } }; diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c index 4c96f04..f7e1263 100644 --- a/Modules/sgimodule.c +++ b/Modules/sgimodule.c @@ -11,7 +11,7 @@ static PyObject * sgi_nap(PyObject *self, PyObject *args) { long ticks; - if (!PyArg_Parse(args, "l", &ticks)) + if (!PyArg_ParseTuple(args, "l:nap", &ticks)) return NULL; Py_BEGIN_ALLOW_THREADS sginap(ticks); @@ -30,7 +30,7 @@ sgi__getpty(PyObject *self, PyObject *args) int nofork; char *name; int fildes; - if (!PyArg_Parse(args, "(iii)", &oflag, &mode, &nofork)) + if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork)) return NULL; errno = 0; name = _getpty(&fildes, oflag, (mode_t)mode, nofork); @@ -42,8 +42,8 @@ sgi__getpty(PyObject *self, PyObject *args) } static PyMethodDef sgi_methods[] = { - {"nap", sgi_nap, METH_OLDARGS}, - {"_getpty", sgi__getpty, METH_OLDARGS}, + {"nap", sgi_nap, METH_VARARGS}, + {"_getpty", sgi__getpty, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; |