Commit b2866236 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #449 from ursine/patch-1

64-bit length fields on ARM don't work
parents 66450bf3 8cad0a72
...@@ -2962,9 +2962,10 @@ size_t mg_websocket_write(struct mg_connection *conn, int opcode, ...@@ -2962,9 +2962,10 @@ size_t mg_websocket_write(struct mg_connection *conn, int opcode,
} else { } else {
// 64-bit length field // 64-bit length field
copy[1] = 127; copy[1] = 127;
* (uint32_t *) (copy + 2) = (uint32_t) const uint32_t hi = htonl((uint32_t) ((uint64_t) data_len >> 32));
htonl((uint32_t) ((uint64_t) data_len >> 32)); const uint32_t lo = htonl(data_len & 0xffffffff);
* (uint32_t *) (copy + 6) = (uint32_t) htonl(data_len & 0xffffffff); memcpy(copy+2,&hi,sizeof(hi));
memcpy(copy+6,&lo,sizeof(lo));
memcpy(copy + 10, data, data_len); memcpy(copy + 10, data, data_len);
copy_len = 10 + data_len; copy_len = 10 + data_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