websockets compilation failure pasted by mario-goulart on Wed Oct 22 17:49:58 2014
changing current directory to . '/home/mario/local/chicken-string-copy-bang-fix-2014-06-27/bin/csi' -bnq -setup-mode -e "(require-library setup-api)" -e "(import setup-api)" -e "(setup-error-handling)" -e "(extension-name-and-version '(\"websockets\" \"\"))" -e "(destination-prefix \"/home/mario/src/websockets/salmonella-tmp-5e7a4/repo\")" -e "(runtime-prefix \"/home/mario/src/websockets/salmonella-tmp-5e7a4/repo\")" 'websockets.setup' '/home/mario/local/chicken-string-copy-bang-fix-2014-06-27/bin/csc' -feature compiling-extension -setup-mode -s -O3 -d1 -j websockets websockets.scm websockets.c: In function ‘stub519’: websockets.c:120:5: error: ‘for’ loop initial declarations are only allowed in C99 mode websockets.c:120:5: note: use option -std=c99 or -std=gnu99 to compile your code websockets.c: In function ‘stub401’: websockets.c:147:5: error: ‘for’ loop initial declarations are only allowed in C99 mode websockets.c:154:14: error: redefinition of ‘i’ websockets.c:147:14: note: previous definition of ‘i’ was here websockets.c:154:5: error: ‘for’ loop initial declarations are only allowed in C99 mode Error: shell command terminated with non-zero exit status 256: 'gcc' 'websockets.c' -o 'websockets.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -fPIC -DPIC -DC_SHARED -I"/home/mario/local/chicken-string-copy-bang-fix-2014-06-27/include/chicken" -I"/home/mario/src/websockets/salmonella-tmp-5e7a4/repo/include/chicken" Error: shell command failed with nonzero exit status 256: '/home/mario/local/chicken-string-copy-bang-fix-2014-06-27/bin/csc' -feature compiling-extension -setup-mode -s -O3 -d1 -j websockets websockets.scm
websockets fix added by mario-goulart on Wed Oct 22 17:59:36 2014
diff --git a/websockets.scm b/websockets.scm index 1960482..d0fe95e 100644 --- a/websockets.scm +++ b/websockets.scm @@ -191,6 +191,8 @@ (define-external wsv scheme-pointer payload) ((foreign-lambda* void () " + int i; + if (wslen > UINT_MAX) { return -1; } const unsigned char* maskkey2 = wsmaskkey; @@ -198,14 +200,14 @@ const unsigned char* __restrict kb = maskkey2; - for (int i = wslen >> 2; i != 0; --i) + for (i = wslen >> 2; i != 0; --i) { *((unsigned int*)wsv) ^= kd; wsv += 4; } const int rem = wslen & 3; - for (int i = 0; i < rem; ++i) + for (i = 0; i < rem; ++i) { *((unsigned int*)wsv++) ^= kb[i]; } @@ -245,19 +247,21 @@ ;; (begin ;; ((foreign-lambda* void () ;; " +;; int i; +;; ;; const unsigned char* maskkey2 = wsmaskkey; ;; const unsigned int kd = *(unsigned int*)maskkey2; ;; const unsigned char* __restrict kb = maskkey2; -;; for (int i = wslen >> 2; i != 0; --i) +;; for (i = wslen >> 2; i != 0; --i) ;; { ;; *((unsigned int*)wsv) ^= kd; ;; wsv += 4; ;; } ;; const int rem = wslen & 3; -;; for (int i = 0; i < rem; ++i) +;; for (i = 0; i < rem; ++i) ;; { ;; *((unsigned int*)wsv++) ^= kb[i]; ;; } @@ -341,9 +345,11 @@ (= 1 ((foreign-lambda* int () " + int i; + if (ws_utlen > UINT_MAX) { return -1; } - for (int i = ws_utlen; i != 0; --i) + for (i = ws_utlen; i != 0; --i) { if (*((unsigned char*)ws_uts++) > 127) {