[Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.47,2.48
Jeremy Hylton
jhylton@users.sourceforge.net
Tue, 16 Oct 2001 14:59:37 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv10519
Modified Files:
zlibmodule.c
Log Message:
More reformatting.
Index: zlibmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v
retrieving revision 2.47
retrieving revision 2.48
diff -C2 -d -r2.47 -r2.48
*** zlibmodule.c 2001/10/16 21:56:09 2.47
--- zlibmodule.c 2001/10/16 21:59:35 2.48
***************
*** 339,370 ****
PyZlib_compressobj(PyObject *selfptr, PyObject *args)
{
! compobject *self;
! int level=Z_DEFAULT_COMPRESSION, method=DEFLATED;
! int wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=0, err;
! if (!PyArg_ParseTuple(args, "|iiiii:compressobj", &level, &method, &wbits,
! &memLevel, &strategy))
! return NULL;
! self = newcompobject(&Comptype);
! if (self==NULL) return(NULL);
! self->zst.zalloc = (alloc_func)NULL;
! self->zst.zfree = (free_func)Z_NULL;
! err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy);
! switch(err)
! {
case (Z_OK):
! self->is_initialised = 1;
! return (PyObject*)self;
case (Z_MEM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_MemoryError,
! "Can't allocate memory for compression object");
! return NULL;
case(Z_STREAM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_ValueError,
! "Invalid initialization option");
! return NULL;
default:
zlib_error(self->zst, err, "while creating compression object");
--- 339,370 ----
PyZlib_compressobj(PyObject *selfptr, PyObject *args)
{
! compobject *self;
! int level=Z_DEFAULT_COMPRESSION, method=DEFLATED;
! int wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=0, err;
! if (!PyArg_ParseTuple(args, "|iiiii:compressobj", &level, &method, &wbits,
! &memLevel, &strategy))
! return NULL;
! self = newcompobject(&Comptype);
! if (self==NULL)
! return(NULL);
! self->zst.zalloc = (alloc_func)NULL;
! self->zst.zfree = (free_func)Z_NULL;
! err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy);
! switch(err) {
case (Z_OK):
! self->is_initialised = 1;
! return (PyObject*)self;
case (Z_MEM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_MemoryError,
! "Can't allocate memory for compression object");
! return NULL;
case(Z_STREAM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_ValueError,
! "Invalid initialization option");
! return NULL;
default:
zlib_error(self->zst, err, "while creating compression object");
***************
*** 377,411 ****
PyZlib_decompressobj(PyObject *selfptr, PyObject *args)
{
! int wbits=DEF_WBITS, err;
! compobject *self;
! if (!PyArg_ParseTuple(args, "|i:decompressobj", &wbits))
! {
! return NULL;
! }
! self=newcompobject(&Decomptype);
! if (self==NULL) return(NULL);
! self->zst.zalloc=(alloc_func)NULL;
! self->zst.zfree=(free_func)Z_NULL;
! err=inflateInit2(&self->zst, wbits);
! switch(err)
! {
case (Z_OK):
! self->is_initialised = 1;
! return (PyObject*)self;
case(Z_STREAM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_ValueError,
! "Invalid initialization option");
! return NULL;
case (Z_MEM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_MemoryError,
! "Can't allocate memory for decompression object");
! return NULL;
default:
zlib_error(self->zst, err, "while creating decompression object");
Py_DECREF(self);
return NULL;
! }
}
--- 377,410 ----
PyZlib_decompressobj(PyObject *selfptr, PyObject *args)
{
! int wbits=DEF_WBITS, err;
! compobject *self;
! if (!PyArg_ParseTuple(args, "|i:decompressobj", &wbits))
! return NULL;
!
! self = newcompobject(&Decomptype);
! if (self==NULL)
! return(NULL);
! self->zst.zalloc = (alloc_func)NULL;
! self->zst.zfree = (free_func)Z_NULL;
! err = inflateInit2(&self->zst, wbits);
! switch(err) {
case (Z_OK):
! self->is_initialised = 1;
! return (PyObject*)self;
case(Z_STREAM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_ValueError,
! "Invalid initialization option");
! return NULL;
case (Z_MEM_ERROR):
! Py_DECREF(self);
! PyErr_SetString(PyExc_MemoryError,
! "Can't allocate memory for decompression object");
! return NULL;
default:
zlib_error(self->zst, err, "while creating decompression object");
Py_DECREF(self);
return NULL;
! }
}
***************
*** 416,420 ****
if (self->is_initialised)
! deflateEnd(&self->zst);
Py_XDECREF(self->unused_data);
Py_XDECREF(self->unconsumed_tail);
--- 415,419 ----
if (self->is_initialised)
! deflateEnd(&self->zst);
Py_XDECREF(self->unused_data);
Py_XDECREF(self->unconsumed_tail);
***************
*** 430,434 ****
if (self->is_initialised)
! inflateEnd(&self->zst);
Py_XDECREF(self->unused_data);
Py_XDECREF(self->unconsumed_tail);
--- 429,433 ----
if (self->is_initialised)
! inflateEnd(&self->zst);
Py_XDECREF(self->unused_data);
Py_XDECREF(self->unconsumed_tail);