Fix Clazy returning-data-from-temporary warnings

This commit is contained in:
Cameron Gutman
2026-01-26 21:03:20 -06:00
parent d484ec3ac8
commit b732b58807

View File

@@ -33,19 +33,19 @@ class GfeHttpResponseException : public std::exception
public:
GfeHttpResponseException(int statusCode, QString message) :
m_StatusCode(statusCode),
m_StatusMessage(message)
m_StatusMessage(message.toUtf8())
{
}
const char* what() const throw()
{
return m_StatusMessage.toLatin1();
return m_StatusMessage.constData();
}
const char* getStatusMessage() const
{
return m_StatusMessage.toLatin1();
return m_StatusMessage.constData();
}
int getStatusCode() const
@@ -55,12 +55,12 @@ public:
QString toQString() const
{
return m_StatusMessage + " (Error " + QString::number(m_StatusCode) + ")";
return QString::fromUtf8(m_StatusMessage) + " (Error " + QString::number(m_StatusCode) + ")";
}
private:
int m_StatusCode;
QString m_StatusMessage;
QByteArray m_StatusMessage;
};
class QtNetworkReplyException : public std::exception
@@ -68,19 +68,19 @@ class QtNetworkReplyException : public std::exception
public:
QtNetworkReplyException(QNetworkReply::NetworkError error, QString errorText) :
m_Error(error),
m_ErrorText(errorText)
m_ErrorText(errorText.toUtf8())
{
}
const char* what() const throw()
{
return m_ErrorText.toLatin1();
return m_ErrorText.constData();
}
const char* getErrorText() const
{
return m_ErrorText.toLatin1();
return m_ErrorText.constData();
}
QNetworkReply::NetworkError getError() const
@@ -90,12 +90,12 @@ public:
QString toQString() const
{
return m_ErrorText + " (Error " + QString::number(m_Error) + ")";
return QString::fromUtf8(m_ErrorText) + " (Error " + QString::number(m_Error) + ")";
}
private:
QNetworkReply::NetworkError m_Error;
QString m_ErrorText;
QByteArray m_ErrorText;
};
class NvHTTP : public QObject