[Zope-Checkins] CVS: Zope2 - zlib.c:1.5
shane@digicool.com
shane@digicool.com
Wed, 23 May 2001 14:32:31 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/Components/zlib
In directory korak.digicool.com:/tmp/cvs-serv14315
Modified Files:
zlib.c
Log Message:
Silenced gcc warnings.
- Updated parameter declaration style.
- Used casts to PyCFunction where the function signature is compatible.
I don't like this but it retains all current behavior. I see a potential
for segfaults.
--- Updated File zlib.c in package Zope2 --
--- zlib.c 2000/04/17 20:16:59 1.4
+++ zlib.c 2001/05/23 18:32:31 1.5
@@ -28,8 +28,7 @@
} compobject;
static compobject *
-newcompobject(type)
- PyTypeObject *type;
+newcompobject(PyTypeObject *type)
{
compobject *self;
self = PyObject_NEW(compobject, type);
@@ -39,9 +38,7 @@
}
static PyObject *
-PyZlib_compress(self, args)
- PyObject *self;
- PyObject *args;
+PyZlib_compress(PyObject *self, PyObject *args)
{
PyObject *ReturnVal;
Byte *input, *output;
@@ -127,9 +124,7 @@
}
static PyObject *
-PyZlib_decompress(self, args)
- PyObject *self;
- PyObject *args;
+PyZlib_decompress(PyObject *self, PyObject *args)
{
PyObject *ReturnVal;
Byte *input, *output;
@@ -222,9 +217,7 @@
}
static PyObject *
-PyZlib_compressobj(selfptr, args)
- PyObject *selfptr;
- PyObject *args;
+PyZlib_compressobj(PyObject *selfptr, PyObject *args)
{
compobject *self;
int level=Z_DEFAULT_COMPRESSION, method=DEFLATED;
@@ -288,9 +281,7 @@
}
static PyObject *
-PyZlib_decompressobj(selfptr, args)
- PyObject *selfptr;
- PyObject *args;
+PyZlib_decompressobj(PyObject *selfptr, PyObject *args)
{
int wbits=DEF_WBITS, err;
compobject *self;
@@ -330,25 +321,21 @@
}
static void
-Comp_dealloc(self)
- compobject *self;
+Comp_dealloc(compobject *self)
{
int err;
err=deflateEnd(&self->zst); /* Deallocate zstream structure */
}
static void
-Decomp_dealloc(self)
- compobject *self;
+Decomp_dealloc(compobject *self)
{
int err;
err=inflateEnd(&self->zst); /* Deallocate zstream structure */
}
static PyObject *
-PyZlib_objcompress(self, args)
- compobject *self;
- PyObject *args;
+PyZlib_objcompress(compobject *self, PyObject *args)
{
int length=0, err, inplen;
Byte *buf=NULL;
@@ -388,9 +375,7 @@
}
static PyObject *
-PyZlib_objdecompress(self, args)
- compobject *self;
- PyObject *args;
+PyZlib_objdecompress(compobject *self, PyObject *args)
{
int length=0, err, inplen;
Byte *buf=NULL;
@@ -429,9 +414,7 @@
}
static PyObject *
-PyZlib_flush(self, args)
- compobject *self;
- PyObject *args;
+PyZlib_flush(compobject *self, PyObject *args)
{
int length=0, err;
Byte *buf=NULL;
@@ -479,9 +462,7 @@
}
static PyObject *
-PyZlib_unflush(self, args)
- compobject *self;
- PyObject *args;
+PyZlib_unflush(compobject *self, PyObject *args)
{
int length=0, err;
Byte *buf=NULL;
@@ -529,37 +510,32 @@
static PyMethodDef comp_methods[] =
{
- {"compress", PyZlib_objcompress, 1},
- {"flush", PyZlib_flush, 0},
+ {"compress", (PyCFunction)PyZlib_objcompress, 1},
+ {"flush", (PyCFunction)PyZlib_flush, 0},
{NULL, NULL}
};
static PyMethodDef Decomp_methods[] =
{
- {"decompress", PyZlib_objdecompress, 1},
- {"flush", PyZlib_unflush, 0},
+ {"decompress", (PyCFunction)PyZlib_objdecompress, 1},
+ {"flush", (PyCFunction)PyZlib_unflush, 0},
{NULL, NULL}
};
static PyObject *
-Comp_getattr(self, name)
- compobject *self;
- char *name;
+Comp_getattr(compobject *self, char *name)
{
return Py_FindMethod(comp_methods, (PyObject *)self, name);
}
static PyObject *
-Decomp_getattr(self, name)
- compobject *self;
- char *name;
+Decomp_getattr(compobject *self, char *name)
{
return Py_FindMethod(Decomp_methods, (PyObject *)self, name);
}
static PyObject *
-PyZlib_adler32(self, args)
- PyObject *self, *args;
+PyZlib_adler32(PyObject *self, PyObject *args)
{
uLong adler32val=adler32(0L, Z_NULL, 0);
Byte *buf;
@@ -575,8 +551,7 @@
static PyObject *
-PyZlib_crc32(self, args)
- PyObject *self, *args;
+PyZlib_crc32(PyObject *self, PyObject *args)
{
uLong crc32val=crc32(0L, Z_NULL, 0);
Byte *buf;
@@ -641,10 +616,7 @@
/* Convenience routine to export an integer value.
For simplicity, errors (which are unlikely anyway) are ignored. */
static void
-insint(d, name, value)
- PyObject *d;
- char *name;
- int value;
+insint(PyObject *d, char *name, int value)
{
PyObject *v = PyInt_FromLong((long) value);
if (v == NULL) {
@@ -658,7 +630,7 @@
}
void
-PyInit_zlib()
+PyInit_zlib(void)
{
PyObject *m, *d;