Commit e3b1279f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

SshConnectionParameters: Fix compiler warning about inline vs export



by making operator== non-inline.
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 0f4a66e7
...@@ -65,6 +65,31 @@ namespace { ...@@ -65,6 +65,31 @@ namespace {
staticInitMutex.unlock(); staticInitMutex.unlock();
} }
} }
} // anonymous namespace
SshConnectionParameters::SshConnectionParameters() :
timeout(0), authType(AuthByKey), port(0)
{
}
static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return p1.host == p2.host && p1.uname == p2.uname
&& p1.authType == p2.authType
&& (p1.authType == SshConnectionParameters::AuthByPwd ?
p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile)
&& p1.timeout == p2.timeout && p1.port == p2.port;
}
CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return equals(p1, p2);
}
CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return !equals(p1, p2);
} }
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare // TODO: Mechanism for checking the host key. First connection to host: save, later: compare
......
...@@ -49,6 +49,8 @@ class SshConnectionPrivate; ...@@ -49,6 +49,8 @@ class SshConnectionPrivate;
struct CORE_EXPORT SshConnectionParameters struct CORE_EXPORT SshConnectionParameters
{ {
SshConnectionParameters();
QString host; QString host;
QString uname; QString uname;
QString pwd; QString pwd;
...@@ -57,16 +59,9 @@ struct CORE_EXPORT SshConnectionParameters ...@@ -57,16 +59,9 @@ struct CORE_EXPORT SshConnectionParameters
enum AuthType { AuthByPwd, AuthByKey } authType; enum AuthType { AuthByPwd, AuthByKey } authType;
quint16 port; quint16 port;
}; };
CORE_EXPORT inline bool operator==(const SshConnectionParameters &p1,
const SshConnectionParameters &p2)
{
return p1.host == p2.host && p1.uname == p2.uname
&& p1.authType == p2.authType
&& (p1.authType == SshConnectionParameters::AuthByPwd ?
p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile)
&& p1.timeout == p2.timeout && p1.port == p2.port;
}
CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
/* /*
* This class provides an SSH connection, implementing protocol version 2.0 * This class provides an SSH connection, implementing protocol version 2.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment