Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
909d3ec8
Commit
909d3ec8
authored
Apr 02, 2002
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert more METH_OLDARGS & PyArg_Parse()
Please review.
parent
c3950f68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
69 deletions
+69
-69
Modules/clmodule.c
Modules/clmodule.c
+35
-35
Modules/imageop.c
Modules/imageop.c
+30
-30
Modules/sgimodule.c
Modules/sgimodule.c
+4
-4
No files found.
Modules/clmodule.c
View file @
909d3ec8
...
...
@@ -104,7 +104,7 @@ cl_CompressImage(PyObject *self, PyObject *args)
char
*
frameBuffer
;
PyObject
*
compressedBuffer
;
if
(
!
PyArg_Parse
(
args
,
"(iiiifs#)
"
,
&
compressionScheme
,
if
(
!
PyArg_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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
,
&
paramID
,
&
value
))
{
if
(
!
PyArg_Parse
Tuple
(
args
,
"iii
"
,
&
scheme
,
&
paramID
,
&
value
))
{
PyErr_Clear
();
if
(
!
PyArg_Parse
(
args
,
"(iif)
"
,
&
scheme
,
&
paramID
,
&
fvalue
))
{
if
(
!
PyArg_Parse
Tuple
(
args
,
"iif
"
,
&
scheme
,
&
paramID
,
&
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_Parse
Tuple
(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_Parse
Tuple(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_
OLD
ARGS
},
{
"DecompressImage"
,
cl_DecompressImage
,
METH_
OLD
ARGS
},
{
"GetAlgorithmName"
,
cl_GetAlgorithmName
,
METH_
OLD
ARGS
},
{
"OpenCompressor"
,
cl_OpenCompressor
,
METH_
OLD
ARGS
},
{
"OpenDecompressor"
,
cl_OpenDecompressor
,
METH_
OLD
ARGS
},
{
"QueryAlgorithms"
,
cl_QueryAlgorithms
,
METH_
OLD
ARGS
},
{
"QueryMaxHeaderSize"
,
cl_QueryMaxHeaderSize
,
METH_
OLD
ARGS
},
{
"QueryScheme"
,
cl_QueryScheme
,
METH_
OLD
ARGS
},
{
"QuerySchemeFromName"
,
cl_QuerySchemeFromName
,
METH_
OLD
ARGS
},
{
"SetDefault"
,
cl_SetDefault
,
METH_
OLD
ARGS
},
{
"SetMax"
,
cl_SetMax
,
METH_
OLD
ARGS
},
{
"SetMin"
,
cl_SetMin
,
METH_
OLD
ARGS
},
{
"BytesPerSample"
,
cl_BytesPerSample
,
METH_
OLD
ARGS
},
{
"BytesPerPixel"
,
cl_BytesPerPixel
,
METH_
OLD
ARGS
},
{
"AudioFormatName"
,
cl_AudioFormatName
,
METH_
OLD
ARGS
},
{
"VideoFormatName"
,
cl_VideoFormatName
,
METH_
OLD
ARGS
},
{
"AlgorithmNumber"
,
cl_AlgorithmNumber
,
METH_
OLD
ARGS
},
{
"AlgorithmType"
,
cl_AlgorithmType
,
METH_
OLD
ARGS
},
{
"Algorithm"
,
cl_Algorithm
,
METH_
OLD
ARGS
},
{
"ParamNumber"
,
cl_ParamNumber
,
METH_
OLD
ARGS
},
{
"ParamType"
,
cl_ParamType
,
METH_
OLD
ARGS
},
{
"ParamID"
,
cl_ParamID
,
METH_
OLD
ARGS
},
{
"CompressImage"
,
cl_CompressImage
,
METH_
VAR
ARGS
},
{
"DecompressImage"
,
cl_DecompressImage
,
METH_
VAR
ARGS
},
{
"GetAlgorithmName"
,
cl_GetAlgorithmName
,
METH_
VAR
ARGS
},
{
"OpenCompressor"
,
cl_OpenCompressor
,
METH_
VAR
ARGS
},
{
"OpenDecompressor"
,
cl_OpenDecompressor
,
METH_
VAR
ARGS
},
{
"QueryAlgorithms"
,
cl_QueryAlgorithms
,
METH_
VAR
ARGS
},
{
"QueryMaxHeaderSize"
,
cl_QueryMaxHeaderSize
,
METH_
VAR
ARGS
},
{
"QueryScheme"
,
cl_QueryScheme
,
METH_
VAR
ARGS
},
{
"QuerySchemeFromName"
,
cl_QuerySchemeFromName
,
METH_
VAR
ARGS
},
{
"SetDefault"
,
cl_SetDefault
,
METH_
VAR
ARGS
},
{
"SetMax"
,
cl_SetMax
,
METH_
VAR
ARGS
},
{
"SetMin"
,
cl_SetMin
,
METH_
VAR
ARGS
},
{
"BytesPerSample"
,
cl_BytesPerSample
,
METH_
VAR
ARGS
},
{
"BytesPerPixel"
,
cl_BytesPerPixel
,
METH_
VAR
ARGS
},
{
"AudioFormatName"
,
cl_AudioFormatName
,
METH_
VAR
ARGS
},
{
"VideoFormatName"
,
cl_VideoFormatName
,
METH_
VAR
ARGS
},
{
"AlgorithmNumber"
,
cl_AlgorithmNumber
,
METH_
VAR
ARGS
},
{
"AlgorithmType"
,
cl_AlgorithmType
,
METH_
VAR
ARGS
},
{
"Algorithm"
,
cl_Algorithm
,
METH_
VAR
ARGS
},
{
"ParamNumber"
,
cl_ParamNumber
,
METH_
VAR
ARGS
},
{
"ParamType"
,
cl_ParamType
,
METH_
VAR
ARGS
},
{
"ParamID"
,
cl_ParamID
,
METH_
VAR
ARGS
},
#ifdef CLDEBUG
{
"cvt_type"
,
cvt_type
,
METH_
OLD
ARGS
},
{
"cvt_type"
,
cvt_type
,
METH_
VAR
ARGS
},
#endif
{
NULL
,
NULL
}
/* Sentinel */
};
...
...
Modules/imageop.c
View file @
909d3ec8
...
...
@@ -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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_Parse
Tuple
(
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_
OLD
ARGS
},
{
"scale"
,
imageop_scale
,
METH_
OLD
ARGS
},
{
"grey2mono"
,
imageop_grey2mono
,
METH_
OLD
ARGS
},
{
"grey2grey2"
,
imageop_grey2grey2
,
METH_
OLD
ARGS
},
{
"grey2grey4"
,
imageop_grey2grey4
,
METH_
OLD
ARGS
},
{
"dither2mono"
,
imageop_dither2mono
,
METH_
OLD
ARGS
},
{
"dither2grey2"
,
imageop_dither2grey2
,
METH_
OLD
ARGS
},
{
"mono2grey"
,
imageop_mono2grey
,
METH_
OLD
ARGS
},
{
"grey22grey"
,
imageop_grey22grey
,
METH_
OLD
ARGS
},
{
"grey42grey"
,
imageop_grey42grey
,
METH_
OLD
ARGS
},
{
"tovideo"
,
imageop_tovideo
,
METH_
OLD
ARGS
},
{
"rgb2rgb8"
,
imageop_rgb2rgb8
,
METH_
OLD
ARGS
},
{
"rgb82rgb"
,
imageop_rgb82rgb
,
METH_
OLD
ARGS
},
{
"rgb2grey"
,
imageop_rgb2grey
,
METH_
OLD
ARGS
},
{
"grey2rgb"
,
imageop_grey2rgb
,
METH_
OLD
ARGS
},
{
"crop"
,
imageop_crop
,
METH_
VAR
ARGS
},
{
"scale"
,
imageop_scale
,
METH_
VAR
ARGS
},
{
"grey2mono"
,
imageop_grey2mono
,
METH_
VAR
ARGS
},
{
"grey2grey2"
,
imageop_grey2grey2
,
METH_
VAR
ARGS
},
{
"grey2grey4"
,
imageop_grey2grey4
,
METH_
VAR
ARGS
},
{
"dither2mono"
,
imageop_dither2mono
,
METH_
VAR
ARGS
},
{
"dither2grey2"
,
imageop_dither2grey2
,
METH_
VAR
ARGS
},
{
"mono2grey"
,
imageop_mono2grey
,
METH_
VAR
ARGS
},
{
"grey22grey"
,
imageop_grey22grey
,
METH_
VAR
ARGS
},
{
"grey42grey"
,
imageop_grey42grey
,
METH_
VAR
ARGS
},
{
"tovideo"
,
imageop_tovideo
,
METH_
VAR
ARGS
},
{
"rgb2rgb8"
,
imageop_rgb2rgb8
,
METH_
VAR
ARGS
},
{
"rgb82rgb"
,
imageop_rgb82rgb
,
METH_
VAR
ARGS
},
{
"rgb2grey"
,
imageop_rgb2grey
,
METH_
VAR
ARGS
},
{
"grey2rgb"
,
imageop_grey2rgb
,
METH_
VAR
ARGS
},
{
0
,
0
}
};
...
...
Modules/sgimodule.c
View file @
909d3ec8
...
...
@@ -11,7 +11,7 @@ static PyObject *
sgi_nap
(
PyObject
*
self
,
PyObject
*
args
)
{
long
ticks
;
if
(
!
PyArg_Parse
(
args
,
"l
"
,
&
ticks
))
if
(
!
PyArg_Parse
Tuple
(
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_Parse
Tuple
(
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_OLD
ARGS
},
{
"_getpty"
,
sgi__getpty
,
METH_OLD
ARGS
},
{
"nap"
,
sgi_nap
,
METH_VAR
ARGS
},
{
"_getpty"
,
sgi__getpty
,
METH_VAR
ARGS
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment