summaryrefslogtreecommitdiff
path: root/ws.c
diff options
context:
space:
mode:
authorLeon George <leon@georgemail.eu>2022-10-23 13:47:23 +0200
committerGitHub <noreply@github.com>2022-10-23 14:47:23 +0300
commit3ec3b469b8d091837a1d1309ac0cdffa6a76e1d4 (patch)
treedb710513cc72fa2796df08e502748e8821d9350c /ws.c
parentf04a70f0fc5e3561538b0eff302defef9046c617 (diff)
downloadlibevent-3ec3b469b8d091837a1d1309ac0cdffa6a76e1d4.tar.gz
ws: fix compile error on centos 7 - very old compiler (#1359)
* http: fix typo * ws: fix comile error On CentOS: CC ws.lo ws.c: In function 'get_ws_frame': ws.c:244:3: error: 'for' loop initial declarations are only allowed in C99 mode for (int i = 0; i < payload_len; i++) { ^ ws.c:244:3: note: use option -std=c99 or -std=gnu99 to compile your code
Diffstat (limited to 'ws.c')
-rw-r--r--ws.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ws.c b/ws.c
index de5cf6de..5acaf783 100644
--- a/ws.c
+++ b/ws.c
@@ -236,13 +236,14 @@ get_ws_frame(unsigned char *in_buffer, int buf_len, unsigned char **payload_ptr,
*/
if (masked) {
unsigned char *c;
+ int i;
mask = *((unsigned int *)(in_buffer + pos));
pos += 4;
/* unmask data */
c = in_buffer + pos;
- for (int i = 0; i < payload_len; i++) {
+ for (i = 0; i < payload_len; i++) {
c[i] = c[i] ^ ((unsigned char *)(&mask))[i % 4];
}
}