From: Zooko O'Whielacronx zooko@zooko.com Date: Tue, 30 Jan 2007 18:08:46 +0000 (+0530) Subject: pyfec: silence compiler warnings, add -Wall to debugmode compilation X-Git-Url: https://git.rkrishnan.org/vdrive/%22file:/%22news.html/%3C?a=commitdiff_plain;h=1b305251cf3d1eb16dbf74b54b5ffaf4337d6520;p=tahoe-lafs%2Fzfec.git pyfec: silence compiler warnings, add -Wall to debugmode compilation darcs-hash:8d2007c42d05e9412339c3d44389f4596378781b --- diff --git a/pyfec/fec/_fecmodule.c b/pyfec/fec/_fecmodule.c index 6ea18d8..73c69d2 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 485fb1d..2148bed 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 fe9324c..a183843 100755 --- 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')