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
49900000
Commit
49900000
authored
Oct 16, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More reformatting.
parent
0965e084
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
51 deletions
+50
-51
Modules/zlibmodule.c
Modules/zlibmodule.c
+50
-51
No files found.
Modules/zlibmodule.c
View file @
49900000
...
...
@@ -338,34 +338,34 @@ PyZlib_decompress(PyObject *self, PyObject *args)
static
PyObject
*
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
)
{
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
;
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
;
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
;
Py_DECREF
(
self
);
PyErr_SetString
(
PyExc_ValueError
,
"Invalid initialization option"
);
return
NULL
;
default:
zlib_error
(
self
->
zst
,
err
,
"while creating compression object"
);
Py_DECREF
(
self
);
...
...
@@ -376,37 +376,36 @@ PyZlib_compressobj(PyObject *selfptr, PyObject *args)
static
PyObject
*
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
)
{
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
;
self
->
is_initialised
=
1
;
return
(
PyObject
*
)
self
;
case
(
Z_STREAM_ERROR
):
Py_DECREF
(
self
);
PyErr_SetString
(
PyExc_ValueError
,
"Invalid initialization option"
);
return
NULL
;
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
;
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
;
}
}
}
static
void
...
...
@@ -415,7 +414,7 @@ Comp_dealloc(compobject *self)
ENTER_ZLIB
if
(
self
->
is_initialised
)
deflateEnd
(
&
self
->
zst
);
deflateEnd
(
&
self
->
zst
);
Py_XDECREF
(
self
->
unused_data
);
Py_XDECREF
(
self
->
unconsumed_tail
);
PyObject_Del
(
self
);
...
...
@@ -429,7 +428,7 @@ Decomp_dealloc(compobject *self)
ENTER_ZLIB
if
(
self
->
is_initialised
)
inflateEnd
(
&
self
->
zst
);
inflateEnd
(
&
self
->
zst
);
Py_XDECREF
(
self
->
unused_data
);
Py_XDECREF
(
self
->
unconsumed_tail
);
PyObject_Del
(
self
);
...
...
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