summaryrefslogtreecommitdiff
path: root/modules/websocket/wsl_peer.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-08 11:53:02 +0100
committerGitHub <noreply@github.com>2021-02-08 11:53:02 +0100
commit332a33503bf6ddd25f4012a0b8caaaeb67e9b18e (patch)
tree0eb10c2fcb4e7f94a2ca16365e9d36076b94bc03 /modules/websocket/wsl_peer.h
parent5260b6e046c244ed6376c47c7af5a0f27d934c12 (diff)
parentf7209b459b4faaae9d93bfb6ac5346eb41787f92 (diff)
Merge pull request #43952 from qarmin/cppcheck_modules
Initialize class/struct variables with default values in modules/
Diffstat (limited to 'modules/websocket/wsl_peer.h')
-rw-r--r--modules/websocket/wsl_peer.h38
1 files changed, 13 insertions, 25 deletions
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index 01efa4b21e..5e6a7e8554 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -48,29 +48,17 @@ class WSLPeer : public WebSocketPeer {
public:
struct PeerData {
- bool polling;
- bool destroy;
- bool valid;
- bool is_server;
- bool closing;
- void *obj;
- void *peer;
+ bool polling = false;
+ bool destroy = false;
+ bool valid = false;
+ bool is_server = false;
+ bool closing = false;
+ void *obj = nullptr;
+ void *peer = nullptr;
Ref<StreamPeer> conn;
Ref<StreamPeerTCP> tcp;
- int id;
- wslay_event_context_ptr ctx;
-
- PeerData() {
- polling = false;
- destroy = false;
- valid = false;
- is_server = false;
- id = 1;
- ctx = nullptr;
- obj = nullptr;
- closing = false;
- peer = nullptr;
- }
+ int id = 1;
+ wslay_event_context_ptr ctx = nullptr;
};
static String compute_key_response(String p_key);
@@ -80,17 +68,17 @@ private:
static bool _wsl_poll(struct PeerData *p_data);
static void _wsl_destroy(struct PeerData **p_data);
- struct PeerData *_data;
- uint8_t _is_string;
+ struct PeerData *_data = nullptr;
+ uint8_t _is_string = 0;
// Our packet info is just a boolean (is_string), using uint8_t for it.
PacketBuffer<uint8_t> _in_buffer;
Vector<uint8_t> _packet_buffer;
- WriteMode write_mode;
+ WriteMode write_mode = WRITE_MODE_BINARY;
public:
- int close_code;
+ int close_code = -1;
String close_reason;
void poll(); // Used by client and server.