summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-01 15:04:23 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-01 19:24:31 +0200
commita5eac83c777c95e59801d5e327daf03860fcb141 (patch)
tree55a22a8cc612b436538813a31f49e0b7fc35f696
parent6a325d7f101c986e7329ef912c0458719f95c096 (diff)
fix a warning on 32 bits
Change-Id: I03c50694470059f11e47b51a29e3df6929125752 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/websock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/websock.c b/src/websock.c
index f79feb5e..1b127c8b 100644
--- a/src/websock.c
+++ b/src/websock.c
@@ -45,7 +45,7 @@
#define FRAME_SET_RSV3(BYTE) (((BYTE) & 0x01) << 4)
#define FRAME_SET_OPCODE(BYTE) ((BYTE) & 0x0F)
#define FRAME_SET_MASK(BYTE) (((BYTE) & 0x01) << 7)
-#define FRAME_SET_LENGTH(X64, IDX) (unsigned char)(((X64) >> ((IDX)*8)) & 0xFF)
+#define FRAME_SET_LENGTH(X64, IDX) (unsigned char)((sizeof(X64)) <= (IDX) ? 0 : (((X64) >> ((IDX)*8)) & 0xFF))
#define OPCODE_CONTINUATION 0x0
#define OPCODE_TEXT 0x1