]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: Ensure array index is an integer in C code
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 16 Nov 2013 12:42:10 +0000 (01:42 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 16 Nov 2013 12:42:10 +0000 (01:42 +1300)
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.

lib/encrypt.c

index 8809f695843ad494c81d5343b7f326a9ab978cfd..c66b1c549d8cee93acfbd0626d4156560c975f81 100644 (file)
@@ -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