From: Zooko O'Whielacronx Date: Tue, 30 Jan 2007 19:08:46 +0000 (-0700) Subject: pyfec: silence compiler warnings, add -Wall to debugmode compilation X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~292 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/specifications/banana.xhtml?a=commitdiff_plain;h=4a9cd3d977f6838087680936425588df5e1fa7ff;p=tahoe-lafs%2Ftahoe-lafs.git pyfec: silence compiler warnings, add -Wall to debugmode compilation --- diff --git a/pyfec/fec/_fecmodule.c b/pyfec/fec/_fecmodule.c index 7619803a..70c8b82c 100644 --- a/pyfec/fec/_fecmodule.c +++ b/pyfec/fec/_fecmodule.c @@ -182,7 +182,7 @@ Encoder_encode(Encoder *self, PyObject *args) { py_raise_fec_error("Precondition violation: %u'th item is required to offer the single-segment read character buffer protocol, but it does not.\n", i); goto err; } - if (PyObject_AsReadBuffer(fastinsharesitems[i], &(incshares[i]), &sz)) + if (PyObject_AsReadBuffer(fastinsharesitems[i], (const void**)&(incshares[i]), &sz)) goto err; if (oldsz != 0 && oldsz != sz) { py_raise_fec_error("Precondition violation: Input shares are required to be all the same length. oldsz: %Zu, sz: %Zu\n", oldsz, sz); @@ -199,7 +199,7 @@ Encoder_encode(Encoder *self, PyObject *args) { pystrs_produced[check_share_index] = PyString_FromStringAndSize(NULL, sz); if (pystrs_produced[check_share_index] == NULL) goto err; - check_shares_produced[check_share_index] = PyString_AsString(pystrs_produced[check_share_index]); + check_shares_produced[check_share_index] = (gf*)PyString_AsString(pystrs_produced[check_share_index]); if (check_shares_produced[check_share_index] == NULL) goto err; check_share_index++; @@ -433,7 +433,7 @@ Decoder_decode(Decoder *self, PyObject *args) { py_raise_fec_error("Precondition violation: %u'th item is required to offer the single-segment read character buffer protocol, but it does not.\n", i); goto err; } - if (PyObject_AsReadBuffer(fastsharesitems[i], &(cshares[i]), &sz)) + if (PyObject_AsReadBuffer(fastsharesitems[i], (const void**)&(cshares[i]), &sz)) goto err; if (oldsz != 0 && oldsz != sz) { py_raise_fec_error("Precondition violation: Input shares are required to be all the same length. oldsz: %Zu, sz: %Zu\n", oldsz, sz); @@ -451,7 +451,7 @@ Decoder_decode(Decoder *self, PyObject *args) { unsigned char c = cshareids[i]; SWAP (cshareids[i], cshareids[c], int); - SWAP (cshares[i], cshares[c], gf*); + SWAP (cshares[i], cshares[c], const gf*); SWAP (fastsharesitems[i], fastsharesitems[c], PyObject*); } } @@ -461,7 +461,7 @@ Decoder_decode(Decoder *self, PyObject *args) { recoveredpystrs[i] = PyString_FromStringAndSize(NULL, sz); if (recoveredpystrs[i] == NULL) goto err; - recoveredcstrs[i] = PyString_AsString(recoveredpystrs[i]); + recoveredcstrs[i] = (gf*)PyString_AsString(recoveredpystrs[i]); if (recoveredcstrs[i] == NULL) goto err; } diff --git a/pyfec/fec/fec.c b/pyfec/fec/fec.c index 485fb1df..2148bed5 100644 --- a/pyfec/fec/fec.c +++ b/pyfec/fec/fec.c @@ -146,7 +146,7 @@ static gf gf_mul_table[256][256]; * multiplication of two numbers can be resolved without calling modnn */ static void -init_mul_table () { +_init_mul_table(void) { int i, j; for (i = 0; i < 256; i++) for (j = 0; j < 256; j++) @@ -504,8 +504,8 @@ invert_vdm (gf * src, int k) { static int fec_initialized = 0; static void init_fec (void) { - generate_gf (); - init_mul_table (); + generate_gf(); + _init_mul_table(); fec_initialized = 1; } diff --git a/pyfec/setup.py b/pyfec/setup.py index fe9324cf..a1838433 100644 --- a/pyfec/setup.py +++ b/pyfec/setup.py @@ -38,6 +38,7 @@ undef_macros=[] if DEBUGMODE: extra_compile_args.append("-O0") extra_compile_args.append("-g") + extra_compile_args.append("-Wall") extra_link_args.append("-g") undef_macros.append('NDEBUG')