summaryrefslogtreecommitdiffstats
path: root/Modules/zlibmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Added missing cast.Jack Jansen2001-10-231-1/+1
|
* Remove unused convenience routine.Jeremy Hylton2001-10-171-19/+0
|
* Simplify and regularize docstrings. Also reformat so that each docstringTim Peters2001-10-171-52/+47
| | | | line fits in reasonable screen width.
* Trimmed trailing whitespace.Tim Peters2001-10-171-62/+62
|
* Removed more comments that didn't make much sense.Tim Peters2001-10-171-17/+1
| | | | Made the presence/absence of a semicolon after macros consistent.
* Removed obsolete comments about confused string refcount tricks (JeremyTim Peters2001-10-171-9/+4
| | | | | | | removed the tricks). Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a new block is neither necessary nor helpful).
* Undo needless INCREF chicanery introduced by SF patch #450702.Jeremy Hylton2001-10-161-47/+15
| | | | | | | | | | | | | | Apparently this patch (rev 2.41) replaced all the good old "s#" formats in PyArg_ParseTuple() with "S". Then it did PyString_FromStringAndSize() to get back the values setup by the "s#" format. It also incref'd and decref'd the string obtained by "S" even though the argument tuple had a reference to it. Replace PyString_AsString() calls with PyString_AS_STRING(). A good rule of thumb -- if you never check the return value of PyString_AsString() to see if it's NULL, you ought to be using the macro <wink>.
* Simplify and fix error handling for most cases.Jeremy Hylton2001-10-161-167/+113
| | | | | | | | | | | | | | | | | | Many functions used a local variable called return_error, which was initialized to zero. If an error occurred, it was set to true. Most of the code paths checked were only executed if return_error was false. goto is clearer. The code also seemed to be written under the curious assumption that calling Py_DECREF() on a local variable would assign the variable to NULL. As a result, more of the error-exit code paths returned an object that had a reference count of zero instead of just returning NULL. Fixed the code to explicitly assign NULL after the DECREF. A bit more reformatting, but not much. XXX Need a much better test suite for zlib, since it the current tests don't exercise any of this broken code.
* More reformatting.Jeremy Hylton2001-10-161-51/+50
|
* Add zlib_error() helper.Jeremy Hylton2001-10-161-92/+25
| | | | | It sets a ZlibError exception, using the msg from the z_stream pointer if one is available.
* Remove many calls to set MemoryError exceptions.Jeremy Hylton2001-10-161-28/+4
| | | | | When PyString_FromStringAndSize() and _PyString_Resize() fail, they set an exception. There's no need to set a new exception.
* Reformat!Jeremy Hylton2001-10-161-586/+576
| | | | | | Consistently indent 4 spaces. Use whitespace around operators. Put braces in the right places.
* [ #403753 ] zlib decompress; uncontrollable memory usageJeremy Hylton2001-10-161-10/+64
| | | | | | | | | | | | | Mostly by Toby Dickenson and Titus Brown. Add an optional argument to a decompression object's decompress() method. The argument specifies the maximum length of the return value. If the uncompressed data exceeds this length, the excess data is stored as the unconsumed_tail attribute. (Not to be confused with unused_data, which is a separate issue.) Difference from SF patch: Default value for unconsumed_tail is "" rather than None. It's simpler if the attribute is always a string.
* Update URL. Fixes bug #468118.Martin v. Löwis2001-10-091-1/+1
|
* Silence warnings about passing unsigned char** as char**.Martin v. Löwis2001-09-081-4/+4
|
* Patch #450702: allow threads when calling into zlib, protect usage ofMartin v. Löwis2001-09-071-114/+350
| | | | the module in multiple threads with a global lock.
* Patch #103926: fix two warnings from Tru64's compilerAndrew M. Kuchling2001-02-221-1/+1
|
* Patch #103373 from Donovan Baarda: This patch:Andrew M. Kuchling2001-02-211-194/+131
| | | | | | | | | | | | * 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
* Docs for new Windows zlib build procedure.Tim Peters2001-01-311-8/+1
|
* Fix [ Bug #129293 ] zlib library used for binary win32 distribution can crashMark Hammond2001-01-311-2/+11
| | | | 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.
* Patch #101810: check whether zst.avail_out is non-zero when gettingAndrew M. Kuchling2000-10-091-1/+15
| | | | | | 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.
* Use METH_VARARGS instead of numeric constant 1Andrew M. Kuchling2000-08-031-12/+22
|
* Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters2000-07-211-1/+1
| | | | | | | | | | | | | | | | | | 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 ;)
* ANSI-ficationPeter Schneider-Kamp2000-07-101-44/+16
|
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-3/+3
| | | | | | | | | | 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.)
* Windows: Since we're not using ZLIB.DLL any more, don't define ZLIB_DLL.Guido van Rossum2000-04-061-3/+0
| | | | (Mark Hammond.)
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-9/+9
| | | | PyArg_ParseTuple() format string arguments as possible.
* For ZlibError and ZLIB_VERSION, only attempt to add entry to theFred Drake1999-12-221-3/+6
| | | | | module dict if the inserted object isn't NULL (basic defensive programming!).
* Fix typo in docstring: wbites -> wbitsAndrew M. Kuchling1999-12-201-1/+1
|
* Cast added by Jack Jansen (for Mac port).Guido van Rossum1999-04-121-1/+2
|
* Patch by Andrew Kuchling to unflush() (flush() for deflating).Guido van Rossum1999-04-071-4/+8
| | | | | | 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.
* Add an .unused_data attribute to decompressor objects. If .unused_dataAndrew M. Kuchling1999-03-251-0/+22
| | | | | | 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.
* Fixed the flush() method of compression objects; the test forAndrew M. Kuchling1999-03-221-12/+29
| | | | | the end of loop was incorrect, and failed when the flushmode != Z_FINISH. Logic cleaned up and commented.
* Added missing DECREF's in the error branches when creating a compressor orAndrew M. Kuchling1999-01-291-1/+12
| | | | | | 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.
* PyInit_zlib(): Plug a small memory leak. Jeremy is looking into theBarry Warsaw1999-01-281-0/+1
| | | | more severe ones.
* fix bug in PyZlib_flush.Jeremy Hylton1999-01-061-4/+4
| | | | patch from Grzegorz Makarewicz & Rafal Smotrzyk.
* replace missing zalloc initialization (test_zlib now runsJeremy Hylton1998-12-211-0/+1
| | | | successfully)
* remove debugging fprintf (should have checked this before previousJeremy Hylton1998-12-211-2/+0
| | | | checkin)
* patches from AndrewJeremy Hylton1998-12-181-23/+51
| | | | | | | | 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.
* When _PyString_Resize() reports failure, the variable referring to theFred Drake1998-12-181-5/+0
| | | | | string we wanted to resize is set to NULL. Don't Py_DECREF() those variables! (5 places)
* Add DL_EXPORT() to all modules that could possibly be usedGuido van Rossum1998-12-041-1/+1
| | | | on BeOS or Windows.
* Fix benign problems found by a picky SGI compiler (unreachable breakGuido van Rossum1998-07-071-11/+0
| | | | after a return).
* Added URLs for zlib's home page and the Windows DLL's home page .Guido van Rossum1998-05-081-0/+2
|
* Tiny patch for zlib 1.1.2Guido van Rossum1998-04-231-0/+1
|
* Win32 treatment.Guido van Rossum1997-12-181-2/+7
|
* Apply two changes, systematically:Guido van Rossum1997-10-011-4/+1
| | | | | | | | | | | | | | | | | (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!
* Several changes:Jeremy Hylton1997-09-041-125/+188
| | | | | | | | | | | | | | | | | 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.
* Plug small leaks: the [de]compress object itself was never freed.Guido van Rossum1997-09-031-0/+2
|
* Added (binaryfunc) casts to function pointers in method lists.Guido van Rossum1997-08-281-4/+4
|
* Casts by Jack to shut up the Mac compiler.Guido van Rossum1997-08-181-9/+9
|