mirror of https://github.com/OpenTTD/OpenTTD
Codechange: [Network] Let NetworkError return its std::string instead of a C-string
parent
667301e3ec
commit
53b4786037
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue