0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00

HTTP client : status argument to WS::Client::Status::error_str() should be an int because -1 is one of the possible values.

This commit is contained in:
James Yonan 2016-11-02 12:15:10 -07:00 committed by Lev Stipakov
parent 3b8a5595fb
commit 12866f4d0a
No known key found for this signature in database
GPG Key ID: 88670BE258B9C258

View File

@ -95,7 +95,7 @@ namespace openvpn {
N_ERRORS
};
static std::string error_str(const size_t status)
static std::string error_str(const int status)
{
static const char *error_names[] = {
"E_SUCCESS",
@ -116,7 +116,7 @@ namespace openvpn {
};
static_assert(N_ERRORS == array_size(error_names), "HTTP error names array inconsistency");
if (status < N_ERRORS)
if (status >= 0 && status < N_ERRORS)
return error_names[status];
else if (status == -1)
return "E_UNDEF";