mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Apply suggestions from code review
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
This commit is contained in:
parent
b828c4ab41
commit
15b9b6f019
4
ws.c
4
ws.c
@ -237,7 +237,7 @@ get_ws_frame(unsigned char *in_buffer, size_t buf_len,
|
|||||||
uint64_t tmp64 = 0;
|
uint64_t tmp64 = 0;
|
||||||
if (buf_len < 10)
|
if (buf_len < 10)
|
||||||
return INCOMPLETE_DATA;
|
return INCOMPLETE_DATA;
|
||||||
/* swab bytes from big endian to host byte order */
|
/* swap bytes from big endian to host byte order */
|
||||||
for (i = 56; i >= 0; i -= 8) {
|
for (i = 56; i >= 0; i -= 8) {
|
||||||
tmp64 |= (uint64_t)in_buffer[pos++] << i;
|
tmp64 |= (uint64_t)in_buffer[pos++] << i;
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ make_ws_frame(struct evbuffer *output, enum WebSocketFrameType frame_type,
|
|||||||
int i;
|
int i;
|
||||||
const uint64_t tmp64 = len;
|
const uint64_t tmp64 = len;
|
||||||
header[pos++] = 127; /* 64 bit length */
|
header[pos++] = 127; /* 64 bit length */
|
||||||
/* swab bytes from host byte order to big endian */
|
/* swap bytes from host byte order to big endian */
|
||||||
for (i = 56; i >= 0; i -= 8) {
|
for (i = 56; i >= 0; i -= 8) {
|
||||||
header[pos++] = tmp64 >> i & 0xFFu;
|
header[pos++] = tmp64 >> i & 0xFFu;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user