Commit 6c4fecc4 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by rojer

TI compiler cannot analyze returns from branches

Thinks that mg_ws_random_mask does not return a value.
Help the poor, mentally challenged compiler.

PUBLISHED_FROM=e7c0c47dd2fcbb4e847515892939d69c7a573c2e
parent 0991ad7c
......@@ -4688,6 +4688,7 @@ struct ws_mask_ctx {
};
static uint32_t mg_ws_random_mask(void) {
uint32_t mask;
/*
* The spec requires WS client to generate hard to
* guess mask keys. From RFC6455, Section 5.3:
......@@ -4703,14 +4704,15 @@ static uint32_t mg_ws_random_mask(void) {
* that lacks random().
*/
#ifdef MG_DISABLE_WS_RANDOM_MASK
return 0xefbeadde; /* generated with a random number generator, I swear */
mask = 0xefbeadde; /* generated with a random number generator, I swear */
#else
if (sizeof(long) >= 4) {
return (uint32_t) random();
mask = (uint32_t) random();
} else if (sizeof(long) == 2) {
return (uint32_t) random() << 16 | (uint32_t) random();
mask = (uint32_t) random() << 16 | (uint32_t) random();
}
#endif
return mask;
}
static void mg_send_ws_header(struct mg_connection *nc, int op, size_t len,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment