From e3b1279f657382bbf74cc701cda3b0e3e9fd2390 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 24 Aug 2010 10:51:31 +0200 Subject: [PATCH] SshConnectionParameters: Fix compiler warning about inline vs export by making operator== non-inline. Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com> --- src/plugins/coreplugin/ssh/sshconnection.cpp | 25 ++++++++++++++++++++ src/plugins/coreplugin/ssh/sshconnection.h | 13 ++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/plugins/coreplugin/ssh/sshconnection.cpp b/src/plugins/coreplugin/ssh/sshconnection.cpp index 51f3f20665d..97f315db71d 100644 --- a/src/plugins/coreplugin/ssh/sshconnection.cpp +++ b/src/plugins/coreplugin/ssh/sshconnection.cpp @@ -65,6 +65,31 @@ namespace { 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 diff --git a/src/plugins/coreplugin/ssh/sshconnection.h b/src/plugins/coreplugin/ssh/sshconnection.h index d863fd50b47..f57458ea538 100644 --- a/src/plugins/coreplugin/ssh/sshconnection.h +++ b/src/plugins/coreplugin/ssh/sshconnection.h @@ -49,6 +49,8 @@ class SshConnectionPrivate; struct CORE_EXPORT SshConnectionParameters { + SshConnectionParameters(); + QString host; QString uname; QString pwd; @@ -57,16 +59,9 @@ struct CORE_EXPORT SshConnectionParameters enum AuthType { AuthByPwd, AuthByKey } authType; 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 -- GitLab