From: Amos Jeffries Date: Tue, 19 Nov 2013 22:47:21 +0000 (-0700) Subject: Windows: Ensure array index is an integer in C code X-Git-Tag: SQUID_3_4_0_3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d3b14ba48a38d508ddb486ca0dd57675055a1a9;p=thirdparty%2Fsquid.git Windows: Ensure array index is an integer in C code MSVC compiler does not accet non-integer types for array indexes so we must cast these CHAR index values to int before use. This is an iCelero Inc sponsored fix. --- diff --git a/lib/encrypt.c b/lib/encrypt.c index 8809f69584..c66b1c549d 100644 --- a/lib/encrypt.c +++ b/lib/encrypt.c @@ -148,7 +148,7 @@ register char *pc; int n; { for (; n--; pc++, a++) - *a = e[*pc]; + *a = e[(int)*pc]; } static void @@ -164,7 +164,7 @@ register char *schl; for (i = 0; i < 8; i++) { for (j = 0, sbval = 0; j < 6; j++) - sbval = (sbval << 1) | (nachr_r[*e++] ^ *schl++); + sbval = (sbval << 1) | (nachr_r[(int)*e++] ^ *schl++); sbval = S_BOX[i][sbval]; for (tp += 4, j = 4; j--; sbval >>= 1) *--tp = sbval & 1; @@ -173,7 +173,7 @@ register char *schl; e = PERM; for (i = 0; i < BS2; i++) - *nachr_l++ ^= tmp[*e++]; + *nachr_l++ ^= tmp[(int)*e++]; } void