From 7675eaa22bdb18d1528e78b966dbcd059c434853 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 19 Nov 2013 17:11:13 -0700 Subject: [PATCH] Windows: Ensure array index is an integer in C code MSVC compiler does not accept 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. --- lib/encrypt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.47.2