diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-03-20 06:20:09 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-03-20 06:20:09 (GMT) |
commit | 2727503bc9c7df0093d8920713fdb5ae4db65a98 (patch) | |
tree | 1865acbc48313832f649873366f9279808fb6567 /Modules/zlibmodule.c | |
parent | 97797a9c3c69add56faefb8c4e5d029618f5bcb2 (diff) | |
download | cpython-2727503bc9c7df0093d8920713fdb5ae4db65a98.zip cpython-2727503bc9c7df0093d8920713fdb5ae4db65a98.tar.gz cpython-2727503bc9c7df0093d8920713fdb5ae4db65a98.tar.bz2 |
crc32 always returns unsigned. cleanup the code a bit and revert r61648 with
the proper fix.
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 551fd3e..3426ccf 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -915,14 +915,14 @@ PyDoc_STRVAR(adler32__doc__, static PyObject * PyZlib_adler32(PyObject *self, PyObject *args) { - uLong adler32val = adler32(0L, Z_NULL, 0); + unsigned int adler32val = adler32(0L, Z_NULL, 0); Byte *buf; int len; - if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val)) + if (!PyArg_ParseTuple(args, "s#|I:adler32", &buf, &len, &adler32val)) return NULL; adler32val = adler32(adler32val, buf, len); - return PyLong_FromUnsignedLong(adler32val & 0xffffffff); + return PyLong_FromUnsignedLong(adler32val & 0xffffffffU); } PyDoc_STRVAR(crc32__doc__, @@ -934,13 +934,13 @@ PyDoc_STRVAR(crc32__doc__, static PyObject * PyZlib_crc32(PyObject *self, PyObject *args) { - uLong crc32val = crc32(0L, Z_NULL, 0); + unsigned int crc32val = crc32(0L, Z_NULL, 0); Byte *buf; int len; - if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val)) + if (!PyArg_ParseTuple(args, "s#|I:crc32", &buf, &len, &crc32val)) return NULL; crc32val = crc32(crc32val, buf, len); - return PyLong_FromLong(crc32val & 0xffffffff); + return PyLong_FromUnsignedLong(crc32val & 0xffffffffU); } |