mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
Merge pull request #1556 from JulianGro/fix_static_function_warning
Fix static function warning in SocketType.h.
This commit is contained in:
commit
44520dacd6
3 changed files with 17 additions and 15 deletions
|
@ -113,7 +113,7 @@ void SockAddr::handleLookupResult(const QHostInfo& hostInfo) {
|
|||
}
|
||||
|
||||
QString SockAddr::toString() const {
|
||||
return socketTypeToString(_socketType) + " " + _address.toString() + ":" + QString::number(_port);
|
||||
return SocketTypeToString::socketTypeToString(_socketType) + " " + _address.toString() + ":" + QString::number(_port);
|
||||
}
|
||||
|
||||
QString SockAddr::toShortString() const {
|
||||
|
@ -133,9 +133,9 @@ bool SockAddr::hasPrivateAddress() const {
|
|||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const SockAddr& sockAddr) {
|
||||
debug.nospace()
|
||||
<< (sockAddr._socketType != SocketType::Unknown
|
||||
? (socketTypeToString(sockAddr._socketType) + " ").toLocal8Bit().constData() : "")
|
||||
debug.nospace()
|
||||
<< (sockAddr._socketType != SocketType::Unknown
|
||||
? (SocketTypeToString::socketTypeToString(sockAddr._socketType) + " ").toLocal8Bit().constData() : "")
|
||||
<< sockAddr._address.toString().toLocal8Bit().constData() << ":" << sockAddr._port;
|
||||
return debug.space();
|
||||
}
|
||||
|
|
|
@ -25,14 +25,16 @@ enum class SocketType : uint8_t {
|
|||
WebRTC ///< WebRTC socket. A WebRTC data channel presented as a UDP-style socket.
|
||||
};
|
||||
|
||||
/// @brief Returns the name of a SocketType value, e.g., <code>"WebRTC"</code>.
|
||||
/// @param socketType The SocketType value.
|
||||
/// @return The name of the SocketType value.
|
||||
static QString socketTypeToString(SocketType socketType) {
|
||||
static QStringList SOCKET_TYPE_STRINGS { "Unknown", "UDP", "WebRTC" };
|
||||
return SOCKET_TYPE_STRINGS[(int)socketType];
|
||||
}
|
||||
|
||||
class SocketTypeToString {
|
||||
public:
|
||||
/// @brief Returns the name of a SocketType value, e.g., <code>"WebRTC"</code>.
|
||||
/// @param socketType The SocketType value.
|
||||
/// @return The name of the SocketType value.
|
||||
static QString socketTypeToString (SocketType socketType) {
|
||||
static QStringList SOCKET_TYPE_STRINGS { "Unknown", "UDP", "WebRTC" };
|
||||
return SOCKET_TYPE_STRINGS[(int)socketType];
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -559,8 +559,8 @@ void Socket::handleSocketError(SocketType socketType, QAbstractSocket::SocketErr
|
|||
#endif
|
||||
int pending = _networkSocket.bytesToWrite(socketType);
|
||||
QString errorString;
|
||||
QDebug(&errorString) << "udt::Socket (" << socketTypeToString(socketType) << _networkSocket.state(socketType)
|
||||
<< ") error - " << wsaError << socketError << "(" << _networkSocket.errorString(socketType) << ")"
|
||||
QDebug(&errorString) << "udt::Socket (" << SocketTypeToString::socketTypeToString(socketType) << _networkSocket.state(socketType)
|
||||
<< ") error - " << wsaError << socketError << "(" << _networkSocket.errorString(socketType) << ")"
|
||||
<< (pending ? "pending bytes:" : "pending:") << pending;
|
||||
|
||||
if (previousWsaError.exchange(wsaError) != wsaError) {
|
||||
|
@ -576,7 +576,7 @@ void Socket::handleSocketError(SocketType socketType, QAbstractSocket::SocketErr
|
|||
|
||||
void Socket::handleStateChanged(SocketType socketType, QAbstractSocket::SocketState socketState) {
|
||||
if (socketState != QAbstractSocket::BoundState) {
|
||||
qCDebug(networking) << socketTypeToString(socketType) << "socket state changed - state is now" << socketState;
|
||||
qCDebug(networking) << SocketTypeToString::socketTypeToString(socketType) << "socket state changed - state is now" << socketState;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue