Fixing unmask to pass values into foreign-lambda* instead of using

global variables.
master
Thomas Hintz 10 years ago
parent fde9c289cc
commit 90b97f7d34

@ -183,14 +183,8 @@
(u8vector-set! tmaskkey 1 (vector-ref frame-masking-key 1)) (u8vector-set! tmaskkey 1 (vector-ref frame-masking-key 1))
(u8vector-set! tmaskkey 2 (vector-ref frame-masking-key 2)) (u8vector-set! tmaskkey 2 (vector-ref frame-masking-key 2))
(u8vector-set! tmaskkey 3 (vector-ref frame-masking-key 3)) (u8vector-set! tmaskkey 3 (vector-ref frame-masking-key 3))
(define-external wsmaskkey blob (u8vector->blob/shared tmaskkey))
(define-external wslen int len) ((foreign-lambda* void ((blob wsmaskkey) (int wslen) (scheme-pointer wsv))
; TODO handle -1
(define-external wsv scheme-pointer payload)
((foreign-lambda* void ()
" "
const unsigned char* maskkey2 = wsmaskkey; const unsigned char* maskkey2 = wsmaskkey;
const unsigned int kd = *(unsigned int*)maskkey2; const unsigned int kd = *(unsigned int*)maskkey2;
@ -210,7 +204,7 @@
*((unsigned int*)wsv++) ^= kb[i]; *((unsigned int*)wsv++) ^= kb[i];
} }
" "
)) ) (u8vector->blob/shared tmaskkey) len payload)
payload) payload)
(define (unmask fragment) (define (unmask fragment)

Loading…
Cancel
Save