Skip to content

Commit bde9717

Browse files
committed
fix unused parameter warnings
fix switch warinings part of #319
1 parent 9ce044e commit bde9717

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/WebSockets.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,7 @@ class WebSockets {
299299

300300
};
301301

302+
#ifndef UNUSED
303+
#define UNUSED(var) (void)(var)
304+
#endif
302305
#endif /* WEBSOCKETS_H_ */

src/WebSocketsClient.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ void WebSocketsClient::setReconnectInterval(unsigned long time) {
318318
void WebSocketsClient::messageReceived(WSclient_t * client, WSopcode_t opcode, uint8_t * payload, size_t length, bool fin) {
319319
WStype_t type = WStype_ERROR;
320320

321+
UNUSED(client);
322+
321323
switch(opcode) {
322324
case WSop_text:
323325
type = fin ? WStype_TEXT : WStype_FRAGMENT_TEXT_START;
@@ -328,6 +330,11 @@ void WebSocketsClient::messageReceived(WSclient_t * client, WSopcode_t opcode, u
328330
case WSop_continuation:
329331
type = fin ? WStype_FRAGMENT_FIN : WStype_FRAGMENT;
330332
break;
333+
case WSop_close:
334+
case WSop_ping:
335+
case WSop_pong:
336+
default:
337+
break;
331338
}
332339

333340
runCbEvent(type, payload, length);

src/WebSocketsServer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ void WebSocketsServer::messageReceived(WSclient_t * client, WSopcode_t opcode, u
518518
case WSop_continuation:
519519
type = fin ? WStype_FRAGMENT_FIN : WStype_FRAGMENT;
520520
break;
521+
case WSop_close:
522+
case WSop_ping:
523+
case WSop_pong:
524+
default:
525+
break;
521526
}
522527

523528
runCbEvent(client->num, type, payload, length);

0 commit comments

Comments
 (0)