Skip to content

Commit

Permalink
websocket_frame_parser: Initialize m_error_desc to a null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Jan 15, 2024
1 parent f38fc8d commit 12ca074
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions poseidon/http/websocket_frame_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ clear() noexcept
this->m_frm_payload_rem = 0;

this->m_state_stor = 0;
this->m_error_desc = "";
this->m_error_desc = nullptr;
}

void
Expand Down Expand Up @@ -322,7 +322,7 @@ accept_handshake_request(HTTP_Response_Headers& resp, const HTTP_Request_Headers
// For the server, this connection has now been established.
this->m_wshs = wshs_s_accepted;
this->m_wsf = wsf_new;
this->m_error_desc = "";
this->m_error_desc = nullptr;
}

void
Expand Down Expand Up @@ -413,7 +413,7 @@ accept_handshake_response(const HTTP_Response_Headers& resp)
// For the client, this connection has now been established.
this->m_wshs = wshs_c_accepted;
this->m_wsf = wsf_new;
this->m_error_desc = "";
this->m_error_desc = nullptr;
}

void
Expand Down
5 changes: 3 additions & 2 deletions poseidon/http/websocket_frame_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ class WebSocket_Frame_Parser
};
};

const char* m_error_desc = "";
const char* m_error_desc = nullptr;

public:
// Constructs a parser for incoming frames.
constexpr
WebSocket_Frame_Parser() noexcept
{ }

Expand All @@ -71,7 +72,7 @@ class WebSocket_Frame_Parser

const char*
error_description() const noexcept
{ return this->m_error_desc; }
{ return this->m_error_desc ? this->m_error_desc : "success"; }

// Get the operating mode.
bool
Expand Down

0 comments on commit 12ca074

Please sign in to comment.