1
0
Fork 0

Codechange: [Network] Let NetworkError return its std::string instead of a C-string

pull/9369/head
rubidium42 2021-06-13 21:41:07 +02:00 committed by rubidium42
parent 667301e3ec
commit 53b4786037
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ bool NetworkError::IsConnectInProgress() const
* Get the string representation of the error message. * Get the string representation of the error message.
* @return The string representation that will get overwritten by next calls. * @return The string representation that will get overwritten by next calls.
*/ */
const char *NetworkError::AsString() const const std::string &NetworkError::AsString() const
{ {
if (this->message.empty()) { if (this->message.empty()) {
#if defined(_WIN32) #if defined(_WIN32)
@ -97,7 +97,7 @@ const char *NetworkError::AsString() const
this->message.assign(strerror(this->error)); this->message.assign(strerror(this->error));
#endif #endif
} }
return this->message.c_str(); return this->message;
} }
/** /**

View File

@ -29,7 +29,7 @@ public:
bool WouldBlock() const; bool WouldBlock() const;
bool IsConnectionReset() const; bool IsConnectionReset() const;
bool IsConnectInProgress() const; bool IsConnectInProgress() const;
const char *AsString() const; const std::string &AsString() const;
static NetworkError GetLast(); static NetworkError GetLast();
}; };