summaryrefslogtreecommitdiffstats
path: root/Modules/binascii.c
Commit message (Collapse)AuthorAgeFilesLines
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-2/+3
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Remove redunandant assertions from last checkin.Raymond Hettinger2004-09-061-9/+0
|
* SF #1022953: binascii.a2b_hqx("") raises SystemErrorRaymond Hettinger2004-09-061-5/+16
| | | | | | | | | | | | | Several functions adopted the strategy of altering a full lengthed string copy and resizing afterwards. That would fail if the initial string was short enough (0 or 1) to be interned. Interning precluded the subsequent resizing operation. The solution was to make sure the initial string was at least two characters long. Added tests to verify that all binascii functions do not crater when given an empty string argument.
* Switch arguments to memset (kudos to MSVC C4318 for finding that)Martin v. Löwis2004-07-271-2/+2
|
* Valgrind was reporting an uninitialized read for bad input.Neal Norwitz2004-06-061-1/+2
| | | | | | | | | This fixes the problem and the test passes. I'm not sure the test is really correct though. It seems like it would be better to raise an exception. I think that wasn't done for backwards compatability. Bugfix candidate.
* In order to fix SF bug # 824977, we replace calloc()/free() calls inBarry Warsaw2004-05-111-9/+16
| | | | | | | binascii_a2b_qp() and binascii_b2a_qp() with calls to PyMem_Malloc() and PyMem_Free(). These won't return NULL unless the allocations actually fail, so it won't trigger a bogus memory error on some platforms <cough>AIX</cough> when passed a length of zero.
* binascii_a2b_base64: Properly return an empty string if the input was allThomas Wouters2003-03-171-1/+8
| | | | | | | invalid, rather than returning a string of random garbage of the estimated result length. Closes SF patch #703471 by Hye-Shik Chang. Will backport to 2.2-maint (consider it done.)
* base64.decodestring('') should return '' instead of raising anBarry Warsaw2002-08-151-5/+2
| | | | | exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2.
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-1/+1
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Another stab at SF 576327: zipfile when sizeof(long) == 8Tim Peters2002-07-021-100/+106
| | | | | | | | binascii_crc32(): The previous patch forced this to return the same result across platforms. This patch deals with that, on a 64-bit box, the *entry* value may have "unexpected" bits in the high four bytes. Bugfix candidate.
* Fix for SF bug #576327: zipfile when sizeof(long) == 8Tim Peters2002-07-021-1/+11
| | | | | | | | | | binascii_crc32(): Make this return a signed 4-byte result across platforms. The other way to make this platform-independent would be to make it return an unsigned unbounded int, but the evidence suggests other code out there treats it like a signed 4-byte int (e.g., existing code writing the result with struct.pack "l" format). Bugfix candidate.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-20/+20
|
* SF bug #494738: binascii_b2a_base64 overwrites memory.Tim Peters2001-12-191-3/+5
| | | | | | | | binascii_b2a_base64(): We didn't allocate enough buffer space for very short inputs (e.g., a 1-byte input can produce a 5-byte output, but we only allocated 2 bytes). I expect that malloc overheads absorbed the overrun in practice, but computing a correct upper bound is a very simple change.
* Change the limit on the input size for b2a_base64 to what will fit inGuido van Rossum2001-10-301-1/+3
| | | | | | memory, rather than the standard's 57. This fixes SF bug #473009.
* Add various typecasts (back and forth from char * to unsigned char *)Greg Ward2001-10-041-5/+5
| | | | to make the SGI C compiler happier (bug #445960).
* Patch #462190, patch #464070: Support quoted printable in the binascii module.Martin v. Löwis2001-09-301-0/+296
| | | | Decode and encode underscores for header style encoding. Fixes bug #463996.
* This closes bug #430849 (internal error produced by binascii.a2b_base64)Peter Schneider-Kamp2001-06-071-0/+4
|
* Address a bug in the uuencode decoder, reported bu "donut" in SF bugGuido van Rossum2001-01-091-3/+3
| | | | #127718: '@' and '`' seem to be confused.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-16/+0
| | | | This should match the situation in the 1.6b1 tree.
* Fix new compiler warnings. Unused var in compile.c. Argsize mismatchesTim Peters2000-08-151-1/+1
| | | | | | in binascii.c (only on platforms with signed chars -- although Py_CHARMASK is documented as returning an int, it only does so on platforms with signed chars).
* binascii_unhexlify(): Better error message, courtesy effbot.Barry Warsaw2000-08-151-5/+5
|
* After a brief conversation and code review with TP, adding two veryBarry Warsaw2000-08-151-22/+126
| | | | | | | | | | | | | | commonly used functions to convert an arbitrary binary string into a hexadecimal digit representation and back again. These are often (and often differently) implemented in Python. Best to have one common fast implementation. Specifically, binascii_hexlify(): a.k.a. b2a_hex() to return the hex representation of binary data. binascii_unhexlify(): a.k.a. a2b_hex() to do the inverse conversion (hex digits to binary data). The argument must have an even length, and must contain only hex digits, otherwise a TypeError is raised.
* Use METH_VARARGS instead of numeric constant 1 in method def. tablesAndrew M. Kuchling2000-08-031-13/+20
|
* 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-34/+11
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-10/+10
| | | | PyArg_ParseTuple() format string arguments as possible.
* Patch by Jim Ahlstrom to add crc32, a useful checksum functionGuido van Rossum2000-02-161-0/+141
| | | | | | | | | | | (e.g. used for ZIP files). The patch includes code that says: + Copyright (C) 1986 Gary S. Brown. You may use this program, or + code or tables extracted from it, as desired without restriction. My interpretation (and Jim's) is that Gary S Brown has no claims under copyright, patent or other rights or interests. Lawyers might disagree.
* Patch by Jason Trowbridge. (Followup to his PR#110.) (SlightlyGuido van Rossum1999-10-191-18/+69
| | | | | | | | | | | | reformatted.) - Illegal padding is now ignored. (Recommendation by GvR.) - Padding no longer removes characters from data string (resulting in lost data/strings with negative lengths). - Illegal characters outside the ASCII range are now ignored, instead of possibly being remapped to a valid character.
* Fix PR#110 -- bad input ("====") for a2b_base64() caused it to callGuido van Rossum1999-10-191-0/+2
| | | | _PyString_Resize() with a negative size.
* Add DL_EXPORT() to all modules that could possibly be usedGuido van Rossum1998-12-041-1/+1
| | | | on BeOS or Windows.
* Use the t# format where appropriate. Greg Stein.Guido van Rossum1998-10-081-3/+3
|
* Converted to new exception style (Jack)Guido van Rossum1997-10-081-6/+2
|
* Plug memory leak (DECREF doc string properly after inserting in dict).Guido van Rossum1997-08-041-0/+1
|
* Allow '@' character as end of line padding in uuencode format.Guido van Rossum1997-07-111-1/+3
| | | | | | | Not sure why this is generated, but this fixes a problem with a particular file that was received with the following final line: F-WE<-*A5]AY]%7>8'&!!(_Y<F*55_"*%46"<OFG=>_5(F/\'``!@
* Renamed.Roger E. Masse1997-01-161-79/+88
|
* Fix leak involving BuildValue("...O...").Guido van Rossum1997-01-121-3/+7
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Add unsigned char castGuido van Rossum1996-02-251-1/+1
|
* Fixed off-by-one error in rle-decode, and allow whitespace in base64Jack Jansen1996-01-221-5/+5
| | | | ascii input (thanks to Donald Beaudry for pointing these out)
* Allow '@' for ' ' in uuencoded files.Jack Jansen1995-11-141-2/+5
|
* Added base64 supportJack Jansen1995-10-041-0/+141
|
* Obscure bugfixJack Jansen1995-08-311-5/+2
|
* Added missing 'leftchar' initializer.Jack Jansen1995-08-141-2/+2
|
* Helper module for uuencode and binhex codersJack Jansen1995-08-071-0/+602