FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

avoid forced/implicit conversion by george2209 · Pull Request #60 · fhessel/esp32_https_server · GitHub

Repository navigation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 9 additions & 1 deletion src/WebsocketHandler.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,15 @@ void WebsocketHandler::send(uint8_t* data, uint16_t length, uint8_t sendType) {
frame.len = 126;
_con->writeBuffer((uint8_t *)&frame, sizeof(frame));
uint16_t net_len = htons(length);
_con->writeBuffer((uint8_t *) net_len, sizeof(uint16_t)); // Convert to network byte order from host byte order
//replaced by George2209 on 2019-11-11 (avoid forced/implicit conversion):
//_con->writeBuffer((uint8_t *) net_len, sizeof(uint16_t)); // Convert to network byte order from host byte order
//start of replacement of the upper line:
{
uint8_t tmp_buffer[sizeof(uint16_t)];
memcpy(tmp_buffer,&net_len,sizeof(uint16_t));
_con->writeBuffer(tmp_buffer, sizeof(uint16_t)); // Convert to network byte order from host byte order
}
//end of replacement of George2209
}
_con->writeBuffer(data, length);
HTTPS_LOGD("<< Websocket.send()");
Expand Down

Back | FazBrowse Home | New Git URL