From 90b97f7d34c6f7b40fde9503761120f19edfabb2 Mon Sep 17 00:00:00 2001 From: Thomas Hintz Date: Sat, 18 Apr 2015 11:21:18 -0700 Subject: [PATCH] Fixing unmask to pass values into foreign-lambda* instead of using global variables. --- websockets.scm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/websockets.scm b/websockets.scm index 7b2087d..2576dd3 100644 --- a/websockets.scm +++ b/websockets.scm @@ -183,14 +183,8 @@ (u8vector-set! tmaskkey 1 (vector-ref frame-masking-key 1)) (u8vector-set! tmaskkey 2 (vector-ref frame-masking-key 2)) (u8vector-set! tmaskkey 3 (vector-ref frame-masking-key 3)) - (define-external wsmaskkey blob (u8vector->blob/shared tmaskkey)) - (define-external wslen int len) - - ; TODO handle -1 - - (define-external wsv scheme-pointer payload) - ((foreign-lambda* void () + ((foreign-lambda* void ((blob wsmaskkey) (int wslen) (scheme-pointer wsv)) " const unsigned char* maskkey2 = wsmaskkey; const unsigned int kd = *(unsigned int*)maskkey2; @@ -210,7 +204,7 @@ *((unsigned int*)wsv++) ^= kb[i]; } " -)) +) (u8vector->blob/shared tmaskkey) len payload) payload) (define (unmask fragment)