summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Cole <robert.cole@intel.com>2015-06-15 17:32:31 -0400
committerErich Keane <erich.keane@intel.com>2015-06-17 19:56:11 +0000
commit9ad36b0477220ffc948638b9059139eed2bdb517 (patch)
treec6653ba6b2349472aedb67f66ce44c1eb0f8ffe0
parentd3ee4eb2a1c07300609d59a0274f37c35d941fe0 (diff)
Modifications to the xmpp client library code to downgrade from c++11 to
c++0x as of gcc 4.6.3. Under ubuntu 12.04. Signed-off-by: Robert Cole <robert.cole@intel.com> Change-Id: If1ff5f418212fefc93afec5b34ffd956eae76b50 Reviewed-on: https://gerrit.iotivity.org/gerrit/1278 Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org> Reviewed-by: Charlie Lenahan <charlie.lenahan@intel.com> Reviewed-by: Erich Keane <erich.keane@intel.com>
-rw-r--r--build_common/SConscript.py4
-rw-r--r--ra_xmpp/SConscript.py4
-rw-r--r--ra_xmpp/c_init_test/SConscript.py12
-rw-r--r--ra_xmpp/ra_xmpp_over_ccfxmpp.cpp60
-rw-r--r--ra_xmpp/test/SConscript.py18
-rw-r--r--ra_xmpp/test/xmpp_tests.cpp21
-rw-r--r--src/SConscript.py8
-rw-r--r--src/bosh/httpclient.cpp10
-rw-r--r--src/bosh/httpclient.h2
-rw-r--r--src/common/buffers.cpp2
-rw-r--r--src/common/sync_notify.h2
-rw-r--r--src/connect/connecterror.cpp11
-rw-r--r--src/connect/connecterror.h4
-rw-r--r--src/connect/tcpclient.cpp7
-rw-r--r--src/xmpp/sasl.h14
-rw-r--r--src/xmpp/xmppconfig.cpp4
-rw-r--r--src/xmpp/xmppstream.h5
-rw-r--r--test/SConscript.py3
-rw-r--r--test/xmpp_connect_establish.cpp7
-rw-r--r--test/xmpp_dummy_server.cpp11
-rw-r--r--test/xmpp_dummy_server.h10
-rw-r--r--test/xmpp_tests.cpp29
22 files changed, 165 insertions, 83 deletions
diff --git a/build_common/SConscript.py b/build_common/SConscript.py
index 8929fc3..8ecf824 100644
--- a/build_common/SConscript.py
+++ b/build_common/SConscript.py
@@ -85,7 +85,7 @@ env = Environment(ENV = _import_environment(import_environment_variables))
-env.EnsureSConsVersion(2,3)
+env.EnsureSConsVersion(2,1)
env.EnsurePythonVersion(2,7)
env.Tool('URLDownload', toolpath=['tools/'])
@@ -232,7 +232,7 @@ def versionSufficient(sourceVer, requiredVer):
if 'linux' in env['HOST']:
# Check g++ version (GCC C-version shouldn't matter as much, but can be checked too
# here if needed)
- REQUIRED_VER = "4.8.1"
+ REQUIRED_VER = "4.6.2"
# Check gcc version
if not versionSufficient(env['CXXVERSION'], REQUIRED_VER):
print "g++ version is insufficient to compile the client. Required:", REQUIRED_VER, " Found:", env['CXXVERSION']
diff --git a/ra_xmpp/SConscript.py b/ra_xmpp/SConscript.py
index 1a5233a..f4def4b 100644
--- a/ra_xmpp/SConscript.py
+++ b/ra_xmpp/SConscript.py
@@ -62,12 +62,14 @@ if target_os not in ['windows', 'winrt']:
'#src'],
CXXFLAGS = [
'-pthread',
- '-std=c++11',
+ #'-std=c++11',
+ '-std=c++0x',
'-fdata-sections',
'-ffunction-sections',
'-flto',
'-DASIO_STANDALONE',
'-DXMPP_EXPORTS',
+ '-Doverride=',
'-Os',
'-Wall',
'-Werror',
diff --git a/ra_xmpp/c_init_test/SConscript.py b/ra_xmpp/c_init_test/SConscript.py
index 8ba4c54..f1ca616 100644
--- a/ra_xmpp/c_init_test/SConscript.py
+++ b/ra_xmpp/c_init_test/SConscript.py
@@ -43,21 +43,21 @@ if target_os not in ['windows', 'winrt']:
ra_xmpp_test_env.AppendUnique(
CXXFLAGS = [
'-DENABLE_LIBSTROPHE',
- ],
+ ],
LIBS = ['strophe'])
ra_xmpp_test_env.Append(
- LIBS = ['ra_xmpp', 'ccfxmpp', 'safec-1.0']
+ LIBS = ['ra_xmpp', 'ccfxmpp', 'safec-1.0', 'curl']
)
ra_xmpp_test_env.AppendUnique(
- LIBPATH = [
+ LIBPATH = [
'#ra_xmpp',
'#src'
],
- CPPPATH = [
+ CPPPATH = [
'#ra_xmpp'],
CFLAGS = [
'-pthread',
- '-Wall',
+ '-Wall',
'-Werror',
'-Wno-unknown-pragmas', # Ignore any windows-specific pragmas (don't warn)
])
@@ -72,7 +72,7 @@ if target_os not in ['windows', 'winrt']:
LINKFLAGS = [
'-stdlib=libc++'
])
-
+
if not env['RELEASE']:
ra_xmpp_test_env.AppendUnique(CFLAGS = [
'-g'
diff --git a/ra_xmpp/ra_xmpp_over_ccfxmpp.cpp b/ra_xmpp/ra_xmpp_over_ccfxmpp.cpp
index ef4e098..95c499b 100644
--- a/ra_xmpp/ra_xmpp_over_ccfxmpp.cpp
+++ b/ra_xmpp/ra_xmpp_over_ccfxmpp.cpp
@@ -140,8 +140,8 @@ struct ContextWrapper
}
#endif
{
- lock_guard<recursive_mutex> lock(mutex());
- s_connectionParams[xmlConnection] = {handle, callback};
+ lock_guard<recursive_mutex> lock(ContextWrapper::mutex());
+ ContextWrapper::s_connectionParams[xmlConnection] = {handle, callback};
}
{
lock_guard<recursive_mutex> lock(m_mutex);
@@ -150,13 +150,15 @@ struct ContextWrapper
m_client = XmppClient::create();
auto createdFunc =
- [](XmppStreamCreatedEvent & e)
+ // Note: We don't really need reference capturing, but there is a bug in C++
+ // 4.6 where static functions still require capturing this.
+ [&](XmppStreamCreatedEvent & e)
{
ConnectionParams params{};
{
- lock_guard<recursive_mutex> lock(mutex());
- auto f = s_connectionParams.find(e.remoteServer());
- if (f == s_connectionParams.end())
+ lock_guard<recursive_mutex> lock(ContextWrapper::mutex());
+ auto f = ContextWrapper::s_connectionParams.find(e.remoteServer());
+ if (f == ContextWrapper::s_connectionParams.end())
{
return;
}
@@ -168,13 +170,16 @@ struct ContextWrapper
{
const void *streamHandle = stream.get();
{
- lock_guard<recursive_mutex> lock(mutex());
- s_streamsByHandle[streamHandle] = stream;
+ lock_guard<recursive_mutex> lock(ContextWrapper::mutex());
+ ContextWrapper::s_streamsByHandle[streamHandle] = stream;
}
auto callback = params.m_callback;
auto streamConnectedFunc =
- [stream, streamHandle, callback](XmppConnectedEvent & e)
+ // Note: We don't really need reference capturing, but there is a
+ // bug in C++ 4.6 where static functions still require
+ // capturing this.
+ [&, stream, streamHandle, callback](XmppConnectedEvent & e)
{
// Send first presence message
postPresence(stream);
@@ -188,13 +193,16 @@ struct ContextWrapper
connectionHandle);
}
};
- using StreamConnectedFunc = NotifySyncFunc<XmppConnectedEvent,
- decltype(streamConnectedFunc)>;
+ typedef NotifySyncFunc<XmppConnectedEvent,
+ decltype(streamConnectedFunc)> StreamConnectedFunc;
stream->onConnected() += make_shared<StreamConnectedFunc>(
streamConnectedFunc);
auto streamClosedFunc =
- [streamHandle, callback](XmppClosedEvent & e)
+ // Note: We don't really need reference capturing, but there is a
+ // bug in C++ 4.6 where static functions still require
+ // capturing this.
+ [&, streamHandle, callback](XmppClosedEvent & e)
{
if (callback.on_disconnected)
{
@@ -205,12 +213,12 @@ struct ContextWrapper
}
{
- lock_guard<recursive_mutex> lock(mutex());
- s_streamsByHandle.erase(streamHandle);
+ lock_guard<recursive_mutex> lock(ContextWrapper::mutex());
+ ContextWrapper::s_streamsByHandle.erase(streamHandle);
}
};
- using StreamClosedFunc = NotifySyncFunc<XmppClosedEvent,
- decltype(streamClosedFunc)>;
+ typedef NotifySyncFunc<XmppClosedEvent,
+ decltype(streamClosedFunc)> StreamClosedFunc;
stream->onClosed() += make_shared<StreamClosedFunc>(streamClosedFunc);
}
else
@@ -227,13 +235,13 @@ struct ContextWrapper
{
lock_guard<recursive_mutex> lock(mutex());
- s_connectionParams.erase(e.remoteServer());
+ ContextWrapper::s_connectionParams.erase(e.remoteServer());
}
};
- using StreamCreatedFunc = NotifySyncFunc<XmppStreamCreatedEvent,
- decltype(createdFunc)>;
+ typedef NotifySyncFunc<XmppStreamCreatedEvent,
+ decltype(createdFunc)> StreamCreatedFunc;
m_client->onStreamCreated() += make_shared<StreamCreatedFunc>(createdFunc);
}
}
@@ -403,8 +411,8 @@ struct ContextWrapper
}
}
};
- using StreamMessageFunc = NotifySyncFunc<XmppMessageEvent,
- decltype(streamMessageFunc)>;
+ typedef NotifySyncFunc<XmppMessageEvent,
+ decltype(streamMessageFunc)> StreamMessageFunc;
stream->onMessage() += make_shared<StreamMessageFunc>(streamMessageFunc);
@@ -543,11 +551,11 @@ struct ContextWrapper
}
private:
- recursive_mutex m_mutex{};
- shared_ptr<XmppClient> m_client{};
+ recursive_mutex m_mutex;
+ shared_ptr<XmppClient> m_client;
static set<const void *> s_wrappers;
- using StreamHandleMap = map<const void *, weak_ptr<IXmppStream>>;
+ typedef map<const void *, weak_ptr<IXmppStream>> StreamHandleMap;
static StreamHandleMap s_streamsByHandle;
struct MessageHandler
@@ -558,14 +566,14 @@ struct ContextWrapper
weak_ptr<IXmppStream> m_stream;
xmpp_message_callback_t m_callback;
};
- using MessageHandlerMap = map<const void *, shared_ptr<MessageHandler>>;
+ typedef map<const void *, shared_ptr<MessageHandler>> MessageHandlerMap;
static MessageHandlerMap s_messageHandlers;
struct ConnectionParams
{
void *m_handle;
xmpp_connection_callback_t m_callback;
};
- using ConnectParamMap = map<shared_ptr<IXmppConnection>, ConnectionParams>;
+ typedef map<shared_ptr<IXmppConnection>, ConnectionParams> ConnectParamMap;
static ConnectParamMap s_connectionParams;
};
diff --git a/ra_xmpp/test/SConscript.py b/ra_xmpp/test/SConscript.py
index fd66660..0afd626 100644
--- a/ra_xmpp/test/SConscript.py
+++ b/ra_xmpp/test/SConscript.py
@@ -44,34 +44,36 @@ if target_os not in ['windows', 'winrt']:
ra_xmpp_test_env.AppendUnique(
CXXFLAGS = [
'-DENABLE_LIBSTROPHE',
- ],
+ ],
LIBS = ['strophe'])
ra_xmpp_test_env.Append(
- LIBS = ['ra_xmpp', 'ccfxmpp', 'gtest', 'safec-1.0', 'pthread']
+ LIBS = ['ra_xmpp', 'ccfxmpp', 'gtest', 'safec-1.0', 'pthread', 'curl']
)
ra_xmpp_test_env.AppendUnique(
- LIBPATH = [
+ LIBPATH = [
'#ra_xmpp',
'#src'
],
- CPPPATH = [
+ CPPPATH = [
'#ra_xmpp'
],
CXXFLAGS = [
'-pthread',
- '-std=c++11',
+ #'-std=c++11',
+ '-std=c++0x',
+ '-Doverride=',
'-fno-rtti',
- '-Wall',
+ '-Wall',
'-Werror',
'-Wno-unknown-pragmas', # Ignore any windows-specific pragmas (don't warn)
])
-
+
if target_os not in ['darwin','ios']:
ra_xmpp_test_env.AppendUnique(
LINKFLAGS = [
'-Wl,--no-as-needed'
])
-
+
if not env['RELEASE']:
ra_xmpp_test_env.AppendUnique(CXXFLAGS = [
'-g'
diff --git a/ra_xmpp/test/xmpp_tests.cpp b/ra_xmpp/test/xmpp_tests.cpp
index fef2868..ac744f3 100644
--- a/ra_xmpp/test/xmpp_tests.cpp
+++ b/ra_xmpp/test/xmpp_tests.cpp
@@ -295,7 +295,7 @@ string base64Encode(const void *buf, size_t size)
// 32 as EVP_EncodeBlock adds garbage past the expected end of the buffer.
size_t bufLen = BASE64_ENCODE_RESERVE(size) + 32;
- auto *tempBuf = new uint8_t[bufLen] {};
+ auto *tempBuf = new uint8_t[bufLen];
try
{
EVP_EncodeBlock(tempBuf, (const uint8_t *)buf, (int)size);
@@ -411,7 +411,8 @@ struct SimpleConnection
{
SimpleConnection(const string &instanceName, xmpp_handle_t handle, const xmpp_identity_t &identity,
list<xmpp_identity_t> targets):
- m_instance(instanceName), m_identity(identity)
+ m_instance(instanceName), m_identity(identity),
+ m_shutdown(false), m_onSentCalls(0)
{
for (const auto &t : targets)
{
@@ -498,7 +499,7 @@ struct SimpleConnection
{
EXPECT_NE(bound_jid, nullptr);
- xmpp_message_callback_t callback{};
+ xmpp_message_callback_t callback = {};
callback.on_received = &SimpleConnection::onReceived;
callback.on_sent = &SimpleConnection::onSent;
callback.param = param;
@@ -570,13 +571,13 @@ struct SimpleConnection
string m_instance;
xmpp_identity_t m_identity;
- thread m_thread{};
- bool m_shutdown{false};
- list<string> m_targets{};
- list<string> m_messageQueue{};
- xmpp_connection_handle_t m_connection{};
- xmpp_message_context_t m_messageContext{};
- size_t m_onSentCalls{0};
+ thread m_thread;
+ bool m_shutdown;
+ list<string> m_targets;
+ list<string> m_messageQueue;
+ xmpp_connection_handle_t m_connection;
+ xmpp_message_context_t m_messageContext;
+ size_t m_onSentCalls;
};
diff --git a/src/SConscript.py b/src/SConscript.py
index 99eca22..4f1b716 100644
--- a/src/SConscript.py
+++ b/src/SConscript.py
@@ -59,7 +59,9 @@ ccfxmpp_lib_env.AppendUnique(CPPPATH = ['#external/rapidxml-1.13/'])
if target_os not in ['windows', 'winrt']:
ccfxmpp_lib_env.AppendUnique(CPPPATH = ['platform/linux/'])
ccfxmpp_lib_env.AppendUnique(CXXFLAGS = [
- '-std=c++11',
+ #'-std=c++11',
+ '-std=c++0x',
+ '-Doverride=',
'-fdata-sections',
'-ffunction-sections',
'-fno-rtti',
@@ -67,7 +69,7 @@ if target_os not in ['windows', 'winrt']:
'-DASIO_STANDALONE',
'-DASIO_NO_TYPEID',
'-Os',
- '-Wall',
+ '-Wall',
'-Werror',
'-Wno-unknown-pragmas', # Ignore any windows-specific pragmas (don't warn)
'-fPIC',
@@ -78,7 +80,7 @@ if target_os not in ['windows', 'winrt']:
'-Wl,--gc-sections',
'-Wl,--strip-all',
])
-
+
if env['STROPHE']:
ccfxmpp_lib_env.AppendUnique(CXXFLAGS = [
'-DENABLE_LIBSTROPHE',
diff --git a/src/bosh/httpclient.cpp b/src/bosh/httpclient.cpp
index 73c6b11..506c561 100644
--- a/src/bosh/httpclient.cpp
+++ b/src/bosh/httpclient.cpp
@@ -45,10 +45,18 @@ namespace Iotivity
"Cast of enum curl_infotype to uint not possible."
" Increase the size of infotype_t.");
- HttpCurlConnection::HttpCurlConnection(): HttpCurlConnection("") {}
+ HttpCurlConnection::HttpCurlConnection()
+ {
+ initCurl("");
+ }
HttpCurlConnection::HttpCurlConnection(const string &url)
{
+ initCurl(url);
+ }
+
+ void HttpCurlConnection::initCurl(const string &url)
+ {
if (curl())
{
// TODO: Manage certs
diff --git a/src/bosh/httpclient.h b/src/bosh/httpclient.h
index ee98cde..9be7927 100644
--- a/src/bosh/httpclient.h
+++ b/src/bosh/httpclient.h
@@ -98,6 +98,8 @@ namespace Iotivity
void headerCallback(const std::string &data);
private:
+ void initCurl(const std::string &url);
+
HttpCurlConnection(const HttpCurlConnection &) = delete;
HttpCurlConnection &operator=(const HttpCurlConnection &) = delete;
diff --git a/src/common/buffers.cpp b/src/common/buffers.cpp
index f5dc358..c7cd141 100644
--- a/src/common/buffers.cpp
+++ b/src/common/buffers.cpp
@@ -561,7 +561,7 @@ namespace Iotivity
if (inputBuffer.size() > 0)
{
size_t newSize = BASE64_ENCODE_RESERVE(inputBuffer.size());
- if (newSize <= std::numeric_limits<int>::max())
+ if (newSize <= static_cast<size_t>(std::numeric_limits<int>::max()))
{
if (outputBuffer.resizeBuffer(newSize +
32)) // provide extra space of the EVP_EncodeBlock to smash our buffer
diff --git a/src/common/sync_notify.h b/src/common/sync_notify.h
index 1a6e379..d38af58 100644
--- a/src/common/sync_notify.h
+++ b/src/common/sync_notify.h
@@ -273,7 +273,7 @@ namespace Iotivity
if (notifier)
{
std::lock_guard<_MutexT> lock(m_mutex);
- m_notifiers.emplace(notifier);
+ m_notifiers.insert(notifier);
}
return *this;
}
diff --git a/src/connect/connecterror.cpp b/src/connect/connecterror.cpp
index 6ac6110..c48f9c7 100644
--- a/src/connect/connecterror.cpp
+++ b/src/connect/connecterror.cpp
@@ -42,10 +42,11 @@ namespace Iotivity
LocalError::ErrorType connect_error::s_etSOCKS5Error = LocalError::etUnknownError;
LocalError::ErrorType connect_error::s_etASIOError = LocalError::etUnknownError;
- connect_error::connect_error() {}
+ connect_error::connect_error(): m_httpSubCode(0) {}
connect_error::connect_error(const LocalError &error) :
- LocalError(error)
+ LocalError(error),
+ m_httpSubCode(0)
{}
connect_error::connect_error(const connect_error &error) :
@@ -54,7 +55,8 @@ namespace Iotivity
{}
connect_error::connect_error(ConnectErrorCode errorCode) :
- LocalError(errorCode, etConnectError())
+ LocalError(errorCode, etConnectError()),
+ m_httpSubCode(0)
{}
connect_error::connect_error(int httpCode, int httpSubCode) :
@@ -63,7 +65,8 @@ namespace Iotivity
{}
connect_error::connect_error(ECODE errorCode, ErrorType errorType) :
- LocalError(errorCode, errorType)
+ LocalError(errorCode, errorType),
+ m_httpSubCode(0)
{}
#ifndef DISABLE_SUPPORT_NATIVE_XMPP_CLIENT
diff --git a/src/connect/connecterror.h b/src/connect/connecterror.h
index f07ed6b..546243c 100644
--- a/src/connect/connecterror.h
+++ b/src/connect/connecterror.h
@@ -141,11 +141,11 @@ namespace Iotivity
static ErrorType s_etASIOError; ///< Error code comes from asio library
// For etHttpError
- int m_httpSubCode{0};
+ int m_httpSubCode;
#ifndef DISABLE_SUPPORT_NATIVE_XMPP_CLIENT
// For etASIOError
- asio::error_code m_asioError{};
+ asio::error_code m_asioError;
#endif
};
diff --git a/src/connect/tcpclient.cpp b/src/connect/tcpclient.cpp
index 9298f60..6f9a22e 100644
--- a/src/connect/tcpclient.cpp
+++ b/src/connect/tcpclient.cpp
@@ -133,7 +133,7 @@ namespace Iotivity
m_ioService(ioService), m_config(proxy) {}
SOCKS5Connect(asio::io_service &ioService, const string &host, const string &port):
- SOCKS5Connect(ioService, ProxyConfig(host, port,
+ m_ioService(ioService), m_config(ProxyConfig(host, port,
ProxyConfig::ProxyType::ProxySOCKS5))
{}
@@ -486,7 +486,10 @@ namespace Iotivity
//////////
TcpConnection::TcpConnection(const string &host, const string &port):
- TcpConnection(host, port, ProxyConfig()) {}
+ p_(new TcpConnectionImpl(host, port, ProxyConfig()))
+ {
+ initTcpConnection();
+ }
TcpConnection::TcpConnection(const string &host, const string &port,
const ProxyConfig &proxy):
diff --git a/src/xmpp/sasl.h b/src/xmpp/sasl.h
index e8382bc..2bf1da7 100644
--- a/src/xmpp/sasl.h
+++ b/src/xmpp/sasl.h
@@ -239,6 +239,8 @@ namespace Iotivity
{}
};
+ SaslScramSha1(): m_iterations(0) {}
+
virtual bool requiresAuthenticatedStream() const override { return false; }
virtual void setParams(std::shared_ptr<ISaslParams> params) override;
@@ -252,12 +254,12 @@ namespace Iotivity
virtual void handleSuccess(const SecureBuffer &response,
ResponseCallback callback) override;
private:
- std::shared_ptr<Params> m_params{};
- std::string m_serverNonce{};
- std::string m_serverSalt{};
- SecureBuffer m_challengeData{};
- SecureBuffer m_serverSig{};
- size_t m_iterations{0};
+ std::shared_ptr<Params> m_params;
+ std::string m_serverNonce;
+ std::string m_serverSalt;
+ SecureBuffer m_challengeData;
+ SecureBuffer m_serverSig;
+ size_t m_iterations;
};
diff --git a/src/xmpp/xmppconfig.cpp b/src/xmpp/xmppconfig.cpp
index 92ff925..8c6c844 100644
--- a/src/xmpp/xmppconfig.cpp
+++ b/src/xmpp/xmppconfig.cpp
@@ -83,7 +83,9 @@ namespace Iotivity
//////////
- XmppConfig::XmppConfig(): XmppConfig(JabberID(""), "") {}
+ XmppConfig::XmppConfig():
+ p_(new XmppConfigImpl(JabberID(""), ""))
+ {}
XmppConfig::XmppConfig(const JabberID &initiator, const std::string &host):
p_(new XmppConfigImpl(initiator, host))
diff --git a/src/xmpp/xmppstream.h b/src/xmpp/xmppstream.h
index 84001f7..9441d45 100644
--- a/src/xmpp/xmppstream.h
+++ b/src/xmpp/xmppstream.h
@@ -42,6 +42,7 @@ namespace Iotivity
XmppStreamBase();
XmppStreamBase(const XmppStreamBase &) = delete;
XmppStreamBase &operator=(const XmppStreamBase &) = delete;
+ virtual ~XmppStreamBase() _NOEXCEPT {}
virtual std::string getNextID() override;
@@ -66,10 +67,10 @@ namespace Iotivity
struct ActiveQuery
{
- ActiveQuery(): m_callback(), m_submittedAt(std::chrono::steady_clock::now()) {}
+ ActiveQuery(): m_callback(), m_submittedAt(std::chrono::system_clock::now()) {}
QueryResponse m_callback;
- std::chrono::steady_clock::time_point m_submittedAt;
+ std::chrono::system_clock::time_point m_submittedAt;
};
typedef std::map<std::string, ActiveQuery> Queries;
Queries m_queries;
diff --git a/test/SConscript.py b/test/SConscript.py
index 05e751f..1d22201 100644
--- a/test/SConscript.py
+++ b/test/SConscript.py
@@ -62,7 +62,8 @@ if target_os not in ['windows', 'winrt']:
'#src'
],
CXXFLAGS = [
- '-std=c++11',
+ '-std=c++0x',
+ '-Doverride=',
'-fdata-sections',
'-ffunction-sections',
'-flto',
diff --git a/test/xmpp_connect_establish.cpp b/test/xmpp_connect_establish.cpp
index fd6df2a..55d4be7 100644
--- a/test/xmpp_connect_establish.cpp
+++ b/test/xmpp_connect_establish.cpp
@@ -169,8 +169,13 @@ void xmpp_test_default_connect_client(shared_ptr<IXmppStream> &stream,
xmppStream = streamFuture.get();
if (xmppStream)
{
- auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
+#if __cplusplus>=201103L
+ future_status status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
if (status == future_status::ready)
+#else
+ bool status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
+ if (status)
+#endif
{
try
{
diff --git a/test/xmpp_dummy_server.cpp b/test/xmpp_dummy_server.cpp
index 1535b8d..febc8e0 100644
--- a/test/xmpp_dummy_server.cpp
+++ b/test/xmpp_dummy_server.cpp
@@ -355,6 +355,7 @@ void SegmentRunner::run(const SegmentArray &segments)
{
if (willCompleteNegotiation)
{
+#if __cplusplus>=201103L
auto status = m_stream->whenNegotiated().wait_for(chrono::seconds(5));
EXPECT_EQ(status, future_status::ready);
@@ -363,6 +364,16 @@ void SegmentRunner::run(const SegmentArray &segments)
auto status = m_stream->whenBound().wait_for(chrono::seconds(5));
EXPECT_EQ(status, future_status::ready);
}
+#else
+ bool status = m_stream->whenNegotiated().wait_for(chrono::seconds(5));
+ EXPECT_TRUE(status);
+
+ if (willCompleteBind)
+ {
+ bool status = m_stream->whenBound().wait_for(chrono::seconds(5));
+ EXPECT_TRUE(status);
+ }
+#endif
}
size_t sleepCount = 0;
while (!remoteTcp->lastSegmentRan() && sleepCount < 1000)
diff --git a/test/xmpp_dummy_server.h b/test/xmpp_dummy_server.h
index 4850885..e9e5f08 100644
--- a/test/xmpp_dummy_server.h
+++ b/test/xmpp_dummy_server.h
@@ -92,7 +92,7 @@ class SegmentedDummyTCPConnect: public DummyTCPConnect
bool lastSegmentRan() const { return currentAction() == Segment::OutOfActions; }
- using CaptureMap = std::map<std::string, std::string>;
+ typedef std::map<std::string, std::string> CaptureMap;
CaptureMap captures() const { return m_captures; }
protected:
@@ -122,10 +122,10 @@ class SegmentRunner
std::shared_ptr<Iotivity::Xmpp::IXmppStream> stream() const { return m_stream; }
private:
- SegmentedDummyTCPConnect::CaptureMap m_captures{};
- std::shared_ptr<Iotivity::Xmpp::IXmppStream> m_stream{};
+ SegmentedDummyTCPConnect::CaptureMap m_captures;
+ std::shared_ptr<Iotivity::Xmpp::IXmppStream> m_stream;
Iotivity::Xmpp::XmppConfig m_config;
- std::shared_ptr<Iotivity::Xmpp::XmppClient> m_client{};
+ std::shared_ptr<Iotivity::Xmpp::XmppClient> m_client;
};
-#endif // ifndef DISABLE_SUPPORT_NATIVE_XMPP_CLIENT \ No newline at end of file
+#endif // ifndef DISABLE_SUPPORT_NATIVE_XMPP_CLIENT
diff --git a/test/xmpp_tests.cpp b/test/xmpp_tests.cpp
index d394939..58ec503 100644
--- a/test/xmpp_tests.cpp
+++ b/test/xmpp_tests.cpp
@@ -170,8 +170,13 @@ TEST(XmppClient, XMPP_StreamEstablish)
ASSERT_TRUE(xmppStream->whenNegotiated().valid());
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(10));
+#if __cplusplus>=201103L
EXPECT_EQ(status, future_status::ready);
if (status == future_status::ready)
+#else
+ EXPECT_TRUE(status);
+ if (status)
+#endif
{
try
{
@@ -328,16 +333,26 @@ TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
auto status1 = streamCallbackFuture.wait_for(chrono::seconds(5));
+#if __cplusplus>=201103L
EXPECT_EQ(status1, future_status::ready);
if (status1 == future_status::ready)
+#else
+ EXPECT_TRUE(status1);
+ if (status1)
+#endif
{
try
{
streamCallbackFuture.get();
auto status2 = openCallbackFuture.wait_for(chrono::seconds(10));
+#if __cplusplus>=201103L
EXPECT_EQ(status2, future_status::ready);
if (status2 == future_status::ready)
+#else
+ EXPECT_TRUE(status2);
+ if (status2)
+#endif
{
openCallbackFuture.get();
@@ -350,8 +365,13 @@ TEST(XmppClient, XMPP_StreamEstablish_Event_Callbacks)
}
auto status3 = closedCallbackFuture.wait_for(chrono::seconds(5));
+#if __cplusplus>=201103L
EXPECT_EQ(status3, future_status::ready);
if (status3 == future_status::ready)
+#else
+ EXPECT_TRUE(status3);
+ if (status3)
+#endif
{
try
{
@@ -719,7 +739,11 @@ TEST(XmppClient, XMPP_StreamParseTests)
if (willCompleteNegotiation)
{
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(5));
+#if __cplusplus>=201103L
EXPECT_EQ(status, future_status::ready);
+#else
+ EXPECT_TRUE(status);
+#endif
}
else
{
@@ -794,8 +818,13 @@ TEST(XmppClient, DISABLED_Dummy_Chat_Test)
ASSERT_TRUE(xmppStream->whenNegotiated().valid());
auto status = xmppStream->whenNegotiated().wait_for(chrono::seconds(20));
+#if __cplusplus>=201103L
EXPECT_EQ(status, future_status::ready);
if (status == future_status::ready)
+#else
+ EXPECT_TRUE(status);
+ if (status)
+#endif
{
ASSERT_NO_THROW(xmppStream->whenNegotiated().get());