From: Jonathan L. <jon...@us...> - 2010-05-21 00:30:29
|
Update of /cvsroot/srtp/srtp/crypto/math In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8818/crypto/math Modified Files: datatypes.c Log Message: Fix warnings exposed by gcc -Wcast-qual and -Wshadow. (Patch from Randell Jesup 07/10/2009, cleaned up for current tip-of-tree.) Index: datatypes.c =================================================================== RCS file: /cvsroot/srtp/srtp/crypto/math/datatypes.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** datatypes.c 17 May 2010 20:47:42 -0000 1.10 --- datatypes.c 21 May 2010 00:30:21 -0000 1.11 *************** *** 208,221 **** char * v128_bit_string(v128_t *x) { ! int j, index; uint32_t mask; ! for (j=index=0; j < 4; j++) { for (mask=0x80000000; mask > 0; mask >>= 1) { if (x->v32[j] & mask) ! bit_string[index] = '1'; else ! bit_string[index] = '0'; ! ++index; } } --- 208,221 ---- char * v128_bit_string(v128_t *x) { ! int j, i; uint32_t mask; ! for (j=i=0; j < 4; j++) { for (mask=0x80000000; mask > 0; mask >>= 1) { if (x->v32[j] & mask) ! bit_string[i] = '1'; else ! bit_string[i] = '0'; ! ++i; } } *************** *** 324,334 **** void ! v128_right_shift(v128_t *x, int index) { ! const int base_index = index >> 5; ! const int bit_index = index & 31; int i, from; uint32_t b; ! if (index > 127) { v128_set_to_zero(x); return; --- 324,334 ---- void ! v128_right_shift(v128_t *x, int shift) { ! const int base_index = shift >> 5; ! const int bit_index = shift & 31; int i, from; uint32_t b; ! if (shift > 127) { v128_set_to_zero(x); return; *************** *** 362,371 **** void ! v128_left_shift(v128_t *x, int index) { int i; ! const int base_index = index >> 5; ! const int bit_index = index & 31; ! if (index > 127) { v128_set_to_zero(x); return; --- 362,371 ---- void ! v128_left_shift(v128_t *x, int shift) { int i; ! const int base_index = shift >> 5; ! const int bit_index = shift & 31; ! if (shift > 127) { v128_set_to_zero(x); return; *************** *** 459,477 **** char * bitvector_bit_string(bitvector_t *x, char* buf, int len) { ! int j, index; uint32_t mask; ! for (j=index=0; j < (int)(x->length>>5) && index < len-1; j++) { for (mask=0x80000000; mask > 0; mask >>= 1) { if (x->word[j] & mask) ! buf[index] = '1'; else ! buf[index] = '0'; ! ++index; ! if (index >= len-1) break; } } ! buf[index] = 0; /* null terminate string */ return buf; --- 459,477 ---- char * bitvector_bit_string(bitvector_t *x, char* buf, int len) { ! int j, i; uint32_t mask; ! for (j=i=0; j < (int)(x->length>>5) && i < len-1; j++) { for (mask=0x80000000; mask > 0; mask >>= 1) { if (x->word[j] & mask) ! buf[i] = '1'; else ! buf[i] = '0'; ! ++i; ! if (i >= len-1) break; } } ! buf[i] = 0; /* null terminate string */ return buf; *************** *** 479,489 **** void ! bitvector_left_shift(bitvector_t *x, int index) { int i; ! const int base_index = index >> 5; ! const int bit_index = index & 31; const int word_length = x->length >> 5; ! if (index >= (int)x->length) { bitvector_set_to_zero(x); return; --- 479,489 ---- void ! bitvector_left_shift(bitvector_t *x, int shift) { int i; ! const int base_index = shift >> 5; ! const int bit_index = shift & 31; const int word_length = x->length >> 5; ! if (shift >= (int)x->length) { bitvector_set_to_zero(x); return; |