8000 fix code style · thebigG/arduinoWebSockets@ab9af16 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab9af16

Browse files
committed
fix code style
1 parent 8d76469 commit ab9af16

File tree

5 files changed

+48
-48
lines changed

5 files changed

+48
-48
lines changed

src/WebSockets.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ extern "C" {
4242
#include <esp_system.h>
4343

4444
#if ESP_IDF_VERSION_MAJOR >= 4
45-
#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(1, 0, 6) )
46-
#include "sha/sha_parallel_engine.h"
47-
#else
48-
#include <esp32/sha.h>
49-
#endif
45+
#if(ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(1, 0, 6))
46+
#include "sha/sha_parallel_engine.h"
5047
#else
51-
#include <hwcrypto/sha.h>
48+
#include <esp32/sha.h>
49+
#endif
50+
#else
51+
#include <hwcrypto/sha.h>
5252
#endif
5353

5454
#else
@@ -472,7 +472,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
472472
payload[header->payloadLen] = 0x00;
473473

474474
if(header->mask) {
475-
//decode XOR
475+
// decode XOR
476476
for(size_t i = 0; i < header->payloadLen; i++) {
477477
payload[i] = (payload[i] ^ header->maskKey[i % 4]);
478478
}
@@ -526,7 +526,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
526526
// reset input
527527
client->cWsRXsize = 0;
528528
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
529-
//register callback for next message
529+
// register callback for next message
530530
handleWebsocketWaitFor(client, 2);
531531
#endif
532532

@@ -644,9 +644,9 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
644644
t = millis();
645645
out += len;
646646
n -= len;
647-
//DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
647+
// DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
648648
} else {
649-
//DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
649+
// DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
650650
}
651651
if(n > 0) {
652652
WEBSOCKETS_YIELD();
@@ -698,7 +698,7 @@ size_t WebSockets::write(WSclient_t * client, uint8_t * out, size_t n) {
698698
out += len;
699699
n -= len;
700700
total += len;
701-
//DEBUG_WEBSOCKETS("write %d left %d!\n", len, n);
701+
// DEBUG_WEBSOCKETS("write %d left %d!\n", len, n);
702702
} else {
703703
DEBUG_WEBSOCKETS("WS write %d failed left %d!\n", len, n);
704704
}

src/WebSockets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#define WEBSOCKETS_YIELD_MORE()
8787
#else
8888

89-
//atmega328p has only 2KB ram!
89+
// atmega328p has only 2KB ram!
9090
#define WEBSOCKETS_MAX_DATA_SIZE (1024)
9191
// moves all Header strings to Flash
9292
#define WEBSOCKETS_SAVE_RAM

src/WebSocketsClient.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ class WebSocketsClient : protected WebSockets {
154154
#endif
155155

156156
/**
157-
* called for sending a Event to the app
158-
* @param type WStype_t
159-
* @param payload uint8_t *
160-
* @param length size_t
161-
*/
157+
* called for sending a Event to the app
158+
* @param type WStype_t
159+
* @param payload uint8_t *
160+
* @param length size_t
161+
*/
162162
virtual void runCbEvent(WStype_t type, uint8_t * payload, size_t length) {
163163
if(_cbEvent) {
164164
_cbEvent(type, payload, length);

src/WebSocketsServer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ WSclient_t * WebSocketsServerCore::handleNewClient(WEBSOCKETS_NETWORK_CLASS * tc
621621
#endif
622622
// no client! => create dummy!
623623
WSclient_t dummy = WSclient_t();
624-
client = & dummy;
625-
client->tcp = tcpClient;
624+
client = &dummy;
625+
client->tcp = tcpClient;
626626
dropNativeClient(client);
627627
}
628628

@@ -663,7 +663,7 @@ void WebSocketsServerCore::handleClientData(void) {
663663
if(clientIsConnected(client)) {
664664
int len = client->tcp->available();
665665
if(len > 0) {
666-
//DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] len: %d\n", client->num, len);
666+
// DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] len: %d\n", client->num, len);
667667
switch(client->status) {
668668
case WSC_HEADER: {
669669
String headerLine = client->tcp->readStringUntil('\n');
@@ -717,7 +717,7 @@ void WebSocketsServerCore::handleHeader(WSclient_t * client, String * headerLine
717717
// cut URL out
718718
client->cUrl = headerLine->substring(4, headerLine->indexOf(' ', 4));
719719

720-
//reset non-websocket http header validation state for this client
720+
// reset non-websocket http header validation state for this client
721721
client->cHttpHeadersValid = true;
722722
client->cMandatoryHeadersCount = 0;
723723

src/WebSocketsServer.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ class WebSocketsServerCore : protected WebSockets {
132132
void handleHBPing(WSclient_t * client); // send ping in specified intervals
133133

134134
/**
135-
* called if a non Websocket connection is coming in.
136-
* Note: can be override< F438 /div>
137-
* @param client WSclient_t * ptr to the client struct
138-
*/
135+
* called if a non Websocket connection is coming in.
136+
* Note: can be override
137+
* @param client WSclient_t * ptr to the client struct
138+
*/
139139
virtual void handleNonWebsocketConnection(WSclient_t * client) {
140140
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] no Websocket connection close.\n", client->num);
141141
client->tcp->write(
@@ -151,10 +151,10 @@ class WebSocketsServerCore : protected WebSockets {
151151
}
152152

153153
/**
154-
* called if a non Authorization connection is coming in.
155-
* Note: can be override
156-
* @param client WSclient_t * ptr to the client struct
157-
*/
154+
* called if a non Authorization connection is coming in.
155+
* Note: can be override
156+
* @param client WSclient_t * ptr to the client struct
157+
*/
158158
virtual void handleAuthorizationFailed(WSclient_t * client) {
159159
client->tcp->write(
160160
"HTTP/1.1 401 Unauthorized\r\n"
@@ -170,32 +170,32 @@ class WebSocketsServerCore : protected WebSockets {
170170
}
171171

172172
/**
173-
* called for sending a Event to the app
174-
* @param num uint8_t
175-
* @param type WStype_t
176-
* @param payload uint8_t *
177-
* @param length size_t
178-
*/
173+
* called for sending a Event to the app
174+
* @param num uint8_t
175+
* @param type WStype_t
176+
* @param payload uint8_t *
177+
* @param length size_t
178+
*/
179179
virtual void runCbEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
180180
if(_cbEvent) {
181181
_cbEvent(num, type, payload, length);
182182
}
183183
}
184184

185185
/*
186-
* Called at client socket connect handshake negotiation time for each http header that is not
187-
* a websocket specific http header (not Connection, Upgrade, Sec-WebSocket-*)
188-
* If the custom httpHeaderValidationFunc returns false for any headerName / headerValue passed, the
189-
* socket negotiation is considered invalid and the upgrade to websockets request is denied / rejected
190-
* This mechanism can be used to enable custom authentication schemes e.g. test the value
191-
* of a session cookie to determine if a user is logged on / authenticated
192-
*/
186+
* Called at client socket connect handshake negotiation time for each http header that is not
187+
* a websocket specific http header (not Connection, Upgrade, Sec-WebSocket-*)
188+
* If the custom httpHeaderValidationFunc returns false for any headerName / headerValue passed, the
189+
* socket negotiation is considered invalid and the upgrade to websockets request is denied / rejected
190+
* This mechanism can be used to enable custom authentication schemes e.g. test the value
191+
* of a session cookie to determine if a user is logged on / authenticated
192+
*/
193193
virtual bool execHttpHeaderValidation(String headerName, String headerValue) {
194194
if(_httpHeaderValidationFunc) {
195-
//return the value of the custom http header validation function
195+
// return the value of the custom http header validation function
196196
return _httpHeaderValidationFunc(headerName, headerValue);
197197
}
198-
//no custom http header validation so just assume all is good
198+
// no custom http header validation so just assume all is good
199199
return true;
200200
}
201201

@@ -205,14 +205,14 @@ class WebSocketsServerCore : protected WebSockets {
205205

206206
/**
207207
* drop native tcp connection (client->tcp)
208-
*/
208+
*/
209209
void dropNativeClient(WSclient_t * client);
210210

211211
private:
212212
/*
213-
* returns an indicator whether the given named header exists in the configured _mandatoryHttpHeaders collection
214-
* @param headerName String ///< the name of the header being checked
215-
*/
213+
* returns an indicator whether the given named header exists in the configured _mandatoryHttpHeaders collection
214+
* @param headerName String ///< the name of the header being checked
215+
*/
216216
bool hasMandatoryHeader(String headerName);
217217
};
218218

0 commit comments

Comments
 (0)
0