diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-24 11:24:07 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-24 11:24:07 +0300 |
commit | 18c2ad66c72fbc8ed94fbaceb62274a1ee3e603c (patch) | |
tree | 9ebc4115cd7319a4ccde2764cfba549fc5a1f91b | |
parent | 66f273f4d5705eb5c841e2992330d3c221e2949b (diff) | |
download | libmicrohttpd-18c2ad66c72fbc8ed94fbaceb62274a1ee3e603c.tar.gz libmicrohttpd-18c2ad66c72fbc8ed94fbaceb62274a1ee3e603c.zip |
websocket_threaded_example: fixed compiler warning on x32 platforms
-rw-r--r-- | src/examples/websocket_threaded_example.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c index 1586933e..e2a2c9c1 100644 --- a/src/examples/websocket_threaded_example.c +++ b/src/examples/websocket_threaded_example.c | |||
@@ -575,14 +575,8 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t length) | |||
575 | frame[1] = length & 0x7F; | 575 | frame[1] = length & 0x7F; |
576 | idx_first_rdata = 2; | 576 | idx_first_rdata = 2; |
577 | } | 577 | } |
578 | else if ((length >= 126) && (length <= 0xFFFF)) | 578 | #if SIZEOF_SIZE_T > 4 |
579 | { | 579 | else if (0xFFFF < length) |
580 | frame[1] = 126; | ||
581 | frame[2] = (length >> 8) & 0xFF; | ||
582 | frame[3] = length & 0xFF; | ||
583 | idx_first_rdata = 4; | ||
584 | } | ||
585 | else | ||
586 | { | 580 | { |
587 | frame[1] = 127; | 581 | frame[1] = 127; |
588 | frame[2] = (unsigned char) ((length >> 56) & 0xFF); | 582 | frame[2] = (unsigned char) ((length >> 56) & 0xFF); |
@@ -595,6 +589,14 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t length) | |||
595 | frame[9] = (unsigned char) (length & 0xFF); | 589 | frame[9] = (unsigned char) (length & 0xFF); |
596 | idx_first_rdata = 10; | 590 | idx_first_rdata = 10; |
597 | } | 591 | } |
592 | #endif /* SIZEOF_SIZE_T > 4 */ | ||
593 | else | ||
594 | { | ||
595 | frame[1] = 126; | ||
596 | frame[2] = (length >> 8) & 0xFF; | ||
597 | frame[3] = length & 0xFF; | ||
598 | idx_first_rdata = 4; | ||
599 | } | ||
598 | idx_response = 0; | 600 | idx_response = 0; |
599 | response = malloc (idx_first_rdata + length + 1); | 601 | response = malloc (idx_first_rdata + length + 1); |
600 | if (NULL == response) | 602 | if (NULL == response) |