Commit Graph

192 Commits

Author SHA1 Message Date
Martin v. Löwis caef93d82c Silence warnings about passing unsigned char** as char**. 2001-09-08 16:23:34 +00:00
Martin v. Löwis 3bd8c1ee47 Patch #450702: allow threads when calling into zlib, protect usage of
the module in multiple threads with a global lock.
2001-09-07 16:27:31 +00:00
Andrew M. Kuchling a1a690fa9c Patch #103926: fix two warnings from Tru64's compiler 2001-02-22 15:52:55 +00:00
Andrew M. Kuchling 9aff4a2ad0 Patch #103373 from Donovan Baarda: This patch:
* fixes the zlib decompress sync flush bug as reported in bug #124981
  * avoids repeat calls to (in|de)flateEnd when destroying (de)compression
    objects
  * raises exception when allocating unused_data fails
  * fixes memory leak when allocating unused_data fails
  * raises exception when allocating decompress data fails
  * removes vestigial code from decompress flush now that decompression
    returns all available data
  * tidies code so object compress/decompress/flush routines are consistent
2001-02-21 02:15:56 +00:00
Tim Peters ee826f88c9 Docs for new Windows zlib build procedure. 2001-01-31 19:39:44 +00:00
Mark Hammond ae8c268a2b Fix [ Bug #129293 ] zlib library used for binary win32 distribution can crash
This involves changing the zlib build process to build zlib itself from sources, then use that library.  Also updated are the comments to reflect the new official home of zlib, and add Windows specific notes regarding the build process.
2001-01-31 10:28:03 +00:00
Andrew M. Kuchling d923831027 Patch #101810: check whether zst.avail_out is non-zero when getting
a Z_BUF_ERROR while decompressing.  If it is, assume that this means
   the data being decompressed is bad and raise an exception, instead of
   just assuming that Z_BUF_ERROR always means that more space is required.
2000-10-09 14:18:10 +00:00
Andrew M. Kuchling 14f515844d Use METH_VARARGS instead of numeric constant 1 2000-08-03 02:04:05 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.

All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:

long
func(a, b)
	long a;
	long b; /* flagword */
{

and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
2000-07-21 06:00:07 +00:00
Peter Schneider-Kamp a788a7f0fb ANSI-fication 2000-07-10 09:57:19 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 54b1c0b408 Windows: Since we're not using ZLIB.DLL any more, don't define ZLIB_DLL.
(Mark Hammond.)
2000-04-06 13:20:38 +00:00
Guido van Rossum 43713e5a28 Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Fred Drake 8972dfd58e For ZlibError and ZLIB_VERSION, only attempt to add entry to the
module dict if the inserted object isn't NULL (basic defensive
programming!).
1999-12-22 16:13:54 +00:00
Andrew M. Kuchling 313a3e36e7 Fix typo in docstring: wbites -> wbits 1999-12-20 22:13:38 +00:00
Guido van Rossum aee9bb2d0b Cast added by Jack Jansen (for Mac port). 1999-04-12 14:35:48 +00:00
Guido van Rossum b729a1d0a8 Patch by Andrew Kuchling to unflush() (flush() for deflating).
Without this, if inflate() returned Z_BUF_ERROR asking for more output
space, we would report the error; now, we increase the buffer size and
try again, just as for Z_OK.
1999-04-07 20:23:17 +00:00
Andrew M. Kuchling b95227db4f Add an .unused_data attribute to decompressor objects. If .unused_data
is not an empty string, this means that you have arrived at the
end of the stream of compressed data, and the contents of .unused_data are
whatever follows the compressed stream.
1999-03-25 21:21:08 +00:00
Andrew M. Kuchling 173156fa32 Fixed the flush() method of compression objects; the test for
the end of loop was incorrect, and failed when the flushmode != Z_FINISH.
    Logic cleaned up and commented.
1999-03-22 19:25:30 +00:00
Andrew M. Kuchling 1c7aaa2d73 Added missing DECREF's in the error branches when creating a compressor or
decompressor object.  This required adding a flag to the struct which is
    true if initialisation was completed; on object destruction, deflateEnd()
    is only called if the flag is true.
1999-01-29 21:49:34 +00:00
Barry Warsaw 30aa1e7d31 PyInit_zlib(): Plug a small memory leak. Jeremy is looking into the
more severe ones.
1999-01-28 19:40:05 +00:00
Jeremy Hylton 6892aa372d fix bug in PyZlib_flush.
patch from Grzegorz Makarewicz & Rafal Smotrzyk.
1999-01-06 22:56:24 +00:00
Jeremy Hylton 5bc4abe006 replace missing zalloc initialization (test_zlib now runs
successfully)
1998-12-21 17:15:00 +00:00
Jeremy Hylton 36252022ec remove debugging fprintf (should have checked this before previous
checkin)
1998-12-21 16:40:21 +00:00
Jeremy Hylton a37e244536 patches from Andrew
NOTE: There is still a bug of some sort in the behavior of zlib.  In
at least one case, inflate returns Z_OK (which is typically
interpreted to mean that more output space is needed) when it has
finished inflating a buffer.  This has been reported as a bug to the
zlib maintainers; we may need to change the Python interface.
1998-12-18 22:13:11 +00:00
Fred Drake 6de7d0c338 When _PyString_Resize() reports failure, the variable referring to the
string we wanted to resize is set to NULL.  Don't Py_DECREF() those
variables!  (5 places)
1998-12-18 19:46:59 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum c69bac539c Fix benign problems found by a picky SGI compiler (unreachable break
after a return).
1998-07-07 22:21:45 +00:00
Guido van Rossum 821a5e42bf Added URLs for zlib's home page and the Windows DLL's home page . 1998-05-08 14:56:29 +00:00
Guido van Rossum 115f517f77 Tiny patch for zlib 1.1.2 1998-04-23 20:22:11 +00:00
Guido van Rossum 9ec0f8b405 Win32 treatment. 1997-12-18 05:21:29 +00:00
Guido van Rossum 0cb96de269 Apply two changes, systematically:
(1) Use PyErr_NewException("module.class", NULL, NULL) to create the
    exception object.

(2) Remove all calls to Py_FatalError(); instead, return or
    ignore the errors -- the import code now checks PyErr_Occurred()
    after calling a module's init function, so it's no longer a
    fatal error for the initialization to fail.

Also did some small cleanups, e.g. removed unnecessary test for
"already initialized" from initfpectl(), and unified
initposix()/initnt().

I haven't checked this very thoroughly, so while the changes are
pretty trivial -- beware of untested code!
1997-10-01 04:29:29 +00:00
Jeremy Hylton cb91404890 Several changes:
1. Fix bug in (de)compression objects.  The final string resize used
zst.total_out to determine the length of the string, but the
(de)compression object will output data a little bit at a time, which
means total_out is not the string size.  Fix: save original value of
total_out at the start of the call.

2. Be sure to Py_DECREF the result value if you exit with an
exception.

3. Use PyInt_FromLong instead of Py_BuildValue

4. include more constants from the zlib header file

5. Use PyErr_Format instead of using a local buffer and sprintf.
1997-09-04 23:39:23 +00:00
Guido van Rossum c3beda2f27 Plug small leaks: the [de]compress object itself was never freed. 1997-09-03 18:14:30 +00:00
Guido van Rossum c1f088201f Added (binaryfunc) casts to function pointers in method lists. 1997-08-28 21:21:22 +00:00
Guido van Rossum ed2554a396 Casts by Jack to shut up the Mac compiler. 1997-08-18 15:31:24 +00:00
Jeremy Hylton 644c17d2af Several bug fixes.
-- initialize length to DEFAULTALLOC and not 0
 -- resize string before returning (to remove '\000' padding)

Also converted some compression routines to use PyString instead of
buffer.
1997-08-14 21:06:42 +00:00
Jeremy Hylton 41b9f00e8f Many changes.
Change default alloc size for uncompressing to 16K.

Remove comment about core dumps when an invalid window sizes is used.
This bug has been fixed in zlib 1.0.4.

Two new optional arguments to decompress, wbits and bufsize.  wbits
specifies the window size and bufsize specifies the initial output
string size.

In decompression code -- decompress and decompressobj methods -- use a
Python string (and _PyString_Resize) to collect the uncompressed
stream.  Replaces a separate buffer that was copied into a string.

Fix bug in decompress that caused it to always realloc the buffer when
it was finished decompressing.

Modernized handling of optional arguments to compressobj.

Updated doc strings.
1997-08-13 23:19:55 +00:00
Jeremy Hylton a74ef66ac8 Must update the available space in the output buffer after
realloc. (Fixed in PyZlib_unflush.)
1997-08-13 21:39:18 +00:00
Guido van Rossum 97b5457467 Small changes (casts etc.) by Jack, for Mac compilation. 1997-06-03 22:21:47 +00:00
Guido van Rossum 3c540307af Doc strings (AMK). 1997-06-03 22:21:03 +00:00
Guido van Rossum fb221562a3 Added Andrew Kuchling's zlib module. 1997-04-29 15:38:09 +00:00