mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-10 19:33:06 +08:00
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
This commit is contained in:
parent
0991ad7cc8
commit
6c4fecc4f7
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user