diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-10-23 16:19:38 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-10-23 16:19:38 -0400 |
commit | ada25bad3511a359eb28cf48f018d6a42e166f10 (patch) | |
tree | 430749f887a1c6f708c2d4a23b3e3ec4ef18ef2c | |
parent | Ruby 1.8 fix (diff) | |
download | ice-ada25bad3511a359eb28cf48f018d6a42e166f10.tar.bz2 ice-ada25bad3511a359eb28cf48f018d6a42e166f10.tar.xz ice-ada25bad3511a359eb28cf48f018d6a42e166f10.zip |
Fixed ICE-4855: expand tabs to space (8) for .php, .cpp, .h, .java and .cs files
224 files changed, 3978 insertions, 3978 deletions
diff --git a/cpp/demo/Freeze/customEvictor/Client.cpp b/cpp/demo/Freeze/customEvictor/Client.cpp index 5536358bc01..e340aec325f 100644 --- a/cpp/demo/Freeze/customEvictor/Client.cpp +++ b/cpp/demo/Freeze/customEvictor/Client.cpp @@ -198,7 +198,7 @@ WarehouseClient::run(int argc, char* argv[]) if(rpt > 0) { cout << "Reader " << i << ": " << rpt << " requests per second (" << 1000.0 / rpt - << " ms per request)" << endl; + << " ms per request)" << endl; } } diff --git a/cpp/demo/Glacier2/winrt/chat/App.xaml.cpp b/cpp/demo/Glacier2/winrt/chat/App.xaml.cpp index 826dbb0322a..b8da2c53a10 100644 --- a/cpp/demo/Glacier2/winrt/chat/App.xaml.cpp +++ b/cpp/demo/Glacier2/winrt/chat/App.xaml.cpp @@ -34,8 +34,8 @@ using namespace Windows::UI::Xaml::Navigation; /// </summary>
App::App()
{
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}
/// <summary>
@@ -46,29 +46,29 @@ App::App() /// <param name="pArgs">Details about the launch request and process.</param>
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs)
{
- // Do not repeat app initialization when already running, just ensure that
- // the window is active
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
- {
- Window::Current->Activate();
- return;
- }
+ // Do not repeat app initialization when already running, just ensure that
+ // the window is active
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
+ {
+ Window::Current->Activate();
+ return;
+ }
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
- {
- //TODO: Load state from previously suspended application
- }
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
- // Create a Frame to act navigation context and navigate to the first page
- auto rootFrame = ref new Frame();
- if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
- {
- throw ref new FailureException("Failed to create initial page");
- }
+ // Create a Frame to act navigation context and navigate to the first page
+ auto rootFrame = ref new Frame();
+ if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
- // Place the frame in the current Window and ensure that it is active
- Window::Current->Content = rootFrame;
- Window::Current->Activate();
+ // Place the frame in the current Window and ensure that it is active
+ Window::Current->Content = rootFrame;
+ Window::Current->Activate();
}
/// <summary>
@@ -80,8 +80,8 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent /// <param name="e">Details about the suspend request.</param>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
- (void) sender; // Unused parameter
- (void) e; // Unused parameter
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
- //TODO: Save application state and stop any background activity
+ //TODO: Save application state and stop any background activity
}
diff --git a/cpp/demo/Glacier2/winrt/chat/App.xaml.h b/cpp/demo/Glacier2/winrt/chat/App.xaml.h index b1b6a271204..c70a3a6bdea 100644 --- a/cpp/demo/Glacier2/winrt/chat/App.xaml.h +++ b/cpp/demo/Glacier2/winrt/chat/App.xaml.h @@ -13,16 +13,16 @@ namespace chat
{
- /// <summary>
- /// Provides application-specific behavior to supplement the default Application class.
- /// </summary>
- ref class App sealed
- {
- public:
- App();
- virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
- private:
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
- };
+ private:
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+ };
}
diff --git a/cpp/demo/Ice/MFC/client/Resource.h b/cpp/demo/Ice/MFC/client/Resource.h index b35407d15ec..b35407d15ec 100755..100644 --- a/cpp/demo/Ice/MFC/client/Resource.h +++ b/cpp/demo/Ice/MFC/client/Resource.h diff --git a/cpp/demo/Ice/MFC/client/stdafx.cpp b/cpp/demo/Ice/MFC/client/stdafx.cpp index c751b964f14..c751b964f14 100755..100644 --- a/cpp/demo/Ice/MFC/client/stdafx.cpp +++ b/cpp/demo/Ice/MFC/client/stdafx.cpp diff --git a/cpp/demo/Ice/MFC/client/stdafx.h b/cpp/demo/Ice/MFC/client/stdafx.h index c7ab72d2085..c7ab72d2085 100755..100644 --- a/cpp/demo/Ice/MFC/client/stdafx.h +++ b/cpp/demo/Ice/MFC/client/stdafx.h diff --git a/cpp/demo/Ice/MFC/server/stdafx.h b/cpp/demo/Ice/MFC/server/stdafx.h index 89b2b07356d..89b2b07356d 100755..100644 --- a/cpp/demo/Ice/MFC/server/stdafx.h +++ b/cpp/demo/Ice/MFC/server/stdafx.h diff --git a/cpp/demo/Ice/interleaved/Client.cpp b/cpp/demo/Ice/interleaved/Client.cpp index a0ee3558e35..a0ee3558e35 100755..100644 --- a/cpp/demo/Ice/interleaved/Client.cpp +++ b/cpp/demo/Ice/interleaved/Client.cpp diff --git a/cpp/demo/Ice/interleaved/Server.cpp b/cpp/demo/Ice/interleaved/Server.cpp index ff698bd9b13..ff698bd9b13 100755..100644 --- a/cpp/demo/Ice/interleaved/Server.cpp +++ b/cpp/demo/Ice/interleaved/Server.cpp diff --git a/cpp/demo/Ice/interleaved/ThroughputI.cpp b/cpp/demo/Ice/interleaved/ThroughputI.cpp index 04545b73a1d..04545b73a1d 100755..100644 --- a/cpp/demo/Ice/interleaved/ThroughputI.cpp +++ b/cpp/demo/Ice/interleaved/ThroughputI.cpp diff --git a/cpp/demo/Ice/interleaved/ThroughputI.h b/cpp/demo/Ice/interleaved/ThroughputI.h index 2a3bde43aad..2a3bde43aad 100755..100644 --- a/cpp/demo/Ice/interleaved/ThroughputI.h +++ b/cpp/demo/Ice/interleaved/ThroughputI.h diff --git a/cpp/demo/Ice/nrvo/Client.cpp b/cpp/demo/Ice/nrvo/Client.cpp index bf17631e4bc..85dfe568643 100644 --- a/cpp/demo/Ice/nrvo/Client.cpp +++ b/cpp/demo/Ice/nrvo/Client.cpp @@ -69,59 +69,59 @@ NrvoClient::run(int argc, char* argv[]) cout << "==> "; cin >> c; - switch(c) - { - case '1': - { - cout << "calling op1" << endl; - MyStringSeq seq = nrvo->op1(); - break; - } - - case '2': - { - cout << "calling op2" << endl; - MyStringSeq seq = nrvo->op2(); - break; - } - - case '3': - { - cout << "calling op3(10)" << endl; - MyStringSeq seq = nrvo->op3(10); - break; - } - - case '4': - { - cout << "calling op3(0)" << endl; - MyStringSeq seq = nrvo->op3(0); - break; - } - - case 's': - { - nrvo->shutdown(); - break; - } - - case '?': - { - menu(); - break; - } - - case 'x': - { - break; - } - default: - { - cout << "unknown command `" << c << "'" << endl; - menu(); - break; - } - } + switch(c) + { + case '1': + { + cout << "calling op1" << endl; + MyStringSeq seq = nrvo->op1(); + break; + } + + case '2': + { + cout << "calling op2" << endl; + MyStringSeq seq = nrvo->op2(); + break; + } + + case '3': + { + cout << "calling op3(10)" << endl; + MyStringSeq seq = nrvo->op3(10); + break; + } + + case '4': + { + cout << "calling op3(0)" << endl; + MyStringSeq seq = nrvo->op3(0); + break; + } + + case 's': + { + nrvo->shutdown(); + break; + } + + case '?': + { + menu(); + break; + } + + case 'x': + { + break; + } + default: + { + cout << "unknown command `" << c << "'" << endl; + menu(); + break; + } + } } catch(const Ice::Exception& ex) { diff --git a/cpp/demo/Ice/nrvo/NrvoI.cpp b/cpp/demo/Ice/nrvo/NrvoI.cpp index 12052190d77..e7a27badf04 100644 --- a/cpp/demo/Ice/nrvo/NrvoI.cpp +++ b/cpp/demo/Ice/nrvo/NrvoI.cpp @@ -54,9 +54,9 @@ NrvoI::op3(int size, const Ice::Current&) if(size < 10) { // - // RVO (Return Value Optimization): return value - // is constructed in place. - // + // RVO (Return Value Optimization): return value + // is constructed in place. + // return MyStringSeq(size, "hello"); } diff --git a/cpp/demo/Ice/winrt/bidir/App.xaml.cpp b/cpp/demo/Ice/winrt/bidir/App.xaml.cpp index d3b64f4d024..e3354db363e 100644 --- a/cpp/demo/Ice/winrt/bidir/App.xaml.cpp +++ b/cpp/demo/Ice/winrt/bidir/App.xaml.cpp @@ -35,8 +35,8 @@ using namespace Windows::UI::Xaml::Navigation; /// </summary>
App::App()
{
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}
/// <summary>
@@ -47,29 +47,29 @@ App::App() /// <param name="pArgs">Details about the launch request and process.</param>
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs)
{
- // Do not repeat app initialization when already running, just ensure that
- // the window is active
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
- {
- Window::Current->Activate();
- return;
- }
+ // Do not repeat app initialization when already running, just ensure that
+ // the window is active
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
+ {
+ Window::Current->Activate();
+ return;
+ }
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
- {
- //TODO: Load state from previously suspended application
- }
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
- // Create a Frame to act navigation context and navigate to the first page
- auto rootFrame = ref new Frame();
- if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
- {
- throw ref new FailureException("Failed to create initial page");
- }
+ // Create a Frame to act navigation context and navigate to the first page
+ auto rootFrame = ref new Frame();
+ if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
- // Place the frame in the current Window and ensure that it is active
- Window::Current->Content = rootFrame;
- Window::Current->Activate();
+ // Place the frame in the current Window and ensure that it is active
+ Window::Current->Content = rootFrame;
+ Window::Current->Activate();
}
/// <summary>
@@ -81,8 +81,8 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent /// <param name="e">Details about the suspend request.</param>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
- (void) sender; // Unused parameter
- (void) e; // Unused parameter
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
- //TODO: Save application state and stop any background activity
+ //TODO: Save application state and stop any background activity
}
diff --git a/cpp/demo/Ice/winrt/bidir/App.xaml.h b/cpp/demo/Ice/winrt/bidir/App.xaml.h index 103a440e38e..5bbde84a051 100644 --- a/cpp/demo/Ice/winrt/bidir/App.xaml.h +++ b/cpp/demo/Ice/winrt/bidir/App.xaml.h @@ -13,16 +13,16 @@ namespace bidir
{
- /// <summary>
- /// Provides application-specific behavior to supplement the default Application class.
- /// </summary>
- ref class App sealed
- {
- public:
- App();
- virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
- private:
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
- };
+ private:
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+ };
}
diff --git a/cpp/demo/Ice/winrt/hello/App.xaml.cpp b/cpp/demo/Ice/winrt/hello/App.xaml.cpp index dd08ad621d1..a16d9293f9c 100644 --- a/cpp/demo/Ice/winrt/hello/App.xaml.cpp +++ b/cpp/demo/Ice/winrt/hello/App.xaml.cpp @@ -34,8 +34,8 @@ using namespace Windows::UI::Xaml::Navigation; /// </summary>
App::App()
{
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}
/// <summary>
@@ -46,29 +46,29 @@ App::App() /// <param name="pArgs">Details about the launch request and process.</param>
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs)
{
- // Do not repeat app initialization when already running, just ensure that
- // the window is active
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
- {
- Window::Current->Activate();
- return;
- }
+ // Do not repeat app initialization when already running, just ensure that
+ // the window is active
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
+ {
+ Window::Current->Activate();
+ return;
+ }
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
- {
- //TODO: Load state from previously suspended application
- }
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
- // Create a Frame to act navigation context and navigate to the first page
- auto rootFrame = ref new Frame();
- if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
- {
- throw ref new FailureException("Failed to create initial page");
- }
+ // Create a Frame to act navigation context and navigate to the first page
+ auto rootFrame = ref new Frame();
+ if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
- // Place the frame in the current Window and ensure that it is active
- Window::Current->Content = rootFrame;
- Window::Current->Activate();
+ // Place the frame in the current Window and ensure that it is active
+ Window::Current->Content = rootFrame;
+ Window::Current->Activate();
}
/// <summary>
@@ -80,8 +80,8 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent /// <param name="e">Details about the suspend request.</param>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
- (void) sender; // Unused parameter
- (void) e; // Unused parameter
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
- //TODO: Save application state and stop any background activity
+ //TODO: Save application state and stop any background activity
}
diff --git a/cpp/demo/Ice/winrt/hello/App.xaml.h b/cpp/demo/Ice/winrt/hello/App.xaml.h index 51301b382f9..28cc4a53cee 100644 --- a/cpp/demo/Ice/winrt/hello/App.xaml.h +++ b/cpp/demo/Ice/winrt/hello/App.xaml.h @@ -9,16 +9,16 @@ namespace hello
{
- /// <summary>
- /// Provides application-specific behavior to supplement the default Application class.
- /// </summary>
- ref class App sealed
- {
- public:
- App();
- virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
- private:
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
- };
+ private:
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+ };
}
diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp index 0200271a19c..0f088cadf3a 100644 --- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp @@ -25,7 +25,7 @@ getBasename(const string& path) string::size_type pos = path.rfind('/'); if(pos == string::npos) { - pos = path.rfind('\\'); + pos = path.rfind('\\'); } if(pos == string::npos) diff --git a/cpp/demo/IcePatch2/MFC/stdafx.h b/cpp/demo/IcePatch2/MFC/stdafx.h index d9ba470f8fc..d9ba470f8fc 100755..100644 --- a/cpp/demo/IcePatch2/MFC/stdafx.h +++ b/cpp/demo/IcePatch2/MFC/stdafx.h diff --git a/cpp/demo/IceStorm/counter/Server.cpp b/cpp/demo/IceStorm/counter/Server.cpp index 25066097498..3eeeaa8506a 100644 --- a/cpp/demo/IceStorm/counter/Server.cpp +++ b/cpp/demo/IceStorm/counter/Server.cpp @@ -43,7 +43,7 @@ Server::run(int argc, char* argv[]) Ice::PropertiesPtr properties = communicator()->getProperties(); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast( - communicator()->propertyToProxy("TopicManager.Proxy")); + communicator()->propertyToProxy("TopicManager.Proxy")); if(!manager) { cerr << appName() << ": invalid proxy" << endl; diff --git a/cpp/include/Ice/IconvStringConverter.h b/cpp/include/Ice/IconvStringConverter.h index ed197218699..19875a458cb 100644 --- a/cpp/include/Ice/IconvStringConverter.h +++ b/cpp/include/Ice/IconvStringConverter.h @@ -97,7 +97,7 @@ IconvStringConverter<charT>::IconvStringConverter(const char* internalCode) : // try { - close(createDescriptors()); + close(createDescriptors()); } catch(const Ice::StringConversionException& sce) { @@ -122,7 +122,7 @@ IconvStringConverter<charT>::IconvStringConverter(const char* internalCode) : if(rs != 0) { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); + throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); } #endif } @@ -144,7 +144,7 @@ IconvStringConverter<charT>::~IconvStringConverter() void* val = pthread_getspecific(_key); if(val != 0) { - cleanupKey(val); + cleanupKey(val); } if(pthread_key_delete(_key) != 0) { @@ -163,20 +163,20 @@ IconvStringConverter<charT>::createDescriptors() const cdp.first = iconv_open(_internalCode.c_str(), externalCode); if(cdp.first == iconv_t(-1)) { - throw Ice::StringConversionException( - __FILE__, __LINE__, - std::string("iconv cannot convert from ") - + externalCode + " to " + _internalCode); + throw Ice::StringConversionException( + __FILE__, __LINE__, + std::string("iconv cannot convert from ") + + externalCode + " to " + _internalCode); } cdp.second = iconv_open(externalCode, _internalCode.c_str()); if(cdp.second == iconv_t(-1)) { - iconv_close(cdp.first); + iconv_close(cdp.first); - throw Ice::StringConversionException( + throw Ice::StringConversionException( __FILE__, __LINE__, - std::string("iconv cannot convert from ") + _internalCode + " to " + externalCode); + std::string("iconv cannot convert from ") + _internalCode + " to " + externalCode); } return cdp; } @@ -191,25 +191,25 @@ IconvStringConverter<charT>::getDescriptors() const #endif if(val != 0) { - return *static_cast<std::pair<iconv_t, iconv_t>*>(val); + return *static_cast<std::pair<iconv_t, iconv_t>*>(val); } else { - std::pair<iconv_t, iconv_t> cdp = createDescriptors(); - + std::pair<iconv_t, iconv_t> cdp = createDescriptors(); + #ifdef _WIN32 if(TlsSetValue(_key, new std::pair<iconv_t, iconv_t>(cdp)) == 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } #else - int rs = pthread_setspecific(_key, new std::pair<iconv_t, iconv_t>(cdp)); - if(rs != 0) - { - throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); - } + int rs = pthread_setspecific(_key, new std::pair<iconv_t, iconv_t>(cdp)); + if(rs != 0) + { + throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs); + } #endif - return cdp; + return cdp; } } @@ -261,9 +261,9 @@ IconvStringConverter<charT>::toUTF8(const charT* sourceStart, const charT* sourc // do { - size_t howMany = std::max(inbytesleft, size_t(4)); - outbuf = reinterpret_cast<char*>(buf.getMoreBytes(howMany, reinterpret_cast<Ice::Byte*>(outbuf))); - count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &howMany); + size_t howMany = std::max(inbytesleft, size_t(4)); + outbuf = reinterpret_cast<char*>(buf.getMoreBytes(howMany, reinterpret_cast<Ice::Byte*>(outbuf))); + count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &howMany); #ifdef ICE_NO_ERRNO } while(count == size_t(-1)); #else @@ -279,14 +279,14 @@ IconvStringConverter<charT>::toUTF8(const charT* sourceStart, const charT* sourc msg = strerror(errno); } #endif - throw Ice::StringConversionException(__FILE__, __LINE__, msg); + throw Ice::StringConversionException(__FILE__, __LINE__, msg); } return reinterpret_cast<Ice::Byte*>(outbuf); } template<typename charT> void IconvStringConverter<charT>::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - std::basic_string<charT>& target) const + std::basic_string<charT>& target) const { iconv_t cd = getDescriptors().first; @@ -323,24 +323,24 @@ IconvStringConverter<charT>::fromUTF8(const Ice::Byte* sourceStart, const Ice::B // do { - size_t increment = std::max(inbytesleft * sizeof(wchar_t), size_t(8)); - bufsize += increment; - - char* newbuf = static_cast<char*>(realloc(buf, bufsize)); + size_t increment = std::max(inbytesleft * sizeof(wchar_t), size_t(8)); + bufsize += increment; + + char* newbuf = static_cast<char*>(realloc(buf, bufsize)); - if(newbuf == 0) - { - free(buf); - throw Ice::StringConversionException( - __FILE__, __LINE__, "Out of memory"); - } + if(newbuf == 0) + { + free(buf); + throw Ice::StringConversionException( + __FILE__, __LINE__, "Out of memory"); + } - outbuf = newbuf + (outbuf - buf); - outbytesleft += increment; + outbuf = newbuf + (outbuf - buf); + outbytesleft += increment; buf = newbuf; - - count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); + + count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); #ifdef ICE_NO_ERRNO } while(count == size_t(-1)); #else @@ -356,8 +356,8 @@ IconvStringConverter<charT>::fromUTF8(const Ice::Byte* sourceStart, const Ice::B msg = strerror(errno); } #endif - free(buf); - throw Ice::StringConversionException(__FILE__, __LINE__, msg); + free(buf); + throw Ice::StringConversionException(__FILE__, __LINE__, msg); } size_t length = (bufsize - outbytesleft) / sizeof(charT); diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 2bbc4b5a2d4..f142c51df71 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -78,7 +78,7 @@ public: LocalObjectPtr getCookie() const { - return _cookie; // No lock needed, cookie is immutable + return _cookie; // No lock needed, cookie is immutable } const std::string& getOperation() const @@ -409,10 +409,10 @@ public: virtual void __sent(const ::Ice::AsyncResultPtr& result) const { - if(sent) - { - (callback.get()->*sent)(result); - } + if(sent) + { + (callback.get()->*sent)(result); + } } virtual bool __hasSentCallback() const diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 75986833330..e9bc558a0ea 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -302,7 +302,7 @@ public: ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::CallbackPtr& __del, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, 0, __del, __cookie); } @@ -310,14 +310,14 @@ public: ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, &__ctx, __del, __cookie); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Callback_Object_ice_isAPtr& __del, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, 0, __del, __cookie); } @@ -325,7 +325,7 @@ public: ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_isAPtr& __del, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_isA(typeId, &__ctx, __del, __cookie); } @@ -481,7 +481,7 @@ public: ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::LocalObjectPtr& __cookie = 0) { return begin_ice_ids(&__ctx, __del, __cookie); } diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h index 29388ddbeec..3a54e8ab75f 100644 --- a/cpp/include/IceUtil/Cond.h +++ b/cpp/include/IceUtil/Cond.h @@ -242,13 +242,13 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const if(!ok) { - DWORD err = GetLastError(); - - if(err != ERROR_TIMEOUT) - { - throw ThreadSyscallException(__FILE__, __LINE__, err); - } - return false; + DWORD err = GetLastError(); + + if(err != ERROR_TIMEOUT) + { + throw ThreadSyscallException(__FILE__, __LINE__, err); + } + return false; } return true; } diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h index 59b1e42d406..abd8ed90b55 100644 --- a/cpp/include/IceUtil/Mutex.h +++ b/cpp/include/IceUtil/Mutex.h @@ -87,7 +87,7 @@ private: struct LockState { # ifdef ICE_HAS_WIN32_CONDVAR - CRITICAL_SECTION* mutex; + CRITICAL_SECTION* mutex; # endif }; #else diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 8d843856039..d4c2c29554e 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -21,11 +21,11 @@ // supports sparc (32 and 64 bit). #elif (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1 || __clang__) && \ - ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \ - defined(__APPLE__) || \ - (defined(__linux) && \ - (defined(__i486) || defined(__i586) || \ - defined(__i686) || defined(__x86_64)))) + ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \ + defined(__APPLE__) || \ + (defined(__linux) && \ + (defined(__i486) || defined(__i586) || \ + defined(__i686) || defined(__x86_64)))) # define ICE_HAS_GCC_BUILTINS diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp index c06b6a660fa..9b889541f3d 100644 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp +++ b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp @@ -301,12 +301,12 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit ObjectRecord& rec = element->rec; rec.servant = servant; - if(store->keepStats()) - { - rec.stats.creationTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - rec.stats.lastSaveTime = 0; - rec.stats.avgSaveTime = 0; - } + if(store->keepStats()) + { + rec.stats.creationTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); + rec.stats.lastSaveTime = 0; + rec.stats.avgSaveTime = 0; + } addToModifiedQueue(element); break; } @@ -1117,7 +1117,7 @@ Freeze::BackgroundSaveEvictorI::run() } Long saveStart = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - + try { DbTxn* tx = 0; @@ -1402,11 +1402,11 @@ Freeze::BackgroundSaveEvictorI::stream(const BackgroundSaveEvictorElementPtr& el if(element->status != destroyed) { - bool keepStats = obj.store->keepStats(); - if(keepStats) - { - EvictorIBase::updateStats(element->rec.stats, streamStart); - } + bool keepStats = obj.store->keepStats(); + if(keepStats) + { + EvictorIBase::updateStats(element->rec.stats, streamStart); + } ObjectStoreBase::marshal(element->rec, obj.value, _communicator, _encoding, keepStats); } } diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h index c2d5d93aa31..c2d5d93aa31 100755..100644 --- a/cpp/src/Freeze/EvictorI.h +++ b/cpp/src/Freeze/EvictorI.h diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index f59cc04e465..603d9ab35c6 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -376,7 +376,7 @@ Freeze::IteratorHelperI::IteratorHelperI(const MapHelperI& m, bool readOnly, #ifdef ICE_CPP11 _tx.reset(new Tx(_map)); #else - _tx = new Tx(_map); + _tx = new Tx(_map); #endif txn = _tx->getTxn(); } @@ -1045,12 +1045,12 @@ Freeze::MapHelperI::~MapHelperI() { try { - close(); + close(); } catch(const DatabaseException& ex) { - Ice::Error error(_connection->getCommunicator()->getLogger()); - error << "Freeze: closing map " << _dbName << " raised: " << ex; + Ice::Error error(_connection->getCommunicator()->getLogger()); + error << "Freeze: closing map " << _dbName << " raised: " << ex; } } @@ -1716,11 +1716,11 @@ Freeze::MapIndexI::~MapIndexI() { try { - _db->close(0); + _db->close(0); } catch(const DbException&) { - // Ignored + // Ignored } } diff --git a/cpp/src/Freeze/MapI.h b/cpp/src/Freeze/MapI.h index f6d3e7ded81..e414d77fc95 100644 --- a/cpp/src/Freeze/MapI.h +++ b/cpp/src/Freeze/MapI.h @@ -67,7 +67,7 @@ public: class Tx #ifndef ICE_CPP11 - : public IceUtil::SimpleShared + : public IceUtil::SimpleShared #endif { public: diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp index e8801a1b3c7..44a9fb2b02f 100644 --- a/cpp/src/Freeze/ObjectStore.cpp +++ b/cpp/src/Freeze/ObjectStore.cpp @@ -62,13 +62,13 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face if(p != catalog.end()) { if(p->second.evictor) - { - // - // empty means the value is ::Freeze::ObjectRecord - // - _keepStats = p->second.value.empty(); - } - else + { + // + // empty means the value is ::Freeze::ObjectRecord + // + _keepStats = p->second.value.empty(); + } + else { DatabaseException ex(__FILE__, __LINE__); ex.message = evictor->filename() + " is not an evictor database"; @@ -149,8 +149,8 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face { CatalogData catalogData; catalogData.evictor = true; - catalogData.key = "Ice::Identity"; - catalogData.value = "Object"; + catalogData.key = "Ice::Identity"; + catalogData.value = "Object"; catalog.put(Catalog::value_type(evictor->filename(), catalogData)); } @@ -214,8 +214,8 @@ Freeze::ObjectStoreBase::~ObjectStoreBase() } catch(const DbException& dx) { - Ice::Error error(_communicator->getLogger()); - error << "Freeze: closing ObjectStore " << _dbName << " raised DbException: " << dx.what(); + Ice::Error error(_communicator->getLogger()); + error << "Freeze: closing ObjectStore " << _dbName << " raised DbException: " << dx.what(); } } @@ -358,7 +358,7 @@ Freeze::ObjectStoreBase::marshal(const ObjectRecord& v, Value& bytes, const CommunicatorPtr& communicator, const EncodingVersion& encoding, - bool keepStats) + bool keepStats) { IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); IceInternal::BasicStream stream(instance.get(), encoding, true); @@ -369,7 +369,7 @@ Freeze::ObjectStoreBase::marshal(const ObjectRecord& v, } else { - stream.write(v.servant); + stream.write(v.servant); } stream.writePendingObjects(); @@ -382,7 +382,7 @@ Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v, const Value& bytes, const CommunicatorPtr& communicator, const EncodingVersion& encoding, - bool keepStats) + bool keepStats) { IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); IceInternal::BasicStream stream(instance.get(), encoding, true); @@ -398,7 +398,7 @@ Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v, } else { - stream.read(v.servant); + stream.read(v.servant); } stream.readPendingObjects(); diff --git a/cpp/src/Freeze/TransactionalEvictorContext.cpp b/cpp/src/Freeze/TransactionalEvictorContext.cpp index b2cbf130b80..4ff75ddd128 100644 --- a/cpp/src/Freeze/TransactionalEvictorContext.cpp +++ b/cpp/src/Freeze/TransactionalEvictorContext.cpp @@ -275,11 +275,11 @@ Freeze::TransactionalEvictorContext::ServantHolder::~ServantHolder() ICE_NOEXCEP { if(!_body.readOnly && !_body.removed) { - if(_body.store->keepStats()) - { - EvictorIBase::updateStats(_body.rec.stats, - IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds()); - } + if(_body.store->keepStats()) + { + EvictorIBase::updateStats(_body.rec.stats, + IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds()); + } _body.store->update(_body.current->id, _body.rec, ctx->_tx); } diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp index e24c5006111..c3d641cf00b 100644 --- a/cpp/src/Freeze/TransactionalEvictorI.cpp +++ b/cpp/src/Freeze/TransactionalEvictorI.cpp @@ -150,7 +150,7 @@ Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity if(store->keepStats()) { - currentTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); + currentTime = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); } Statistics stats = { currentTime }; @@ -160,7 +160,7 @@ Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity if(store->keepStats()) { - updateStats(rec.stats, currentTime); + updateStats(rec.stats, currentTime); } if(!store->insert(ident, rec, tx)) @@ -430,7 +430,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) if(operationAttributes < 0) { - throw OperationNotExistException(__FILE__, __LINE__); + throw OperationNotExistException(__FILE__, __LINE__); } bool readOnly = (operationAttributes & 0x1) == 0; @@ -477,7 +477,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) default: { assert(0); - throw OperationNotExistException(__FILE__, __LINE__); + throw OperationNotExistException(__FILE__, __LINE__); } } diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp index b2da041ec3d..27aef7b463d 100755..100644 --- a/cpp/src/FreezeScript/DumpDB.cpp +++ b/cpp/src/FreezeScript/DumpDB.cpp @@ -357,8 +357,8 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator if(inputFile.empty()) { const string evictorKeyTypeName = "::Ice::Identity"; - const string oldEvictorValueTypeName = "::Freeze::ObjectRecord"; - const string newEvictorValueTypeName = "Object"; + const string oldEvictorValueTypeName = "::Freeze::ObjectRecord"; + const string newEvictorValueTypeName = "Object"; if((!keyTypeName.empty() && valueTypeName.empty()) || (keyTypeName.empty() && !valueTypeName.empty() && !evictor)) { @@ -388,32 +388,32 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator { evictor = true; } - keyTypeName = p->second.key; - valueTypeName = p->second.value; + keyTypeName = p->second.key; + valueTypeName = p->second.value; - if(evictor && valueTypeName.empty()) - { - valueTypeName = oldEvictorValueTypeName; - } + if(evictor && valueTypeName.empty()) + { + valueTypeName = oldEvictorValueTypeName; + } } } catch(const FreezeScript::FailureException& ex) { - cerr << appName << ": " << ex.reason() << endl; - return EXIT_FAILURE; + cerr << appName << ": " << ex.reason() << endl; + return EXIT_FAILURE; } } if(evictor) { - if(keyTypeName.empty()) - { - keyTypeName = evictorKeyTypeName; - } - if(valueTypeName.empty()) - { - valueTypeName = newEvictorValueTypeName; - } + if(keyTypeName.empty()) + { + keyTypeName = evictorKeyTypeName; + } + if(valueTypeName.empty()) + { + valueTypeName = newEvictorValueTypeName; + } } Slice::TypePtr keyType, valueType; diff --git a/cpp/src/FreezeScript/TransformVisitor.cpp b/cpp/src/FreezeScript/TransformVisitor.cpp index 86dd1a72bd4..4a5d4c6ff98 100755..100644 --- a/cpp/src/FreezeScript/TransformVisitor.cpp +++ b/cpp/src/FreezeScript/TransformVisitor.cpp @@ -529,7 +529,7 @@ FreezeScript::TransformVisitor::transformObject(const ObjectDataPtr& dest, const objectDataMap.erase(p); #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) - objectDataMap.insert(ObjectDataMap::value_type(src.get(), nullptr)); + objectDataMap.insert(ObjectDataMap::value_type(src.get(), nullptr)); #else objectDataMap.insert(ObjectDataMap::value_type(src.get(), 0)); #endif diff --git a/cpp/src/FreezeScript/Transformer.cpp b/cpp/src/FreezeScript/Transformer.cpp index 3d699d65491..3fda2cf467e 100755..100644 --- a/cpp/src/FreezeScript/Transformer.cpp +++ b/cpp/src/FreezeScript/Transformer.cpp @@ -2652,7 +2652,7 @@ FreezeScript::ObjectVisitor::visitObject(const ObjectRefPtr& data) #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) _map.insert(ObjectDataMap::value_type(value.get(), nullptr)); #else - _map.insert(ObjectDataMap::value_type(value.get(), 0)); + _map.insert(ObjectDataMap::value_type(value.get(), 0)); #endif DataMemberMap& members = value->getMembers(); for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q) diff --git a/cpp/src/FreezeScript/transformdb.cpp b/cpp/src/FreezeScript/transformdb.cpp index f4583394b5c..8de1709ae4a 100755..100644 --- a/cpp/src/FreezeScript/transformdb.cpp +++ b/cpp/src/FreezeScript/transformdb.cpp @@ -490,8 +490,8 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors); const string evictorKeyName = "::Ice::Identity"; - const string oldEvictorValueName = "::Freeze::ObjectRecord"; - const string newEvictorValueName = "Object"; + const string oldEvictorValueName = "::Freeze::ObjectRecord"; + const string newEvictorValueName = "Object"; if(allDb) { @@ -507,14 +507,14 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator keyName = p->second.key; valueName = p->second.value; - if(keyName.empty()) - { - keyName = evictorKeyName; - } - if(valueName.empty()) - { - valueName = oldEvictorValueName; - } + if(keyName.empty()) + { + keyName = evictorKeyName; + } + if(valueName.empty()) + { + valueName = oldEvictorValueName; + } } else { @@ -544,18 +544,18 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator << "' not found in old Slice definitions" << endl; } - Slice::TypePtr newValueType; - if(p->second.evictor) - { - // - // The new evictor does not keep stats - // - newValueType = findType(newUnit, newEvictorValueName); - } - else - { - newValueType = findType(newUnit, valueName); - } + Slice::TypePtr newValueType; + if(p->second.evictor) + { + // + // The new evictor does not keep stats + // + newValueType = findType(newUnit, newEvictorValueName); + } + else + { + newValueType = findType(newUnit, valueName); + } if(!newValueType) { @@ -576,44 +576,44 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator { return EXIT_FAILURE; } - + analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType); } } else { string oldKeyName, newKeyName, oldValueName, newValueName; - - string::size_type pos; - - if(!evictor && (keyTypeNames.empty() || valueTypeNames.empty())) - { - usage(appName); - return EXIT_FAILURE; - } - - if(!keyTypeNames.empty()) - { - pos = keyTypeNames.find(','); - if(pos == 0 || pos == keyTypeNames.size()) - { - usage(appName); - return EXIT_FAILURE; - } - if(pos == string::npos) - { - oldKeyName = keyTypeNames; - newKeyName = keyTypeNames; - } + + string::size_type pos; + + if(!evictor && (keyTypeNames.empty() || valueTypeNames.empty())) + { + usage(appName); + return EXIT_FAILURE; + } + + if(!keyTypeNames.empty()) + { + pos = keyTypeNames.find(','); + if(pos == 0 || pos == keyTypeNames.size()) + { + usage(appName); + return EXIT_FAILURE; + } + if(pos == string::npos) + { + oldKeyName = keyTypeNames; + newKeyName = keyTypeNames; + } else { oldKeyName = keyTypeNames.substr(0, pos); newKeyName = keyTypeNames.substr(pos + 1); } - } + } - if(!valueTypeNames.empty()) - { + if(!valueTypeNames.empty()) + { pos = valueTypeNames.find(','); if(pos == 0 || pos == valueTypeNames.size()) { @@ -631,26 +631,26 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator newValueName = valueTypeNames.substr(pos + 1); } } - - if(evictor) - { - if(oldKeyName.empty()) - { - oldKeyName = evictorKeyName; - } - if(newKeyName.empty()) - { - newKeyName = evictorKeyName; - } - if(oldValueName.empty()) - { - oldValueName = newEvictorValueName; - } - if(newValueName.empty()) - { - newValueName = newEvictorValueName; - } - } + + if(evictor) + { + if(oldKeyName.empty()) + { + oldKeyName = evictorKeyName; + } + if(newKeyName.empty()) + { + newKeyName = evictorKeyName; + } + if(oldValueName.empty()) + { + oldValueName = newEvictorValueName; + } + if(newValueName.empty()) + { + newValueName = newEvictorValueName; + } + } // // Look up the key and value types in the old and new Slice definitions. diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index 3c7098e3968..3c7098e3968 100755..100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp diff --git a/cpp/src/Glacier2/ProxyVerifier.cpp b/cpp/src/Glacier2/ProxyVerifier.cpp index a1c3943b31f..a1c3943b31f 100755..100644 --- a/cpp/src/Glacier2/ProxyVerifier.cpp +++ b/cpp/src/Glacier2/ProxyVerifier.cpp diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index 23ab5baaed2..23ab5baaed2 100755..100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 027d42b39c8..65fa68986d5 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -330,7 +330,7 @@ Ice::Application::main(int argc, char* argv[], const char* configFile) catch(const std::exception& ex) { Error out(getProcessLogger()); - out << ex; + out << ex; return EXIT_FAILURE; } catch(...) diff --git a/cpp/src/Ice/Base64.cpp b/cpp/src/Ice/Base64.cpp index 187ea5b13dd..187ea5b13dd 100755..100644 --- a/cpp/src/Ice/Base64.cpp +++ b/cpp/src/Ice/Base64.cpp diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index cd32101f980..cd32101f980 100755..100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 78963794398..78963794398 100755..100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp diff --git a/cpp/src/Ice/EventLoggerMsg.h b/cpp/src/Ice/EventLoggerMsg.h index 5934c1f104f..5934c1f104f 100755..100644 --- a/cpp/src/Ice/EventLoggerMsg.h +++ b/cpp/src/Ice/EventLoggerMsg.h diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 9a58ee47ab7..f8f09b5a81c 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -27,9 +27,9 @@ struct Property const char* deprecatedBy; Property(const char* n, bool d, const char* b) : - pattern(n), - deprecated(d), - deprecatedBy(b) + pattern(n), + deprecated(d), + deprecatedBy(b) { } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index e2196926685..8f519f5ca55 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -161,7 +161,7 @@ Ice::AsyncResultPtr IceProxy::Ice::Object::begin_ice_isA(const string& typeId, const Context* ctx, const ::IceInternal::CallbackBasePtr& del, - const ::Ice::LocalObjectPtr& cookie) + const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_isA_name, del, cookie); __checkAsyncTwowayOnly(ice_isA_name); diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index 232a155602e..140eb8759f4 100644 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -632,10 +632,10 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa } else { - if(argv[0]) - { - cerr << argv[0] << ": "; - } + if(argv[0]) + { + cerr << argv[0] << ": "; + } cerr << "--pidfile must be followed by an argument" << endl; return EXIT_FAILURE; } @@ -654,20 +654,20 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa if(!closeFiles && !daemonize) { - if(argv[0]) + if(argv[0]) { - cerr << argv[0] << ": "; - } + cerr << argv[0] << ": "; + } cerr << "--noclose must be used with --daemon" << endl; return EXIT_FAILURE; } if(pidFile.size() > 0 && !daemonize) { - if(argv[0]) + if(argv[0]) { - cerr << argv[0] << ": "; - } + cerr << argv[0] << ": "; + } cerr << "--pidfile <file> must be used with --daemon" << endl; return EXIT_FAILURE; } diff --git a/cpp/src/Ice/winrt/StreamEndpointI.cpp b/cpp/src/Ice/winrt/StreamEndpointI.cpp index d8279281e15..0b37f5d4fbf 100644 --- a/cpp/src/Ice/winrt/StreamEndpointI.cpp +++ b/cpp/src/Ice/winrt/StreamEndpointI.cpp @@ -65,7 +65,7 @@ private: IceInternal::StreamEndpointI::StreamEndpointI(const InstancePtr& instance, Ice::Short type, const string& ho, Int po, Int ti, const Ice::ProtocolVersion& protocol, - const Ice::EncodingVersion& encoding, const string& conId, bool co) : + const Ice::EncodingVersion& encoding, const string& conId, bool co) : EndpointI(protocol, encoding, conId), _instance(instance), _type(type), diff --git a/cpp/src/Ice/winrt/StreamEndpointI.h b/cpp/src/Ice/winrt/StreamEndpointI.h index 91ad87a81a5..8ebc7e3e5e1 100644 --- a/cpp/src/Ice/winrt/StreamEndpointI.h +++ b/cpp/src/Ice/winrt/StreamEndpointI.h @@ -23,7 +23,7 @@ class StreamEndpointI : public EndpointI public: StreamEndpointI(const InstancePtr&, Ice::Short, const std::string&, Ice::Int, Ice::Int, - const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::string&, bool); + const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::string&, bool); StreamEndpointI(const InstancePtr&, Ice::Short, const std::string&, bool); StreamEndpointI(BasicStream*, Ice::Short); diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index bcc8ee77576..ea4e7e3e502 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -231,7 +231,7 @@ stringToSignal(const string& str) } else #endif - if(str == ICE_STRING(SIGKILL)) + if(str == ICE_STRING(SIGKILL)) { return SIGKILL; } @@ -248,10 +248,10 @@ stringToSignal(const string& str) if(*end == '\0' && signal > 0 && signal < 64) { #ifdef _WIN32 - if(signal == SIGKILL || signal == SIGTERM) - { - return static_cast<int>(signal); - } + if(signal == SIGKILL || signal == SIGTERM) + { + return static_cast<int>(signal); + } #else return static_cast<int>(signal); #endif diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 052957900ac..a234e57ea83 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -787,7 +787,7 @@ Client::getPassword(const string& prompt) char c; while((c = _getch()) != '\r') { - password += c; + password += c; } #endif cout << endl; diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index c2d69d64e05..d2313b1ca39 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -971,22 +971,22 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const ServiceDescriptorPtr s = p->descriptor; const string path = _session->getInfo()->dataDir + "/servers/" + server->id + "/config/config_" + s->name; - // - // We escape the path here because the command-line option --Ice.Config=xxx will be parsed an encoded + // + // We escape the path here because the command-line option --Ice.Config=xxx will be parsed an encoded // (escaped) property - // For example, \\server\dir\file.cfg needs to become \\\server\dir\file.cfg or \\\\server\\dir\\file.cfg. - // + // For example, \\server\dir\file.cfg needs to become \\\server\dir\file.cfg or \\\\server\\dir\\file.cfg. + // props.push_back(createProperty("IceBox.Service." + s->name, s->entry + " --Ice.Config='" - + escapeProperty(path) + "'")); + + escapeProperty(path) + "'")); - if(servicesStr.empty()) - { - servicesStr = s->name; - } - else - { - servicesStr += " " + s->name; - } + if(servicesStr.empty()) + { + servicesStr = s->name; + } + else + { + servicesStr += " " + s->name; + } } if(!hasProperty(info.descriptor->propertySet.properties, "IceBox.InstanceName")) { diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index 661de383582..6d219f98b9b 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -88,7 +88,7 @@ public: virtual void run() { - _platform.runUpdateLoadInfo(); + _platform.runUpdateLoadInfo(); } private: @@ -304,7 +304,7 @@ PlatformInfo::PlatformInfo(const string& prefix, _nProcessorSockets = ids.size(); #else // Not supported - _nProcessorSockets = 1; + _nProcessorSockets = 1; #endif } @@ -373,9 +373,9 @@ PlatformInfo::stop() { #if defined(_WIN32) { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_utilizationMonitor); - _terminated = true; - _utilizationMonitor.notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_utilizationMonitor); + _terminated = true; + _utilizationMonitor.notify(); } assert(_updateUtilizationThread); @@ -543,7 +543,7 @@ PlatformInfo::runUpdateLoadInfo() } catch(const Ice::LocalException&) { - // No need to print a warning, it's taken care of by getLocalizedPerfName + // No need to print a warning, it's taken care of by getLocalizedPerfName PdhCloseQuery(query); return; } @@ -563,14 +563,14 @@ PlatformInfo::runUpdateLoadInfo() while(true) { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_utilizationMonitor); - _utilizationMonitor.timedWait(IceUtil::Time::seconds(5)); // 5 seconds. - if(_terminated) - { - break; - } - - int usage = 100; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_utilizationMonitor); + _utilizationMonitor.timedWait(IceUtil::Time::seconds(5)); // 5 seconds. + if(_terminated) + { + break; + } + + int usage = 100; PDH_STATUS err = PdhCollectQueryData(query); if(err == ERROR_SUCCESS) { @@ -584,17 +584,17 @@ PlatformInfo::runUpdateLoadInfo() Ice::Warning out(_traceLevels->logger); out << "Could not collect performance counter data:\n" << pdhErrorToString(err); } - - _last1Total += usage - _usages1.back(); - _last5Total += usage - _usages5.back(); - _last15Total += usage - _usages15.back(); - - _usages1.pop_back(); - _usages5.pop_back(); - _usages15.pop_back(); - _usages1.push_front(usage); - _usages5.push_front(usage); - _usages15.push_front(usage); + + _last1Total += usage - _usages1.back(); + _last5Total += usage - _usages5.back(); + _last15Total += usage - _usages15.back(); + + _usages1.pop_back(); + _usages5.pop_back(); + _usages15.pop_back(); + _usages1.push_front(usage); + _usages5.push_front(usage); + _usages15.push_front(usage); } PdhCloseQuery(query); diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 08d844a608f..06330a9cc30 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -348,11 +348,11 @@ RegistryI::startImpl() registryTopicManagerId.category = _instanceName; registryTopicManagerId.name = "RegistryTopicManager"; _iceStorm = IceStormInternal::Service::create(_communicator, - registryAdapter, - registryAdapter, - "IceGrid.Registry", - registryTopicManagerId, - "Registry"); + registryAdapter, + registryAdapter, + "IceGrid.Registry", + registryTopicManagerId, + "Registry"); const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager(); // diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 852c45c31f1..cc4dcf35145 100755..100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -1480,7 +1480,7 @@ ServerI::adapterDeactivated(const string& id) Lock sync(*this); while(_state == ServerI::Activating) { - wait(); // Wait for activate() to set the state to WaitForActivation + wait(); // Wait for activate() to set the state to WaitForActivation } if((_state == Active || _state == WaitForActivation) && @@ -2547,11 +2547,11 @@ ServerI::checkAndUpdateUser(const InternalServerDescriptorPtr& desc, bool update } - if(pw->pw_uid == 0 && - _node->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Node.AllowRunningServersAsRoot") == 0) - { - throw "running server as `root' is not allowed"; - } + if(pw->pw_uid == 0 && + _node->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Node.AllowRunningServersAsRoot") == 0) + { + throw "running server as `root' is not allowed"; + } if(update) { diff --git a/cpp/src/IceGrid/SessionServantManager.cpp b/cpp/src/IceGrid/SessionServantManager.cpp index 6de78e2bab0..0b2d61640d3 100755..100644 --- a/cpp/src/IceGrid/SessionServantManager.cpp +++ b/cpp/src/IceGrid/SessionServantManager.cpp @@ -18,7 +18,7 @@ using namespace IceGrid; SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapter, const string& instanceName, - bool checkConnection, + bool checkConnection, const string& serverAdminCategory, const Ice::ObjectPtr& serverAdminRouter, const AdminCallbackRouterPtr& adminCallbackRouter) : diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp index cc13cd3804e..2349f0ee503 100644 --- a/cpp/src/IceGrid/Util.cpp +++ b/cpp/src/IceGrid/Util.cpp @@ -111,64 +111,64 @@ IceGrid::escapeProperty(const string& s, bool escapeEqual) switch(c) { case ' ': - { - // - // We only escape the space character when it's at the beginning - // or at the end of the string - // - if(i < firstChar || i > lastChar) - { - if(previousCharIsEscape) - { - result.push_back('\\'); // escape the previous char, by adding another escape. - } + { + // + // We only escape the space character when it's at the beginning + // or at the end of the string + // + if(i < firstChar || i > lastChar) + { + if(previousCharIsEscape) + { + result.push_back('\\'); // escape the previous char, by adding another escape. + } - result.push_back('\\'); - } - result.push_back(c); - previousCharIsEscape = false; - break; - } + result.push_back('\\'); + } + result.push_back(c); + previousCharIsEscape = false; + break; + } - case '\\': + case '\\': case '#': case '=': - { - if(c == '=' && !escapeEqual) - { - previousCharIsEscape = false; - } - else - { - // - // We only escape the \ character when it is followed by a - // character that we escape, e.g. \# is encoded as \\\#, not \# - // and \\server is encoded as \\\server. - // - if(previousCharIsEscape) - { - result.push_back('\\'); // escape the previous char, by adding another escape. - } - if(c == '\\') - { - previousCharIsEscape = true; // deferring the potential escaping to the next loop - } - else - { - result.push_back('\\'); - previousCharIsEscape = false; - } - } - result.push_back(c); - break; - } + { + if(c == '=' && !escapeEqual) + { + previousCharIsEscape = false; + } + else + { + // + // We only escape the \ character when it is followed by a + // character that we escape, e.g. \# is encoded as \\\#, not \# + // and \\server is encoded as \\\server. + // + if(previousCharIsEscape) + { + result.push_back('\\'); // escape the previous char, by adding another escape. + } + if(c == '\\') + { + previousCharIsEscape = true; // deferring the potential escaping to the next loop + } + else + { + result.push_back('\\'); + previousCharIsEscape = false; + } + } + result.push_back(c); + break; + } default: - { - result.push_back(c); - previousCharIsEscape = false; - break; - } + { + result.push_back(c); + previousCharIsEscape = false; + break; + } } } return result; diff --git a/cpp/src/IceGrid/Util.h b/cpp/src/IceGrid/Util.h index 9ba84619693..9ba84619693 100755..100644 --- a/cpp/src/IceGrid/Util.h +++ b/cpp/src/IceGrid/Util.h diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp index f94c00a4197..f94c00a4197 100755..100644 --- a/cpp/src/IcePatch2/Calc.cpp +++ b/cpp/src/IcePatch2/Calc.cpp diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp index 666b8d121de..666b8d121de 100755..100644 --- a/cpp/src/IcePatch2/FileServerI.cpp +++ b/cpp/src/IcePatch2/FileServerI.cpp diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp index 3e829cc3867..3e829cc3867 100755..100644 --- a/cpp/src/IcePatch2Lib/ClientUtil.cpp +++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp diff --git a/cpp/src/IcePatch2Lib/Util.cpp b/cpp/src/IcePatch2Lib/Util.cpp index 5031718739e..5031718739e 100755..100644 --- a/cpp/src/IcePatch2Lib/Util.cpp +++ b/cpp/src/IcePatch2Lib/Util.cpp diff --git a/cpp/src/IceStorm/NodeI.cpp b/cpp/src/IceStorm/NodeI.cpp index 20da26fdb6b..1693ec694a9 100644 --- a/cpp/src/IceStorm/NodeI.cpp +++ b/cpp/src/IceStorm/NodeI.cpp @@ -853,13 +853,13 @@ NodeI::ready(int j, const string& gn, const Ice::ObjectPrx& coordinator, int max if(!_destroy && _state == NodeStateReorganization && _group == gn) { // The coordinator must be j (this was set in the invitation). - if(_coord != j) - { - Ice::Warning warn(_traceLevels->logger); - warn << _traceLevels->electionCat << ": ignoring ready call from replica node " << j - << " (real coordinator is " << _coord << ")"; - return; - } + if(_coord != j) + { + Ice::Warning warn(_traceLevels->logger); + warn << _traceLevels->electionCat << ": ignoring ready call from replica node " << j + << " (real coordinator is " << _coord << ")"; + return; + } // Here we've already validated j in the invite call // (otherwise _group != gn). @@ -923,8 +923,8 @@ NodeI::accept(int j, const string& gn, const Ice::IntSeq& forwardedInvites, cons out << *p; } out << ") with llu " - << llu.generation << "/" << llu.iteration << " into group " << gn - << " group size " << (_up.size() + 1); + << llu.generation << "/" << llu.iteration << " into group " << gn + << " group size " << (_up.size() + 1); } // Add each of the forwarded invites to the list of issued @@ -946,7 +946,7 @@ NodeI::accept(int j, const string& gn, const Ice::IntSeq& forwardedInvites, cons // merge continue immediately. Otherwise, we let the existing // merge() schedule continue. if((_up.size() == _nodes.size()-1 || _invitesIssued == _invitesAccepted) && - _mergeContinueTask && _timer->cancel(_mergeContinueTask)) + _mergeContinueTask && _timer->cancel(_mergeContinueTask)) { _timer->schedule(_mergeContinueTask, IceUtil::Time::seconds(0)); } diff --git a/cpp/src/IceStorm/NodeI.h b/cpp/src/IceStorm/NodeI.h index f32de3a5d6a..3e6ac1efe64 100644 --- a/cpp/src/IceStorm/NodeI.h +++ b/cpp/src/IceStorm/NodeI.h @@ -41,7 +41,7 @@ public: virtual void invitation(int, const std::string&, const Ice::Current&); virtual void ready(int, const std::string&, const Ice::ObjectPrx&, int, Ice::Long, const Ice::Current&); virtual void accept(int, const std::string&, const Ice::IntSeq&, const Ice::ObjectPrx&, const LogUpdate&, int, - const Ice::Current&); + const Ice::Current&); virtual bool areYouCoordinator(const Ice::Current&) const; virtual bool areYouThere(const std::string&, int, const Ice::Current&) const; virtual Ice::ObjectPrx sync(const Ice::Current&) const; diff --git a/cpp/src/IceStorm/Replica.h b/cpp/src/IceStorm/Replica.h index be76437a499..3a0ffc93c99 100644 --- a/cpp/src/IceStorm/Replica.h +++ b/cpp/src/IceStorm/Replica.h @@ -27,7 +27,7 @@ struct GroupNodeInfo // COMPILER FIX: Clang using libc++ requires to define operator= // #if defined(__clang__) && defined(_LIBCPP_VERSION) - GroupNodeInfo& operator=(const GroupNodeInfo&); + GroupNodeInfo& operator=(const GroupNodeInfo&); #endif const int id; const LogUpdate llu; diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp index 95ea74c6265..95ea74c6265 100755..100644 --- a/cpp/src/IceStorm/Subscriber.cpp +++ b/cpp/src/IceStorm/Subscriber.cpp diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index 7f1ea6b67b9..460e291c0ef 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -670,7 +670,7 @@ TopicImpl::subscribe(const QoS& origQoS, const Ice::ObjectPrx& obj) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } Ice::IdentitySeq ids; ids.push_back(id); @@ -708,7 +708,7 @@ TopicImpl::subscribe(const QoS& origQoS, const Ice::ObjectPrx& obj) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _subscribers.push_back(subscriber); @@ -792,7 +792,7 @@ TopicImpl::subscribeAndGetPublisher(const QoS& qos, const Ice::ObjectPrx& obj) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _subscribers.push_back(subscriber); @@ -916,7 +916,7 @@ TopicImpl::link(const TopicPrx& topic, Ice::Int cost) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _subscribers.push_back(subscriber); @@ -995,7 +995,7 @@ TopicImpl::shutdown() // Shutdown each subscriber. This waits for the event queues to drain. for(vector<SubscriberPtr>::const_iterator p = _subscribers.begin(); p != _subscribers.end(); ++p) { - (*p)->shutdown(); + (*p)->shutdown(); } _observer.detach(); @@ -1326,7 +1326,7 @@ TopicImpl::observerAddSubscriber(const LogUpdate& llu, const SubscriberRecord& r catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _subscribers.push_back(subscriber); @@ -1397,7 +1397,7 @@ TopicImpl::observerRemoveSubscriber(const LogUpdate& llu, const Ice::IdentitySeq catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } } @@ -1444,7 +1444,7 @@ TopicImpl::updateSubscriberObservers() IceUtil::Mutex::Lock sync(_subscribersMutex); for(vector<SubscriberPtr>::const_iterator p = _subscribers.begin(); p != _subscribers.end(); ++p) { - (*p)->updateObserver(); + (*p)->updateObserver(); } } @@ -1497,7 +1497,7 @@ TopicImpl::destroyInternal(const LogUpdate& origLLU, bool master) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _instance->topicAdapter()->remove(_id); @@ -1570,7 +1570,7 @@ TopicImpl::removeSubscribers(const Ice::IdentitySeq& ids) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _instance->observers()->removeSubscriber(llu, _name, ids); diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp index 9601d004481..6c13513a608 100644 --- a/cpp/src/IceStorm/TopicManagerI.cpp +++ b/cpp/src/IceStorm/TopicManagerI.cpp @@ -413,7 +413,7 @@ TopicManagerImpl::create(const string& name) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } _instance->observers()->createTopic(llu, name); @@ -529,7 +529,7 @@ TopicManagerImpl::observerInit(const LogUpdate& llu, const TopicContentSeq& cont catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } // We do this with two scans. The first runs through the topics @@ -628,7 +628,7 @@ TopicManagerImpl::observerCreateTopic(const LogUpdate& llu, const string& name) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } installTopic(name, id, true); } @@ -716,7 +716,7 @@ TopicManagerImpl::getContent(LogUpdate& llu, TopicContentSeq& content) catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } } @@ -803,7 +803,7 @@ TopicManagerImpl::initMaster(const set<GroupNodeInfo>& slaves, const LogUpdate& catch(const DatabaseException& ex) { halt(_instance->communicator(), ex); - } + } } // Now initialize the observers. diff --git a/cpp/src/IceStorm/TransientTopicI.cpp b/cpp/src/IceStorm/TransientTopicI.cpp index 25ecb67e32c..fb65e2400d7 100644 --- a/cpp/src/IceStorm/TransientTopicI.cpp +++ b/cpp/src/IceStorm/TransientTopicI.cpp @@ -580,6 +580,6 @@ TransientTopicImpl::shutdown() // Shutdown each subscriber. This waits for the event queues to drain. for(vector<SubscriberPtr>::const_iterator p = _subscribers.begin(); p != _subscribers.end(); ++p) { - (*p)->shutdown(); + (*p)->shutdown(); } } diff --git a/cpp/src/IceUtil/Shared.cpp b/cpp/src/IceUtil/Shared.cpp index 0ce3b28b66c..39805cc746e 100644 --- a/cpp/src/IceUtil/Shared.cpp +++ b/cpp/src/IceUtil/Shared.cpp @@ -36,9 +36,9 @@ namespace IceUtilInternal static inline void atomicInc(volatile int* counter) { __asm__ __volatile__( - "lock ; incl %0" - :"=m" (*counter) - :"m" (*counter)); + "lock ; incl %0" + :"=m" (*counter) + :"m" (*counter)); } /** @@ -55,9 +55,9 @@ static inline int atomicDecAndTest(volatile int* counter) { unsigned char c; __asm__ __volatile__( - "lock ; decl %0; sete %1" - :"=m" (*counter), "=qm" (c) - :"m" (*counter) : "memory"); + "lock ; decl %0; sete %1" + :"=m" (*counter), "=qm" (c) + :"m" (*counter) : "memory"); return c != 0; } @@ -72,10 +72,10 @@ static inline int atomicExchangeAdd(volatile int* counter, int i) { int tmp = i; __asm__ __volatile__( - "lock ; xadd %0,(%2)" - :"+r"(tmp), "=m"(*counter) - :"r"(counter), "m"(*counter) - : "memory"); + "lock ; xadd %0,(%2)" + :"+r"(tmp), "=m"(*counter) + :"r"(counter), "m"(*counter) + : "memory"); return tmp + i; } diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index ec54ef9cf9c..c862e5c236e 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -570,20 +570,20 @@ IceUtilInternal::errorToString(int error, LPCVOID source) result = result.substr(0, result.length() - 2); } #ifndef ICE_OS_WINRT - if(msg) - { + if(msg) + { LocalFree(msg); - } + } #endif return IceUtil::wstringToString(result); } else { #ifndef ICE_OS_WINRT - if(msg) - { + if(msg) + { LocalFree(msg); - } + } #endif ostringstream os; os << "unknown error: " << error; diff --git a/cpp/src/IceUtil/UUID.cpp b/cpp/src/IceUtil/UUID.cpp index cb2d77a1992..4bef2ba2116 100644 --- a/cpp/src/IceUtil/UUID.cpp +++ b/cpp/src/IceUtil/UUID.cpp @@ -98,7 +98,7 @@ IceUtil::generateUUID() RPC_STATUS ret = UuidCreate(&uuid); if(ret != RPC_S_OK && ret != RPC_S_UUID_LOCAL_ONLY && ret != RPC_S_UUID_NO_ADDRESS) { - throw new SyscallException(__FILE__, __LINE__, GetLastError()); + throw new SyscallException(__FILE__, __LINE__, GetLastError()); } unsigned char* str; @@ -106,7 +106,7 @@ IceUtil::generateUUID() ret = UuidToString(&uuid, &str); if(ret != RPC_S_OK) { - throw new SyscallException(__FILE__, __LINE__, GetLastError()); + throw new SyscallException(__FILE__, __LINE__, GetLastError()); } string result = reinterpret_cast<char*>(str); diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 086e839b195..403fc9b15b5 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -1006,12 +1006,12 @@ Slice::findMetaData(const StringList& metaData, int typeCtx) { string::size_type pos = str.find(':', prefix.size()); - // + // // If the form is cpp:type:<...> the data after cpp:type: // is returned. - // If the form is cpp:range[:<...>], cpp:array or cpp:class, - // the return value is % followed by the string after cpp:. - // + // If the form is cpp:range[:<...>], cpp:array or cpp:class, + // the return value is % followed by the string after cpp:. + // if(pos != string::npos) { string ss = str.substr(prefix.size()); diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index cf9597e2e91..699bcb37c0e 100644 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -2117,12 +2117,12 @@ Slice::CsGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) continue; } emitWarning(file, -1, "ignoring invalid global metadata `" + s + "'"); - _history.insert(s); + _history.insert(s); } else if(s.find(clrPrefix) == 0) { emitWarning(file, -1, "ignoring invalid global metadata `" + s + "'"); - _history.insert(s); + _history.insert(s); } } } diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 881353ef07b..1a5b0829618 100755..100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -2205,10 +2205,10 @@ Slice::Container::checkIdentifier(const string& name) const static const string suffixBlacklist[] = { "Helper", "Holder", "Prx", "Ptr" }; for(size_t i = 0; i < sizeof(suffixBlacklist) / sizeof(*suffixBlacklist); ++i) { - if(name.find(suffixBlacklist[i], name.size() - suffixBlacklist[i].size()) != string::npos) - { - _unit->error("illegal identifier `" + name + "': `" + suffixBlacklist[i] + "' suffix is reserved"); - } + if(name.find(suffixBlacklist[i], name.size() - suffixBlacklist[i].size()) != string::npos) + { + _unit->error("illegal identifier `" + name + "': `" + suffixBlacklist[i] + "' suffix is reserved"); + } } // diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 4fd9a510ee1..4fd9a510ee1 100755..100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index 558f4d42623..558f4d42623 100755..100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp index 7fddc88f59c..20178ea72c8 100644 --- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp +++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp @@ -64,7 +64,7 @@ IceServiceInstaller::IceServiceInstaller(int serviceType, const string& configFi } else { - Ice::LocatorPrx defaultLocator = LocatorPrx::uncheckedCast( + Ice::LocatorPrx defaultLocator = LocatorPrx::uncheckedCast( _communicator->stringToProxy(_serviceProperties->getProperty("Ice.Default.Locator"))); if(defaultLocator != 0) { diff --git a/cpp/src/slice2confluence/Gen.cpp b/cpp/src/slice2confluence/Gen.cpp index 42425db59cd..42425db59cd 100755..100644 --- a/cpp/src/slice2confluence/Gen.cpp +++ b/cpp/src/slice2confluence/Gen.cpp diff --git a/cpp/src/slice2confluence/Main.cpp b/cpp/src/slice2confluence/Main.cpp index 346daddcf8f..346daddcf8f 100755..100644 --- a/cpp/src/slice2confluence/Main.cpp +++ b/cpp/src/slice2confluence/Main.cpp diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 80f6b7deab1..7a93d08ebb4 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -369,7 +369,7 @@ Slice::Gen::generate(const UnitPtr& p) H << "\n#include <Ice/Proxy.h>"; H << "\n#include <Ice/Object.h>"; H << "\n#include <Ice/Outgoing.h>"; - H << "\n#include <Ice/OutgoingAsync.h>"; + H << "\n#include <Ice/OutgoingAsync.h>"; H << "\n#include <Ice/Incoming.h>"; if(p->hasContentsWithMetaData("amd")) { @@ -1481,14 +1481,14 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) if(_dllExport != "") { - // - // To export the virtual table - // - C << nl << "#ifdef __SUNPRO_CC"; - C << nl << "class " - << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") - << "IceProxy" << scoped << ";"; - C << nl << "#endif"; + // + // To export the virtual table + // + C << nl << "#ifdef __SUNPRO_CC"; + C << nl << "class " + << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") + << "IceProxy" << scoped << ";"; + C << nl << "#endif"; } C << nl @@ -2141,7 +2141,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) string flatName = p->flattenedScope() + name + "_name"; if(p->returnsData()) { - C << nl << "__checkAsyncTwowayOnly(" << flatName << ");"; + C << nl << "__checkAsyncTwowayOnly(" << flatName << ");"; } C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, "; C << flatName << ", __del, __cookie);"; @@ -3320,7 +3320,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) if(p->name() != "PointerType") { - H << nl << "typedef " << p->name() << "Ptr PointerType;"; + H << nl << "typedef " << p->name() << "Ptr PointerType;"; } vector<string> params; @@ -3479,36 +3479,36 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) if(!p->isLocal()) { C << sp << nl - << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") - << "::Ice::Object* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }"; - - // - // It would make sense to provide a covariant ice_clone(); unfortunately many compilers - // (including VS2010) generate bad code for covariant types that use virtual inheritance - // - - if(!p->isInterface()) - { - H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;"; - - C << nl << "::Ice::ObjectPtr"; - C << nl << scoped.substr(2) << "::ice_clone() const"; - C << sb; - if(!p->isAbstract()) - { - C << nl << "::Ice::Object* __p = new " << name << "(*this);"; - C << nl << "return __p;"; - } - else - { - // - // We need this ice_clone for abstract classes derived from concrete classes - // - C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);"; - C << nl << "return 0; // to avoid a warning with some compilers"; - } - C << eb; - } + << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") + << "::Ice::Object* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }"; + + // + // It would make sense to provide a covariant ice_clone(); unfortunately many compilers + // (including VS2010) generate bad code for covariant types that use virtual inheritance + // + + if(!p->isInterface()) + { + H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;"; + + C << nl << "::Ice::ObjectPtr"; + C << nl << scoped.substr(2) << "::ice_clone() const"; + C << sb; + if(!p->isAbstract()) + { + C << nl << "::Ice::Object* __p = new " << name << "(*this);"; + C << nl << "return __p;"; + } + else + { + // + // We need this ice_clone for abstract classes derived from concrete classes + // + C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);"; + C << nl << "return 0; // to avoid a warning with some compilers"; + } + C << eb; + } ClassList allBases = p->allBases(); StringList ids; @@ -3597,8 +3597,8 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) else { C << sp << nl - << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") - << "::Ice::LocalObject* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }"; + << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ") + << "::Ice::LocalObject* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }"; } return true; @@ -4049,7 +4049,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) else { C << sp << nl << "void " - << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT "); + << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT "); C << nl << scope.substr(2) << "__patch(" << p->name() << "Ptr& handle, ::Ice::ObjectPtr& v)"; C << sb; C << nl << "handle = " << scope << p->name() << "Ptr::dynamicCast(v);"; diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h index a8ff7998842..9695fa56e98 100644 --- a/cpp/src/slice2cs/Gen.h +++ b/cpp/src/slice2cs/Gen.h @@ -150,7 +150,7 @@ private: virtual void visitModuleEnd(const ModulePtr&); virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); - virtual void visitOperation(const OperationPtr&); + virtual void visitOperation(const OperationPtr&); }; class ProxyVisitor : public CsVisitor diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index bd639993f40..bd639993f40 100755..100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 08eed8b4cf6..295846612c9 100755..100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -1804,7 +1804,7 @@ Slice::StartPageGenerator::printHeaderFooter() if(!imageDir.empty()) { - start("td align=\"right\""); + start("td align=\"right\""); start("table"); start("tr"); start("td"); @@ -1821,7 +1821,7 @@ Slice::StartPageGenerator::printHeaderFooter() end(); // td end(); // tr end(); // table - end(); // td + end(); // td } end(); // tr diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index 4d4dba8d0e9..4d4dba8d0e9 100755..100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index 1c4525123c5..edac3b40b14 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -72,7 +72,7 @@ populateDB(const Freeze::ConnectionPtr& connection, ByteIntMap& m) TransactionHolder txHolder(connection); for(size_t j = 0; j < length; ++j) { - m.put(ByteIntMap::value_type(localAlphabet[j], static_cast<Int>(j))); + m.put(ByteIntMap::value_type(localAlphabet[j], static_cast<Int>(j))); } txHolder.commit(); break; @@ -98,14 +98,14 @@ public: ReadThread(const CommunicatorPtr& communicator, const string& envName, const string& dbName) : _connection(createConnection(communicator, envName)), _map(_connection, dbName), - _done(false) + _done(false) { } virtual void run() { - bool more = false; + bool more = false; do { @@ -138,18 +138,18 @@ public: } } - { - IceUtil::Mutex::Lock lock(_doneMutex); - more = !_done; - } + { + IceUtil::Mutex::Lock lock(_doneMutex); + more = !_done; + } - } while(more); + } while(more); } void stop() { - IceUtil::Mutex::Lock lock(_doneMutex); - _done = true; + IceUtil::Mutex::Lock lock(_doneMutex); + _done = true; } private: @@ -170,14 +170,14 @@ public: WriteThread(const CommunicatorPtr& communicator, const string& envName, const string& dbName) : _connection(createConnection(communicator, envName)), _map(_connection, dbName), - _done(false) + _done(false) { } virtual void run() { - bool more = false; + bool more = false; // // Delete an recreate each object @@ -195,7 +195,7 @@ public: _map.erase(p); } txHolder.commit(); - break; // for (;;) + break; // for (;;) } catch(const DeadlockException&) { @@ -216,81 +216,81 @@ public: } populateDB(_connection, _map); - - // - // Now update without a transaction - // - - for(char c = 'a'; c != 'd'; ++c) - { - for(;;) - { - bool thrownBySet = false; - try - { - ByteIntMap::iterator p = _map.find(c); - try - { - if(p != _map.end()) - { - if(p->first == p->second + 'a') - { - p.set(p->first - 'A'); - } - else - { - p.set(p->first - 'a'); - } - } - } - catch(const DeadlockException&) - { - thrownBySet = true; - throw; - } - break; // for (;;) - } - catch(const DeadlockException&) - { - if(!thrownBySet) - { - cerr << "DeadlockException thrown by destructor!" << endl; - test(false); - } - + + // + // Now update without a transaction + // + + for(char c = 'a'; c != 'd'; ++c) + { + for(;;) + { + bool thrownBySet = false; + try + { + ByteIntMap::iterator p = _map.find(c); + try + { + if(p != _map.end()) + { + if(p->first == p->second + 'a') + { + p.set(p->first - 'A'); + } + else + { + p.set(p->first - 'a'); + } + } + } + catch(const DeadlockException&) + { + thrownBySet = true; + throw; + } + break; // for (;;) + } + catch(const DeadlockException&) + { + if(!thrownBySet) + { + cerr << "DeadlockException thrown by destructor!" << endl; + test(false); + } + #ifdef SHOW_EXCEPTIONS - if(thrownBySet) - { - cerr << "S" << flush; - } - else - { - cerr << "D" << flush; - } + if(thrownBySet) + { + cerr << "S" << flush; + } + else + { + cerr << "D" << flush; + } #endif - // Try again - } - catch(const InvalidPositionException&) - { + // Try again + } + catch(const InvalidPositionException&) + { #ifdef SHOW_EXCEPTIONS - cerr << "I" << flush; + cerr << "I" << flush; #endif - break; - } - } - } - - { - IceUtil::Mutex::Lock lock(_doneMutex); - more = !_done; - } + break; + } + } + } + + { + IceUtil::Mutex::Lock lock(_doneMutex); + more = !_done; + } } while(more); } void stop() { - IceUtil::Mutex::Lock lock(_doneMutex); - _done = true; + IceUtil::Mutex::Lock lock(_doneMutex); + _done = true; } private: @@ -729,23 +729,23 @@ run(const CommunicatorPtr& communicator, const string& envName) { ReadThreadPtr rt = new ReadThread(communicator, envName, dbName); controls.push_back(rt->start()); - readThreads.push_back(rt); + readThreads.push_back(rt); WriteThreadPtr wt = new WriteThread(communicator, envName, dbName); controls.push_back(wt->start()); - writeThreads.push_back(wt); + writeThreads.push_back(wt); } IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(CONCURRENT_TIME)); for(vector<WriteThreadPtr>::iterator q = writeThreads.begin(); q != writeThreads.end(); ++q) { - (*q)->stop(); + (*q)->stop(); } for(vector<ReadThreadPtr>::iterator q = readThreads.begin(); q != readThreads.end(); ++q) { - (*q)->stop(); + (*q)->stop(); } for(vector<IceUtil::ThreadControl>::iterator q = controls.begin(); q != controls.end(); ++q) diff --git a/cpp/test/Freeze/evictor/Client.cpp b/cpp/test/Freeze/evictor/Client.cpp index 1dc38845e76..be7f8493939 100644 --- a/cpp/test/Freeze/evictor/Client.cpp +++ b/cpp/test/Freeze/evictor/Client.cpp @@ -372,12 +372,12 @@ public: // // Transfer 100 at random between two distinct accounts // - Test::AccountPrx from = _accounts[IceUtilInternal::random(static_cast<int>(_accounts.size()))]; + Test::AccountPrx from = _accounts[IceUtilInternal::random(static_cast<int>(_accounts.size()))]; Test::AccountPrx to; do { - to = _accounts[IceUtilInternal::random(static_cast<int>(_accounts.size()))]; + to = _accounts[IceUtilInternal::random(static_cast<int>(_accounts.size()))]; } while(from == to); @@ -613,8 +613,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, bool trans // try { - Test::AccountPrx::uncheckedCast(servants[0])->getBalance(); - test(false); + Test::AccountPrx::uncheckedCast(servants[0])->getBalance(); + test(false); } catch(const Ice::OperationNotExistException&) { diff --git a/cpp/test/Glacier2/override/Client.cpp b/cpp/test/Glacier2/override/Client.cpp index d35f638d37f..9945f1f05c0 100644 --- a/cpp/test/Glacier2/override/Client.cpp +++ b/cpp/test/Glacier2/override/Client.cpp @@ -155,21 +155,21 @@ CallbackClient::run(int argc, char* argv[]) callbackReceiverImpl->activate(); test(callbackReceiverImpl->callbackWithPayloadOK(4) == 0); - int remainingCallbacks = callbackReceiverImpl->callbackOK(1, 0); - // - // Occasionally, Glacier2 flushes in the middle of our 5 - // callbacks, so we get more than 1 callback - // (in theory we could get up to 5 total - more than 1 extra is extremely unlikely) - // - // The sleep above is also important as we want to have enough - // time to receive this (these) extra callback(s). - // - test(remainingCallbacks <= 4); - if(remainingCallbacks > 0) - { - test(callbackReceiverImpl->callbackOK(remainingCallbacks, 0) == 0); - } - + int remainingCallbacks = callbackReceiverImpl->callbackOK(1, 0); + // + // Occasionally, Glacier2 flushes in the middle of our 5 + // callbacks, so we get more than 1 callback + // (in theory we could get up to 5 total - more than 1 extra is extremely unlikely) + // + // The sleep above is also important as we want to have enough + // time to receive this (these) extra callback(s). + // + test(remainingCallbacks <= 4); + if(remainingCallbacks > 0) + { + test(callbackReceiverImpl->callbackOK(remainingCallbacks, 0) == 0); + } + ctx["_fwd"] = "O"; oneway->initiateCallbackWithPayload(twowayR); diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp index f9d746cfb95..f9d746cfb95 100755..100644 --- a/cpp/test/Ice/custom/AllTests.cpp +++ b/cpp/test/Ice/custom/AllTests.cpp diff --git a/cpp/test/Ice/invoke/BlobjectI.cpp b/cpp/test/Ice/invoke/BlobjectI.cpp index 7d7d3612a43..7d7d3612a43 100755..100644 --- a/cpp/test/Ice/invoke/BlobjectI.cpp +++ b/cpp/test/Ice/invoke/BlobjectI.cpp diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 4f83d4b0fbe..85f5062c958 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -400,7 +400,7 @@ allTests(const Ice::CommunicatorPtr& communicator) IceMX::MetricsView view = clientMetrics->getMetricsView("View", timestamp); test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && view["Connection"][0]->total == 1); test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount && - view["Thread"][0]->total == threadCount); + view["Thread"][0]->total == threadCount); cout << "ok" << endl; cout << "testing group by id..." << flush; diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index d1eb70a22de..0acf1cc340d 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -98,8 +98,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) AbstractBasePtr abp1 = new AbstractBaseI; try { - abp1->ice_clone(); - test(false); + abp1->ice_clone(); + test(false); } catch(const Ice::CloneNotImplementedException&) { diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index a51f098457a..a51f098457a 100755..100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index dd8b755edf3..dd8b755edf3 100755..100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index a451acb0887..d59e18810d8 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -797,7 +797,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } } #endif - } + } { Ice::Double d = 1278312346.0 / 13.0; diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 5fd79282d58..5e1c54e6df5 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -977,10 +977,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } { - // + // // Check that a call to a twoway operation raises NoEndpointException // in the ice_exception() callback instead of at the point of call. - // + // Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI; try @@ -1004,9 +1004,9 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } { - // + // // Check that CommunicatorDestroyedException is raised directly. - // + // Ice::InitializationData initData; initData.properties = communicator->getProperties()->clone(); Ice::CommunicatorPtr ic = Ice::initialize(initData); diff --git a/cpp/test/Ice/properties/Client.cpp b/cpp/test/Ice/properties/Client.cpp index b7b1ff02799..b7b1ff02799 100755..100644 --- a/cpp/test/Ice/properties/Client.cpp +++ b/cpp/test/Ice/properties/Client.cpp diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index 949f2770746..71b7c0b2685 100755..100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -150,7 +150,7 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) MyClassFactoryWrapperPtr factoryWrapper = new MyClassFactoryWrapper; communicator->addObjectFactory(factoryWrapper, Test::MyClass::ice_staticId()); communicator->addObjectFactory(new MyInterfaceFactory, Test::MyInterface::ice_staticId()); - + Ice::InputStreamPtr in; Ice::OutputStreamPtr out; vector<Ice::Byte> data; diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index a6b8ed7a811..048e2bf8f86 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -86,11 +86,11 @@ main(int argc, char* argv[]) #elif defined(__hpux) if(useLocale) { - initData.stringConverter = new Ice::IconvStringConverter<char>; + initData.stringConverter = new Ice::IconvStringConverter<char>; } else { - initData.stringConverter = new Ice::IconvStringConverter<char>("iso815"); + initData.stringConverter = new Ice::IconvStringConverter<char>("iso815"); } initData.wstringConverter = new Ice::IconvStringConverter<wchar_t>("ucs4"); #else @@ -98,12 +98,12 @@ main(int argc, char* argv[]) if(useLocale) { #ifndef _WIN32 - initData.stringConverter = new Ice::IconvStringConverter<char>; + initData.stringConverter = new Ice::IconvStringConverter<char>; #endif } else { - initData.stringConverter = new Ice::IconvStringConverter<char>("ISO8859-15"); + initData.stringConverter = new Ice::IconvStringConverter<char>("ISO8859-15"); } if(sizeof(wchar_t) == 4) diff --git a/cpp/test/IceStorm/rep1/Publisher.cpp b/cpp/test/IceStorm/rep1/Publisher.cpp index 62770b8632a..7671da08ec7 100644 --- a/cpp/test/IceStorm/rep1/Publisher.cpp +++ b/cpp/test/IceStorm/rep1/Publisher.cpp @@ -82,15 +82,15 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) Ice::ObjectPrx prx = topic->getPublisher()->ice_twoway(); vector<SinglePrx> single; Ice::EndpointSeq endpoints = prx->ice_getEndpoints(); - for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) - { + for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) + { if((*p)->toString().substr(0, 3) != "udp") { Ice::EndpointSeq e; e.push_back(*p); single.push_back(SinglePrx::uncheckedCast(prx->ice_endpoints(e))); } - } + } if(single.size() <= 1) { cerr << argv[0] << ": Not enough endpoints in publisher proxy" << endl; diff --git a/cpp/test/IceStorm/repstress/Publisher.cpp b/cpp/test/IceStorm/repstress/Publisher.cpp index 9f3eff6d7ca..76948483085 100644 --- a/cpp/test/IceStorm/repstress/Publisher.cpp +++ b/cpp/test/IceStorm/repstress/Publisher.cpp @@ -54,7 +54,7 @@ public: try { _single->event(_published); - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); } catch(const Ice::UnknownException&) { diff --git a/cpp/test/IceUtil/condvar/WorkQueue.cpp b/cpp/test/IceUtil/condvar/WorkQueue.cpp index 7d093b7279e..e3f91c6a396 100644 --- a/cpp/test/IceUtil/condvar/WorkQueue.cpp +++ b/cpp/test/IceUtil/condvar/WorkQueue.cpp @@ -28,21 +28,21 @@ public: void decrement() { Monitor<Mutex>::Lock lock(*this); - assert(_count > 0); - --_count; - if(_count == 0) - { - notifyAll(); - } + assert(_count > 0); + --_count; + if(_count == 0) + { + notifyAll(); + } } void waitZero() { Monitor<Mutex>::Lock lock(*this); - while(_count > 0) - { - wait(); - } + while(_count > 0) + { + wait(); + } } private: @@ -80,7 +80,7 @@ public: { Monitor<Mutex>::Lock lock(*this); _terminate = true; - notifyAll(); + notifyAll(); } bool @@ -105,10 +105,10 @@ public: assert(!_q.empty()); ret = _q.front(); - if(ret % 100 == 0) - { - cout << "." << flush; - } + if(ret % 100 == 0) + { + cout << "." << flush; + } _q.pop_front(); return true; } @@ -126,16 +126,16 @@ public: // empty. if(_q.empty()) { - assert(_terminate); + assert(_terminate); return -1; } assert(!_q.empty()); int ret = _q.front(); - if(ret % 100 == 0) - { - cout << "." << flush; - } + if(ret % 100 == 0) + { + cout << "." << flush; + } _q.pop_front(); return ret; } @@ -158,18 +158,18 @@ public: virtual void run() { - _cd->decrement(); + _cd->decrement(); while(true) { int res = 0; - if(_poll) - { - _q->timedGet(res, Time::milliSeconds(10)); - } - else - { - res = _q->get(); - } + if(_poll) + { + _q->timedGet(res, Time::milliSeconds(10)); + } + else + { + res = _q->get(); + } if(res == -1) { return; @@ -196,14 +196,14 @@ public: virtual void run() { - _cd->decrement(); + _cd->decrement(); // Forever if(_v == 0) { while(true) { _q->put(_v++); - ThreadControl::yield(); + ThreadControl::yield(); } } else diff --git a/cpp/test/WinRT/TestSuite/App.xaml.cpp b/cpp/test/WinRT/TestSuite/App.xaml.cpp index 45902d60d63..9272b941977 100644 --- a/cpp/test/WinRT/TestSuite/App.xaml.cpp +++ b/cpp/test/WinRT/TestSuite/App.xaml.cpp @@ -30,8 +30,8 @@ using namespace Windows::UI::Xaml::Navigation; /// </summary>
App::App()
{
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}
/// <summary>
@@ -42,29 +42,29 @@ App::App() /// <param name="pArgs">Details about the launch request and process.</param>
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs)
{
- // Do not repeat app initialization when already running, just ensure that
- // the window is active
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
- {
- Window::Current->Activate();
- return;
- }
+ // Do not repeat app initialization when already running, just ensure that
+ // the window is active
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Running)
+ {
+ Window::Current->Activate();
+ return;
+ }
- if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
- {
- //TODO: Load state from previously suspended application
- }
+ if (pArgs->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
- // Create a Frame to act navigation context and navigate to the first page
- auto rootFrame = ref new Frame();
- if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
- {
- throw ref new FailureException("Failed to create initial page");
- }
+ // Create a Frame to act navigation context and navigate to the first page
+ auto rootFrame = ref new Frame();
+ if (!rootFrame->Navigate(TypeName(MainPage::typeid)))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
- // Place the frame in the current Window and ensure that it is active
- Window::Current->Content = rootFrame;
- Window::Current->Activate();
+ // Place the frame in the current Window and ensure that it is active
+ Window::Current->Content = rootFrame;
+ Window::Current->Activate();
}
/// <summary>
@@ -76,8 +76,8 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent /// <param name="e">Details about the suspend request.</param>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
- (void) sender; // Unused parameter
- (void) e; // Unused parameter
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
- //TODO: Save application state and stop any background activity
+ //TODO: Save application state and stop any background activity
}
diff --git a/cpp/test/WinRT/TestSuite/App.xaml.h b/cpp/test/WinRT/TestSuite/App.xaml.h index d7cd0e08434..4fd9ca3458b 100644 --- a/cpp/test/WinRT/TestSuite/App.xaml.h +++ b/cpp/test/WinRT/TestSuite/App.xaml.h @@ -9,16 +9,16 @@ namespace TestSuite
{
- /// <summary>
- /// Provides application-specific behavior to supplement the default Application class.
- /// </summary>
- ref class App sealed
- {
- public:
- App();
- virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) override;
- private:
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
- };
+ private:
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+ };
}
diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp index 6dc1c29aef2..c9f02fa6d24 100644 --- a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp +++ b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp @@ -323,7 +323,7 @@ public: if(_test.server) { printLineToConsoleOutput("*** running test " + _test.name); - runClientServerTest(_test.server, _test.client); + runClientServerTest(_test.server, _test.client); printLineToConsoleOutput(""); } else @@ -454,7 +454,7 @@ MainPage::MainPage() void MainPage::OnNavigatedTo(NavigationEventArgs^ e) { - (void) e; // Unused parameter + (void) e; // Unused parameter } @@ -515,5 +515,5 @@ MainPage::runSelectedTest() TestRunnerPtr t = new TestRunner(allTest[TestList->SelectedIndex], config); t->start(); - t->getThreadControl().detach(); + t->getThreadControl().detach(); } diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml.h b/cpp/test/WinRT/TestSuite/MainPage.xaml.h index a49f4b546bc..096f8583fcc 100644 --- a/cpp/test/WinRT/TestSuite/MainPage.xaml.h +++ b/cpp/test/WinRT/TestSuite/MainPage.xaml.h @@ -28,7 +28,7 @@ public: void failed(Platform::String^ reason); protected: - + virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override; private: diff --git a/cs/demo/Ice/properties/Server.cs b/cs/demo/Ice/properties/Server.cs index 93b649b554c..147a77133b7 100644 --- a/cs/demo/Ice/properties/Server.cs +++ b/cs/demo/Ice/properties/Server.cs @@ -23,7 +23,7 @@ public class Server : Ice.Application public PropsI() { _called = false; - _monitor = new IceUtilInternal.Monitor(); + _monitor = new IceUtilInternal.Monitor(); } override public Dictionary<string, string> getChanges(Ice.Current current) @@ -61,7 +61,7 @@ public class Server : Ice.Application Dictionary<string, string> _changes; private bool _called; - IceUtilInternal.Monitor _monitor; + IceUtilInternal.Monitor _monitor; } override public int run(string[] args) diff --git a/cs/demo/IceGrid/icebox/HelloI.cs b/cs/demo/IceGrid/icebox/HelloI.cs index 36d1dae01d4..cfd96523ec3 100644 --- a/cs/demo/IceGrid/icebox/HelloI.cs +++ b/cs/demo/IceGrid/icebox/HelloI.cs @@ -19,7 +19,7 @@ public class HelloI : HelloDisp_ public override void sayHello(Ice.Current current) { #if COMPACT || SILVERLIGHT - string lang = "en"; + string lang = "en"; #else string lang = System.Environment.GetEnvironmentVariable("LANG") != null ? System.Environment.GetEnvironmentVariable("LANG") : "en"; diff --git a/cs/src/Ice/ByteBuffer.cs b/cs/src/Ice/ByteBuffer.cs index c7c1127ea36..5fb80ecbbde 100644 --- a/cs/src/Ice/ByteBuffer.cs +++ b/cs/src/Ice/ByteBuffer.cs @@ -280,7 +280,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public short getShort() { @@ -288,10 +288,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - _valBytes.shortVal = *((short*)p); - } + fixed(byte* p = &_bytes[_position]) + { + _valBytes.shortVal = *((short*)p); + } #else _valBytes.b0 = _bytes[_position]; _valBytes.b1 = _bytes[_position + 1]; @@ -328,7 +328,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public ByteBuffer putShort(short val) { @@ -337,10 +337,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - *((short*)p) = _valBytes.shortVal; - } + fixed(byte* p = &_bytes[_position]) + { + *((short*)p) = _valBytes.shortVal; + } #else _bytes[_position] = _valBytes.b0; _bytes[_position + 1] = _valBytes.b1; @@ -378,7 +378,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public int getInt() { @@ -386,10 +386,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - _valBytes.intVal = *((int*)p); - } + fixed(byte* p = &_bytes[_position]) + { + _valBytes.intVal = *((int*)p); + } #else _valBytes.b0 = _bytes[_position]; _valBytes.b1 = _bytes[_position + 1]; @@ -439,7 +439,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public ByteBuffer putInt(int pos, int val) { @@ -455,10 +455,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[pos]) - { - *((int*)p) = _valBytes.intVal; - } + fixed(byte* p = &_bytes[pos]) + { + *((int*)p) = _valBytes.intVal; + } #else _bytes[pos] = _valBytes.b0; _bytes[pos + 1] = _valBytes.b1; @@ -501,7 +501,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public long getLong() { @@ -509,10 +509,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - _valBytes.longVal = *((long*)p); - } + fixed(byte* p = &_bytes[_position]) + { + _valBytes.longVal = *((long*)p); + } #else _valBytes.b0 = _bytes[_position]; _valBytes.b1 = _bytes[_position + 1]; @@ -567,7 +567,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public ByteBuffer putLong(long val) { @@ -576,10 +576,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - *((long*)p) = _valBytes.longVal; - } + fixed(byte* p = &_bytes[_position]) + { + *((long*)p) = _valBytes.longVal; + } #else _bytes[_position] = _valBytes.b0; _bytes[_position + 1] = _valBytes.b1; @@ -635,7 +635,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public float getFloat() { @@ -643,10 +643,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - _valBytes.floatVal = *((float*)p); - } + fixed(byte* p = &_bytes[_position]) + { + _valBytes.floatVal = *((float*)p); + } #else _valBytes.b0 = _bytes[_position]; _valBytes.b1 = _bytes[_position + 1]; @@ -689,7 +689,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public ByteBuffer putFloat(float val) { @@ -698,10 +698,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - *((float*)p) = _valBytes.floatVal; - } + fixed(byte* p = &_bytes[_position]) + { + *((float*)p) = _valBytes.floatVal; + } #else _bytes[_position] = _valBytes.b0; _bytes[_position + 1] = _valBytes.b1; @@ -745,7 +745,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public double getDouble() { @@ -753,10 +753,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - _valBytes.doubleVal = *((double*)p); - } + fixed(byte* p = &_bytes[_position]) + { + _valBytes.doubleVal = *((double*)p); + } #else _valBytes.b0 = _bytes[_position]; _valBytes.b1 = _bytes[_position + 1]; @@ -811,7 +811,7 @@ namespace IceInternal } #if !MANAGED && !COMPACT && !SILVERLIGHT - unsafe + unsafe #endif public ByteBuffer putDouble(double val) { @@ -820,10 +820,10 @@ namespace IceInternal if(NO._o == _order) { #if !MANAGED && !COMPACT && !SILVERLIGHT - fixed(byte* p = &_bytes[_position]) - { - *((double*)p) = _valBytes.doubleVal; - } + fixed(byte* p = &_bytes[_position]) + { + *((double*)p) = _valBytes.doubleVal; + } #else _bytes[_position] = _valBytes.b0; _bytes[_position + 1] = _valBytes.b1; diff --git a/cs/src/Ice/Compare.cs b/cs/src/Ice/Compare.cs index 7ab77649296..4ebd33da119 100644 --- a/cs/src/Ice/Compare.cs +++ b/cs/src/Ice/Compare.cs @@ -55,42 +55,42 @@ namespace Ice // public static bool Equals(System.Collections.IDictionary d1, System.Collections.IDictionary d2) { - try - { + try + { bool result; if(cheapComparison(d1, d2, out result)) { return result; } - System.Collections.ICollection keys1 = d1.Keys; - foreach(object k in keys1) - { - if(d2.Contains(k)) - { - object v1 = d1[k]; - object v2 = d2[k]; - if(v1 == null) - { - if(v2 != null) - { - return false; - } - } - else - { - if(!v1.Equals(v2)) - { - return false; - } - } - } - else - { - return false; - } - } - } + System.Collections.ICollection keys1 = d1.Keys; + foreach(object k in keys1) + { + if(d2.Contains(k)) + { + object v1 = d1[k]; + object v2 = d2[k]; + if(v1 == null) + { + if(v2 != null) + { + return false; + } + } + else + { + if(!v1.Equals(v2)) + { + return false; + } + } + } + else + { + return false; + } + } + } catch(System.Exception) { return false; diff --git a/cs/src/Ice/Incoming.cs b/cs/src/Ice/Incoming.cs index 3e97ed29c20..f4818785082 100644 --- a/cs/src/Ice/Incoming.cs +++ b/cs/src/Ice/Incoming.cs @@ -216,7 +216,7 @@ namespace IceInternal os_.reset(); } - interceptorAsyncCallbackList_ = null; + interceptorAsyncCallbackList_ = null; } protected internal void warning__(System.Exception ex) diff --git a/cs/src/Ice/MetricsObserverI.cs b/cs/src/Ice/MetricsObserverI.cs index 84767e6bd25..bced2e1b2dd 100644 --- a/cs/src/Ice/MetricsObserverI.cs +++ b/cs/src/Ice/MetricsObserverI.cs @@ -45,7 +45,7 @@ namespace IceMX catch(Exception ex) { #if COMPACT - throw new ArgumentOutOfRangeException(_name, ex.ToString()); + throw new ArgumentOutOfRangeException(_name, ex.ToString()); #else throw new ArgumentOutOfRangeException(_name, ex); #endif @@ -402,7 +402,7 @@ namespace IceMX #if COMPACT Ice.VoidAction updater; #else - System.Action updater; + System.Action updater; #endif lock(this) { @@ -424,7 +424,7 @@ namespace IceMX #if COMPACT public void setUpdater(Ice.VoidAction updater) #else - public void setUpdater(System.Action updater) + public void setUpdater(System.Action updater) #endif { lock(this) @@ -440,7 +440,7 @@ namespace IceMX #if COMPACT private Ice.VoidAction _updater; #else - private System.Action _updater; + private System.Action _updater; #endif }; }
\ No newline at end of file diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs index e9be78db07b..c3d3bb50fab 100644 --- a/cs/src/Ice/Network.cs +++ b/cs/src/Ice/Network.cs @@ -587,7 +587,7 @@ namespace IceInternal throw new Ice.SocketException(ex); } } - + public static void setMcastGroup(Socket socket, IPAddress group, string iface) { try @@ -636,7 +636,7 @@ namespace IceInternal } } #endif - + public static void setMcastTtl(Socket socket, int ttl, AddressFamily family) { try diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs index 8e93f7d4af1..08667131351 100644 --- a/cs/src/Ice/ObjectAdapterI.cs +++ b/cs/src/Ice/ObjectAdapterI.cs @@ -1085,12 +1085,12 @@ namespace Ice if(unknownProps.Count != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { StringBuilder message = new StringBuilder("found unknown properties for object adapter `"); - message.Append(_name); - message.Append("':"); + message.Append(_name); + message.Append("':"); foreach(string s in unknownProps) { message.Append("\n "); - message.Append(s); + message.Append(s); } instance_.initializationData().logger.warning(message.ToString()); } @@ -1495,8 +1495,8 @@ namespace Ice if(instance_.traceLevels().network >= 1) { StringBuilder s = new StringBuilder("published endpoints for object adapter `"); - s.Append(_name); - s.Append("':\n"); + s.Append(_name); + s.Append("':\n"); bool first = true; foreach(IceInternal.EndpointI endpoint in endpoints) { diff --git a/cs/src/Ice/ObjectFactoryManager.cs b/cs/src/Ice/ObjectFactoryManager.cs index 8c3970b87b0..33fc5b72f2e 100644 --- a/cs/src/Ice/ObjectFactoryManager.cs +++ b/cs/src/Ice/ObjectFactoryManager.cs @@ -18,7 +18,7 @@ namespace IceInternal { lock(this) { - if(_factoryMap.ContainsKey(id)) + if(_factoryMap.ContainsKey(id)) { Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); ex.id = id; diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs index 710f71bd52a..41ba08ebaeb 100644 --- a/cs/src/Ice/PropertiesI.cs +++ b/cs/src/Ice/PropertiesI.cs @@ -79,7 +79,7 @@ namespace Ice PropertyValue pv; if(!_properties.TryGetValue(key, out pv)) { - return val; + return val; } pv.used = true; try @@ -366,8 +366,8 @@ namespace Ice return new PropertiesI(this); } } - - public List<string> getUnusedProperties() + + public List<string> getUnusedProperties() { lock(this) { @@ -423,7 +423,7 @@ namespace Ice } PropertyValue pv; - if(_properties.TryGetValue("Ice.ProgramName", out pv)) + if(_properties.TryGetValue("Ice.ProgramName", out pv)) { pv.used = true; } diff --git a/cs/src/Ice/ReferenceFactory.cs b/cs/src/Ice/ReferenceFactory.cs index 0da105d2159..05e54b8a634 100644 --- a/cs/src/Ice/ReferenceFactory.cs +++ b/cs/src/Ice/ReferenceFactory.cs @@ -437,8 +437,8 @@ namespace IceInternal for(int idx = 0; idx < sz; ++idx) { msg.Append(" `"); - msg.Append((string)unknownEndpoints[idx]); - msg.Append("'"); + msg.Append((string)unknownEndpoints[idx]); + msg.Append("'"); } instance_.initializationData().logger.warning(msg.ToString()); } @@ -700,12 +700,12 @@ namespace IceInternal if(unknownProps.Count != 0) { StringBuilder message = new StringBuilder("found unknown properties for proxy '"); - message.Append(prefix); - message.Append("':"); + message.Append(prefix); + message.Append("':"); foreach(string s in unknownProps) { message.Append("\n "); - message.Append(s); + message.Append(s); } instance_.initializationData().logger.warning(message.ToString()); } diff --git a/cs/src/Ice/StreamWrapper.cs b/cs/src/Ice/StreamWrapper.cs index eb6468e962b..59cd3d33d03 100644 --- a/cs/src/Ice/StreamWrapper.cs +++ b/cs/src/Ice/StreamWrapper.cs @@ -41,9 +41,9 @@ namespace IceInternal public class StreamWrapper : System.IO.Stream, System.IDisposable { - // - // Writeable stream constructor - // + // + // Writeable stream constructor + // public StreamWrapper(BasicStream s) { type_ = StreamType.Write; @@ -54,9 +54,9 @@ namespace IceInternal length_ = 0; } - // - // Readable stream constructor - // + // + // Readable stream constructor + // public StreamWrapper(int size, BasicStream s) { type_ = StreamType.Read; @@ -204,9 +204,9 @@ namespace IceInternal if(AssemblyUtil.runtime_ == AssemblyUtil.Runtime.Mono) { // - // The Mono deserialization implementation has a bug that causes a call to Seek() such - // that the reading position is set to -1. - // + // The Mono deserialization implementation has a bug that causes a call to Seek() such + // that the reading position is set to -1. + // return false; } else @@ -291,7 +291,7 @@ namespace IceInternal break; } } - s_.pos(pos_); + s_.pos(pos_); return pos_; } diff --git a/cs/src/Ice/TcpAcceptor.cs b/cs/src/Ice/TcpAcceptor.cs index 556114db3a5..b6ffbd9866b 100644 --- a/cs/src/Ice/TcpAcceptor.cs +++ b/cs/src/Ice/TcpAcceptor.cs @@ -42,7 +42,7 @@ namespace IceInternal if(_traceLevels.network >= 1) { StringBuilder s = new StringBuilder("listening for tcp connections at "); - s.Append(ToString()); + s.Append(ToString()); List<string> interfaces = Network.getHostsForEndpointExpand(_addr.Address.ToString(), instance_.protocolSupport(), true); diff --git a/cs/src/Ice/Timer.cs b/cs/src/Ice/Timer.cs index 1e6c34b0948..8681d2429d6 100644 --- a/cs/src/Ice/Timer.cs +++ b/cs/src/Ice/Timer.cs @@ -170,20 +170,20 @@ namespace IceInternal init(instance, priority, true); } #endif - + internal Timer(IceInternal.Instance instance) { #if !SILVERLIGHT init(instance, ThreadPriority.Normal, false); #else - init(instance); + init(instance); #endif } #if !SILVERLIGHT internal void init(IceInternal.Instance instance, ThreadPriority priority, bool hasPriority) #else - internal void init(IceInternal.Instance instance) + internal void init(IceInternal.Instance instance) #endif { _instance = instance; diff --git a/cs/src/Ice/UdpEndpointI.cs b/cs/src/Ice/UdpEndpointI.cs index d3c4268443d..9350e5a42e7 100644 --- a/cs/src/Ice/UdpEndpointI.cs +++ b/cs/src/Ice/UdpEndpointI.cs @@ -487,7 +487,7 @@ namespace IceInternal instance_.endpointHostResolver().resolve(_host, _port, this, callback); #endif } - + // // Return an acceptor for this endpoint, or null if no acceptors // is available. In case an acceptor is created, this operation diff --git a/cs/src/Ice/UdpTransceiver.cs b/cs/src/Ice/UdpTransceiver.cs index adc22c68211..4b9cc3216e9 100644 --- a/cs/src/Ice/UdpTransceiver.cs +++ b/cs/src/Ice/UdpTransceiver.cs @@ -834,7 +834,7 @@ namespace IceInternal string s = "attempting to bind to udp socket " + Network.addrToString(_addr); _logger.trace(_traceLevels.networkCat, s); } - + #if !SILVERLIGHT if(Network.isMulticast((IPEndPoint)_addr)) { diff --git a/cs/src/IceSSL/AcceptorI.cs b/cs/src/IceSSL/AcceptorI.cs index 1256676a33c..407049ef868 100644 --- a/cs/src/IceSSL/AcceptorI.cs +++ b/cs/src/IceSSL/AcceptorI.cs @@ -49,7 +49,7 @@ namespace IceSSL if(_instance.networkTraceLevel() >= 1) { StringBuilder s = new StringBuilder("listening for ssl connections at "); - s.Append(ToString()); + s.Append(ToString()); List<string> interfaces = IceInternal.Network.getHostsForEndpointExpand(_addr.Address.ToString(), diff --git a/cs/src/IceSSL/EndpointI.cs b/cs/src/IceSSL/EndpointI.cs index 98f79e3bf22..d78953f4b9f 100644 --- a/cs/src/IceSSL/EndpointI.cs +++ b/cs/src/IceSSL/EndpointI.cs @@ -14,7 +14,7 @@ namespace IceSSL using System.Collections.Generic; using System.Net; using System.Globalization; - + sealed class EndpointI : IceInternal.EndpointI { internal EndpointI(Instance instance, string ho, int po, int ti, Ice.ProtocolVersion pv, diff --git a/cs/src/IceSSL/Instance.cs b/cs/src/IceSSL/Instance.cs index 985bbe7afe8..0c833b8dd04 100644 --- a/cs/src/IceSSL/Instance.cs +++ b/cs/src/IceSSL/Instance.cs @@ -19,7 +19,7 @@ namespace IceSSL using System.Security.Cryptography.X509Certificates; using System.Text; using System.Globalization; - + internal class Instance { internal Instance(Ice.Communicator communicator) diff --git a/cs/src/PolicyServer/PolicyServer.cs b/cs/src/PolicyServer/PolicyServer.cs index de3529fcfd1..374b5ed04c5 100644 --- a/cs/src/PolicyServer/PolicyServer.cs +++ b/cs/src/PolicyServer/PolicyServer.cs @@ -67,7 +67,7 @@ public sealed class PolicyServer : IDisposable Console.WriteLine("Policy Server started...");
// Start policy response thread
Thread policyThread = new Thread(ServePolicy);
- policyThread.IsBackground = true;
+ policyThread.IsBackground = true;
policyThread.Start();
policyThread.Join();
}
diff --git a/cs/test/Ice/admin/run.py b/cs/test/Ice/admin/run.py index 4cd62630ccf..764f7c95468 100755 --- a/cs/test/Ice/admin/run.py +++ b/cs/test/Ice/admin/run.py @@ -17,7 +17,7 @@ if len(head) > 0: path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() diff --git a/cs/test/Ice/metrics/AllTests.cs b/cs/test/Ice/metrics/AllTests.cs index 1553f7979c1..3936cbff4a5 100644 --- a/cs/test/Ice/metrics/AllTests.cs +++ b/cs/test/Ice/metrics/AllTests.cs @@ -116,7 +116,7 @@ public class AllTests : TestCommon.TestApp { _updated = false; _serverProps = serverProps; - _monitor = new IceUtilInternal.Monitor(); + _monitor = new IceUtilInternal.Monitor(); } public void @@ -159,7 +159,7 @@ public class AllTests : TestCommon.TestApp private bool _updated; private Ice.PropertiesAdminPrx _serverProps; - private IceUtilInternal.Monitor _monitor; + private IceUtilInternal.Monitor _monitor; }; static void @@ -637,7 +637,7 @@ public class AllTests : TestCommon.TestApp #if COMPACT Ice.VoidAction c = () => { connect(metrics); }; #else - System.Action c = () => { connect(metrics); }; + System.Action c = () => { connect(metrics); }; #endif testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c); @@ -786,7 +786,7 @@ public class AllTests : TestCommon.TestApp #if COMPACT Ice.VoidAction op = () => { invokeOp(metrics); }; #else - System.Action op = () => { invokeOp(metrics); }; + System.Action op = () => { invokeOp(metrics); }; #endif testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op); diff --git a/cs/test/Ice/operations/TwowaysAMI.cs b/cs/test/Ice/operations/TwowaysAMI.cs index 89d646ab21c..4b58dd89a75 100644 --- a/cs/test/Ice/operations/TwowaysAMI.cs +++ b/cs/test/Ice/operations/TwowaysAMI.cs @@ -1531,7 +1531,7 @@ public class TwowaysAMI cb.check(); } - ic.getImplicitContext().setContext(null); + ic.getImplicitContext().setContext(null); ic.destroy(); } } diff --git a/cs/test/Ice/proxy/AllTests.cs b/cs/test/Ice/proxy/AllTests.cs index e8ddaaa6397..0f605d4c8db 100644 --- a/cs/test/Ice/proxy/AllTests.cs +++ b/cs/test/Ice/proxy/AllTests.cs @@ -263,14 +263,14 @@ public class AllTests : TestCommon.TestApp prop.setProperty(property, "locator:default -p 10000"); b1 = communicator.propertyToProxy(propertyPrefix); test(b1.ice_getLocator() != null && b1.ice_getLocator().ice_getIdentity().name.Equals("locator")); - try - { - prop.setProperty(property, ""); - } - catch(Exception ex) - { - System.Console.WriteLine(ex.ToString()); - } + try + { + prop.setProperty(property, ""); + } + catch(Exception ex) + { + System.Console.WriteLine(ex.ToString()); + } property = propertyPrefix + ".LocatorCacheTimeout"; test(b1.ice_getLocatorCacheTimeout() == -1); prop.setProperty(property, "1"); diff --git a/eclipse/java/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SliceFilePropertyPage.java b/eclipse/java/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SliceFilePropertyPage.java index 6af3e225fd1..afbe631f02e 100644 --- a/eclipse/java/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SliceFilePropertyPage.java +++ b/eclipse/java/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SliceFilePropertyPage.java @@ -59,7 +59,7 @@ public class SliceFilePropertyPage extends PropertyPage protected Control createContents(Composite parent) { - TabFolder tabFolder = new TabFolder(parent, SWT.NONE); + TabFolder tabFolder = new TabFolder(parent, SWT.NONE); { TabItem tabItem = new TabItem(tabFolder, SWT.NONE); diff --git a/java/demo/Glacier2/chat/Client.java b/java/demo/Glacier2/chat/Client.java index e69fc6ce320..44cf755a125 100644 --- a/java/demo/Glacier2/chat/Client.java +++ b/java/demo/Glacier2/chat/Client.java @@ -297,7 +297,7 @@ public class Client extends JFrame fieldPanel.setLayout(new GridLayout(0, 1)); fieldPanel.add(_hostField); fieldPanel.add(_userNameField); - fieldPanel.add(_passwordField); + fieldPanel.add(_passwordField); _connectionPanel.add(labelPanel); _connectionPanel.add(fieldPanel); diff --git a/java/demo/Glacier2/voip/Server.java b/java/demo/Glacier2/voip/Server.java index f2caef8113d..264533c911b 100644 --- a/java/demo/Glacier2/voip/Server.java +++ b/java/demo/Glacier2/voip/Server.java @@ -124,7 +124,7 @@ public class Server extends Ice.Application return proxy; } }; - + public int run(String[] args) { diff --git a/java/demo/Ice/serialize/Client.java b/java/demo/Ice/serialize/Client.java index f3d290f5060..a4d9f034286 100644 --- a/java/demo/Ice/serialize/Client.java +++ b/java/demo/Ice/serialize/Client.java @@ -62,11 +62,11 @@ public class Client extends Ice.Application return 1; } - MyGreeting greeting = new MyGreeting(); - greeting.text = "Hello there!"; - MyGreeting nullGreeting = null; + MyGreeting greeting = new MyGreeting(); + greeting.text = "Hello there!"; + MyGreeting nullGreeting = null; - boolean sendNull = false; + boolean sendNull = false; menu(); @@ -86,14 +86,14 @@ public class Client extends Ice.Application } if(line.equals("g")) { - if(sendNull) - { - greet.sendGreeting(nullGreeting); - } - else - { - greet.sendGreeting(greeting); - } + if(sendNull) + { + greet.sendGreeting(nullGreeting); + } + else + { + greet.sendGreeting(greeting); + } } else if(line.equals("t")) { diff --git a/java/demo/Ice/serialize/GreetI.java b/java/demo/Ice/serialize/GreetI.java index 45218116458..0073c9ee72b 100644 --- a/java/demo/Ice/serialize/GreetI.java +++ b/java/demo/Ice/serialize/GreetI.java @@ -15,19 +15,19 @@ public class GreetI extends _GreetDisp sendGreeting(MyGreeting greeting, Ice.Current current) { if(greeting != null) - { - System.out.println(greeting.text); - } - else - { - System.out.println("Received null greeting"); - } + { + System.out.println(greeting.text); + } + else + { + System.out.println("Received null greeting"); + } } public void shutdown(Ice.Current current) { System.out.println("Shutting down..."); - current.adapter.getCommunicator().shutdown(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/java/demo/Ice/serialize/Server.java b/java/demo/Ice/serialize/Server.java index 6cf3453d761..5a768a315b8 100644 --- a/java/demo/Ice/serialize/Server.java +++ b/java/demo/Ice/serialize/Server.java @@ -30,8 +30,8 @@ public class Server extends Ice.Application public static void main(String[] args) { - Server app = new Server(); - int status = app.main("Server", args, "config.server"); + Server app = new Server(); + int status = app.main("Server", args, "config.server"); System.exit(status); } } diff --git a/java/src/Freeze/BackgroundSaveEvictorI.java b/java/src/Freeze/BackgroundSaveEvictorI.java index ef6d3ea9463..f2ccdfaa854 100644 --- a/java/src/Freeze/BackgroundSaveEvictorI.java +++ b/java/src/Freeze/BackgroundSaveEvictorI.java @@ -228,10 +228,10 @@ class BackgroundSaveEvictorI extends EvictorI implements BackgroundSaveEvictor, element.status = dead; element.rec = new ObjectRecord(); - if(store.keepStats()) - { - element.rec.stats = new Statistics(); - } + if(store.keepStats()) + { + element.rec.stats = new Statistics(); + } Object o = store.cache().putIfAbsent(ident, element); @@ -280,13 +280,13 @@ class BackgroundSaveEvictorI extends EvictorI implements BackgroundSaveEvictor, ObjectRecord rec = element.rec; rec.servant = servant; - - if(store.keepStats()) - { - rec.stats.creationTime = IceInternal.Time.currentMonotonicTimeMillis(); - rec.stats.lastSaveTime = 0; - rec.stats.avgSaveTime = 0; - } + + if(store.keepStats()) + { + rec.stats.creationTime = IceInternal.Time.currentMonotonicTimeMillis(); + rec.stats.lastSaveTime = 0; + rec.stats.avgSaveTime = 0; + } addToModifiedQueue(element); break; @@ -1177,10 +1177,10 @@ class BackgroundSaveEvictorI extends EvictorI implements BackgroundSaveEvictor, } long saveStart = 0; - if(_trace >= 1) - { - saveStart = IceInternal.Time.currentMonotonicTimeMillis(); - } + if(_trace >= 1) + { + saveStart = IceInternal.Time.currentMonotonicTimeMillis(); + } String txnId = null; try @@ -1466,12 +1466,12 @@ class BackgroundSaveEvictorI extends EvictorI implements BackgroundSaveEvictor, if(element.status != destroyed) { - boolean keepStats = obj.store.keepStats(); + boolean keepStats = obj.store.keepStats(); - if(keepStats) - { - updateStats(element.rec.stats, streamStart); - } + if(keepStats) + { + updateStats(element.rec.stats, streamStart); + } obj.value = ObjectStore.marshalValue(element.rec, _communicator, _encoding, keepStats); } return obj; diff --git a/java/src/Freeze/EvictorIteratorI.java b/java/src/Freeze/EvictorIteratorI.java index 31d253bf276..be0d54395e4 100644 --- a/java/src/Freeze/EvictorIteratorI.java +++ b/java/src/Freeze/EvictorIteratorI.java @@ -58,10 +58,10 @@ class EvictorIteratorI implements EvictorIterator private java.util.Iterator<Ice.Identity> nextBatch() { - if(!_more) + if(!_more) { - return null; - } + return null; + } EvictorI.DeactivateController deactivateController = _store.evictor().deactivateController(); deactivateController.lock(); diff --git a/java/src/Freeze/ObjectStore.java b/java/src/Freeze/ObjectStore.java index 6ca9b493261..82ccc40ac55 100644 --- a/java/src/Freeze/ObjectStore.java +++ b/java/src/Freeze/ObjectStore.java @@ -22,7 +22,7 @@ class ObjectStore implements IceUtil.Store _indices = indices; _communicator = evictor.communicator(); _encoding = evictor.encoding(); - _keepStats = false; + _keepStats = false; if(facet.equals("")) { @@ -56,18 +56,18 @@ class ObjectStore implements IceUtil.Store CatalogData catalogData = catalog.get(evictor.filename()); if(catalogData != null) - { - if(catalogData.evictor) - { - _keepStats = catalogData.value.isEmpty(); - } - else - { - DatabaseException ex = new DatabaseException(); - ex.message = _evictor.errorPrefix() + evictor.filename() + " is not an evictor database"; - throw ex; - } - } + { + if(catalogData.evictor) + { + _keepStats = catalogData.value.isEmpty(); + } + else + { + DatabaseException ex = new DatabaseException(); + ex.message = _evictor.errorPrefix() + evictor.filename() + " is not an evictor database"; + throw ex; + } + } com.sleepycat.db.Environment dbEnv = evictor.dbEnv().getEnv(); @@ -329,14 +329,14 @@ class ObjectStore implements IceUtil.Store new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, true, false); os.startWriteEncaps(); - if(keepStats) - { - v.__write(os); - } - else - { - os.writeObject(v.servant); - } + if(keepStats) + { + v.__write(os); + } + else + { + os.writeObject(v.servant); + } os.writePendingObjects(); os.endWriteEncaps(); IceInternal.Buffer buf = os.prepareWrite(); @@ -358,18 +358,18 @@ class ObjectStore implements IceUtil.Store buf.b.position(0); ObjectRecord rec = new ObjectRecord(); is.startReadEncaps(); - if(keepStats) - { - rec.__read(is); - is.readPendingObjects(); - } - else - { - Ice.ObjectHolder holder = new Ice.ObjectHolder(); - is.readObject(holder); - is.readPendingObjects(); - rec.servant = holder.value; - } + if(keepStats) + { + rec.__read(is); + is.readPendingObjects(); + } + else + { + Ice.ObjectHolder holder = new Ice.ObjectHolder(); + is.readObject(holder); + is.readPendingObjects(); + rec.servant = holder.value; + } is.endReadEncaps(); return rec; } @@ -401,7 +401,7 @@ class ObjectStore implements IceUtil.Store final boolean keepStats() { - return _keepStats; + return _keepStats; } final EvictorI @@ -567,7 +567,7 @@ class ObjectStore implements IceUtil.Store com.sleepycat.db.DatabaseEntry dbValue = new com.sleepycat.db.DatabaseEntry(marshalValue(objectRecord, _communicator, _encoding, - _keepStats)); + _keepStats)); try { diff --git a/java/src/Freeze/TransactionalEvictorContext.java b/java/src/Freeze/TransactionalEvictorContext.java index 434a63b773a..a0fe2af0ad6 100644 --- a/java/src/Freeze/TransactionalEvictorContext.java +++ b/java/src/Freeze/TransactionalEvictorContext.java @@ -179,10 +179,10 @@ class TransactionalEvictorContext implements Ice.DispatchInterceptorAsyncCallbac { if(!_readOnly && !_removed) { - if(_store.keepStats()) - { - EvictorI.updateStats(_rec.stats, IceInternal.Time.currentMonotonicTimeMillis()); - } + if(_store.keepStats()) + { + EvictorI.updateStats(_rec.stats, IceInternal.Time.currentMonotonicTimeMillis()); + } _store.update(_current.id, _rec, _tx); if(_trace >= 3) diff --git a/java/src/Freeze/TransactionalEvictorI.java b/java/src/Freeze/TransactionalEvictorI.java index d1dbc185e82..3b389fe07f8 100644 --- a/java/src/Freeze/TransactionalEvictorI.java +++ b/java/src/Freeze/TransactionalEvictorI.java @@ -61,7 +61,7 @@ class TransactionalEvictorI extends EvictorI implements TransactionalEvictor _deactivateController.lock(); try { - ObjectStore store = findStore(facet, _createDb); + ObjectStore store = findStore(facet, _createDb); if(store == null) { NotFoundException ex = new NotFoundException(); @@ -70,24 +70,24 @@ class TransactionalEvictorI extends EvictorI implements TransactionalEvictor } long currentTime = 0; - ObjectRecord rec; - - if(store.keepStats()) - { - currentTime = IceInternal.Time.currentMonotonicTimeMillis(); - rec = new ObjectRecord(servant, new Statistics(currentTime, 0, 0)); - } - else - { - rec = new ObjectRecord(servant, null); - } + ObjectRecord rec; + + if(store.keepStats()) + { + currentTime = IceInternal.Time.currentMonotonicTimeMillis(); + rec = new ObjectRecord(servant, new Statistics(currentTime, 0, 0)); + } + else + { + rec = new ObjectRecord(servant, null); + } TransactionI tx = beforeQuery(); - if(store.keepStats()) - { - updateStats(rec.stats, currentTime); - } + if(store.keepStats()) + { + updateStats(rec.stats, currentTime); + } if(!store.insert(ident, rec, tx)) { @@ -362,10 +362,10 @@ class TransactionalEvictorI extends EvictorI implements TransactionalEvictor int operationAttributes = sample.ice_operationAttributes(current.operation); - if(operationAttributes < 0) - { - throw new Ice.OperationNotExistException(); - } + if(operationAttributes < 0) + { + throw new Ice.OperationNotExistException(); + } boolean readOnly = (operationAttributes & 0x1) == 0; @@ -411,7 +411,7 @@ class TransactionalEvictorI extends EvictorI implements TransactionalEvictor default: { assert false; - throw new Ice.OperationNotExistException(); + throw new Ice.OperationNotExistException(); } } diff --git a/java/src/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/SessionFactoryHelper.java index e7526510f80..d7761b797fa 100644 --- a/java/src/Glacier2/SessionFactoryHelper.java +++ b/java/src/Glacier2/SessionFactoryHelper.java @@ -224,7 +224,7 @@ public class SessionFactoryHelper synchronized public void setConnectContext(final java.util.Map<String, String> context) { - _context = context; + _context = context; } /** diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index f08532fc6f4..a7d73df9330 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -886,12 +886,12 @@ public final class ObjectAdapterI implements ObjectAdapter if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { StringBuffer message = new StringBuffer("found unknown properties for object adapter `"); - message.append(_name); - message.append("':"); + message.append(_name); + message.append("':"); for(String p : unknownProps) { - message.append("\n "); - message.append(p); + message.append("\n "); + message.append(p); } _instance.initializationData().logger.warning(message.toString()); } @@ -1283,14 +1283,14 @@ public final class ObjectAdapterI implements ObjectAdapter if(_instance.traceLevels().network >= 1) { StringBuffer s = new StringBuffer("published endpoints for object adapter `"); - s.append(_name); - s.append("':\n"); + s.append(_name); + s.append("':\n"); boolean first = true; for(IceInternal.EndpointI endpoint : endpoints) { if(!first) { - s.append(":"); + s.append(":"); } s.append(endpoint.toString()); first = false; diff --git a/java/src/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/Application/Communicator.java index a793da76921..738140f1f0b 100644 --- a/java/src/IceGridGUI/Application/Communicator.java +++ b/java/src/IceGridGUI/Application/Communicator.java @@ -699,24 +699,24 @@ abstract class Communicator extends TreeNode implements DescriptorHolder TemplateDescriptor templateDescriptor = getRoot().findServiceTemplateDescriptor(descriptor.template); - if(templateDescriptor == null) - { - throw new UpdateFailedException("Cannot find template descriptor '" + - descriptor.template + - "' referenced by service-instance"); - } + if(templateDescriptor == null) + { + throw new UpdateFailedException("Cannot find template descriptor '" + + descriptor.template + + "' referenced by service-instance"); + } serviceResolver = new Utils.Resolver(getResolver(), descriptor.parameterValues, templateDescriptor.parameterDefaults); ServiceDescriptor serviceDescriptor = (ServiceDescriptor)templateDescriptor.descriptor; - - // - // If it's not null, it's a bug in the provider of this descriptor, e.g. - // the icegridadmin parsing code. - // - assert serviceDescriptor != null; + + // + // If it's not null, it's a bug in the provider of this descriptor, e.g. + // the icegridadmin parsing code. + // + assert serviceDescriptor != null; serviceName = serviceResolver.substitute(serviceDescriptor.name); serviceResolver.put("service", serviceName); diff --git a/java/src/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/Application/Node.java index 45b3d3963ed..5cb26dea3a0 100644 --- a/java/src/IceGridGUI/Application/Node.java +++ b/java/src/IceGridGUI/Application/Node.java @@ -542,12 +542,12 @@ class Node extends TreeNode implements PropertySetParent // TemplateDescriptor templateDescriptor = root.findServerTemplateDescriptor(instanceDescriptor.template); - if(templateDescriptor == null) - { - throw new UpdateFailedException("Cannot find template descriptor '" + - instanceDescriptor.template + - "' referenced by server-instance"); - } + if(templateDescriptor == null) + { + throw new UpdateFailedException("Cannot find template descriptor '" + + instanceDescriptor.template + + "' referenced by server-instance"); + } ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor; assert serverDescriptor != null; diff --git a/java/src/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/Application/NodeEditor.java index d49201d8d71..91dfc9b6cde 100644 --- a/java/src/IceGridGUI/Application/NodeEditor.java +++ b/java/src/IceGridGUI/Application/NodeEditor.java @@ -173,7 +173,7 @@ class NodeEditor extends Editor _loadFactor.setToolTipText("<html>A floating point value.<br>" + "When not specified, IceGrid uses 1.0 divided by the<br>" + "<i>number of threads</i> on all platforms except Windows;<br>" - + "on Windows, IceGrid uses 1.0.<html>"); + + "on Windows, IceGrid uses 1.0.<html>"); } protected void appendProperties(DefaultFormBuilder builder) diff --git a/java/src/IceGridGUI/Application/UpdateFailedException.java b/java/src/IceGridGUI/Application/UpdateFailedException.java index 80fe91e88d8..c194e0c22e1 100755..100644 --- a/java/src/IceGridGUI/Application/UpdateFailedException.java +++ b/java/src/IceGridGUI/Application/UpdateFailedException.java @@ -13,12 +13,12 @@ public class UpdateFailedException extends Exception { UpdateFailedException(TreeNode parent, String id) { - _message = parent.getFullId().toString() + " has already a child with '" + id + "' as ID."; + _message = parent.getFullId().toString() + " has already a child with '" + id + "' as ID."; } UpdateFailedException(String message) { - _message = message; + _message = message; } public String toString() diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java index e4200a58eb5..0d0108c04c0 100644 --- a/java/src/IceGridGUI/Coordinator.java +++ b/java/src/IceGridGUI/Coordinator.java @@ -475,10 +475,10 @@ public class Coordinator _serviceMenu = new JMenu("Service"); _serviceMenu.setEnabled(false); toolsMenu.add(_serviceMenu); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START)); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP)); - _serviceMenu.addSeparator(); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG)); + _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START)); + _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP)); + _serviceMenu.addSeparator(); + _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG)); // // Help menu @@ -3339,9 +3339,9 @@ public class Coordinator _serverMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]); _serviceMenu.setEnabled(node instanceof IceGridGUI.LiveDeployment.Service && - (availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.START] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP])); + (availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG] || + availableActions[IceGridGUI.LiveDeployment.TreeNode.START] || + availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP])); } public void showActions(IceGridGUI.Application.TreeNode node) diff --git a/java/src/IceGridGUI/LiveDeployment/GraphView.java b/java/src/IceGridGUI/LiveDeployment/GraphView.java index f042e3c8dc9..7e899d09c35 100644 --- a/java/src/IceGridGUI/LiveDeployment/GraphView.java +++ b/java/src/IceGridGUI/LiveDeployment/GraphView.java @@ -1338,7 +1338,7 @@ public class GraphView extends JFrame implements MetricsFieldContext } public Class getColumnClass(int columnIndex) - { + { switch(columnIndex) { case 0: // Node Name @@ -1398,7 +1398,7 @@ public class GraphView extends JFrame implements MetricsFieldContext return null; } } - } + } public Object getValueAt(int rowIndex, int columnIndex) { diff --git a/java/src/IceGridGUI/LiveDeployment/MetricsViewEditor.java b/java/src/IceGridGUI/LiveDeployment/MetricsViewEditor.java index ae0bcbd8019..a1c8ab94de9 100644 --- a/java/src/IceGridGUI/LiveDeployment/MetricsViewEditor.java +++ b/java/src/IceGridGUI/LiveDeployment/MetricsViewEditor.java @@ -622,8 +622,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { if(_tables.get(entry.getKey()) != null) { - continue; - } + continue; + } IceMX.Metrics[] objects = entry.getValue(); if(objects == null || objects.length == 0) @@ -972,10 +972,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext return false; } - public Class getColumnClass(int index) - { - return _fields.get(index).getColumnClass(); - } + public Class getColumnClass(int index) + { + return _fields.get(index).getColumnClass(); + } public Map<Integer, MetricsField> getMetricFields() { @@ -1032,7 +1032,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // Name for display. // - public String getColumnName(); + public String getColumnName(); // // ToolTip @@ -1042,7 +1042,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // The Java class correspoding to the field, is used in the table models. // - public Class getColumnClass(); + public Class getColumnClass(); // // Renderer used by JTable to render the field. @@ -1052,7 +1052,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // Return the value of the field for the given metrics object. // - public Object getValue(IceMX.Metrics m, long timestamp); + public Object getValue(IceMX.Metrics m, long timestamp); // // Set up a field identical to this but without the transient data. @@ -1224,10 +1224,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext _cellRenderer = new FormatedNumberRenderer(format); } - public Class getColumnClass() - { - return Float.class; - } + public Class getColumnClass() + { + return Float.class; + } public TableCellRenderer getCellRenderer() { @@ -1259,8 +1259,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } } - private double _scaleFactor = 1.0d; - private String _columnName; + private double _scaleFactor = 1.0d; + private String _columnName; private TableCellRenderer _cellRenderer; private final Map<String, IceMX.Metrics> _deltas = new HashMap<String, IceMX.Metrics>(); } @@ -1275,10 +1275,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { public DeltaAverageMetricsField(MetricsView node, String prefix, String metricsName, String fieldName, Field field) - { + { super(node, prefix, metricsName, fieldName, field); setFormat("#0.000"); // Set the default format - } + } public void setFormat(String format) { @@ -1407,8 +1407,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext return _cellRenderer; } - public Object getValue(final IceMX.Metrics m, long timestamp) - { + public Object getValue(final IceMX.Metrics m, long timestamp) + { JButton button = new JButton(Integer.toString(m.failures)); if(m.failures > 0) { @@ -1520,7 +1520,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext button.setEnabled(false); } return button; - } + } private static final TableCellRenderer _cellRenderer = new ButtonRenderer(); } diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index 1f81029f920..c52e05cf242 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -1117,8 +1117,8 @@ public final class Instance StringBuffer message = new StringBuffer("The following properties were set but never read:"); for(String p : unusedProperties) { - message.append("\n "); - message.append(p); + message.append("\n "); + message.append(p); } _initData.logger.warning(message.toString()); } diff --git a/java/src/IceInternal/MetricsAdminI.java b/java/src/IceInternal/MetricsAdminI.java index 1a7b79065a3..539e80ac5a8 100644 --- a/java/src/IceInternal/MetricsAdminI.java +++ b/java/src/IceInternal/MetricsAdminI.java @@ -47,12 +47,12 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { StringBuffer message = new StringBuffer("found unknown IceMX properties for `"); - message.append(prefix.substring(0, prefix.length() - 1)); - message.append("':"); + message.append(prefix.substring(0, prefix.length() - 1)); + message.append("':"); for(String p : unknownProps) { - message.append("\n "); - message.append(p); + message.append("\n "); + message.append(p); } Ice.Util.getProcessLogger().warning(message.toString()); } diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java index 6da0808aaaf..058c4fd88ba 100644 --- a/java/src/IceInternal/Network.java +++ b/java/src/IceInternal/Network.java @@ -1096,14 +1096,14 @@ public final class Network private static boolean isValidAddr(java.net.InetAddress addr, int protocol) { - byte[] bytes = null; - if(addr != null) - { - bytes = addr.getAddress(); - } - return bytes != null && - ((bytes.length == 16 && protocol == EnableIPv6) || - (bytes.length == 4 && protocol == EnableIPv4)); + byte[] bytes = null; + if(addr != null) + { + bytes = addr.getAddress(); + } + return bytes != null && + ((bytes.length == 16 && protocol == EnableIPv6) || + (bytes.length == 4 && protocol == EnableIPv4)); } public static String diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index f6e5dc7ea01..0d17f73b754 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -428,9 +428,9 @@ public final class ReferenceFactory StringBuffer msg = new StringBuffer("Proxy contains unknown endpoints:"); for(String e : unknownEndpoints) { - msg.append(" `"); - msg.append(e); - msg.append("'"); + msg.append(" `"); + msg.append(e); + msg.append("'"); } _instance.initializationData().logger.warning(msg.toString()); } @@ -705,12 +705,12 @@ public final class ReferenceFactory if(unknownProps.size() != 0) { StringBuffer message = new StringBuffer("found unknown properties for proxy '"); - message.append(prefix); - message.append("':"); + message.append(prefix); + message.append("':"); for(String s : unknownProps) { - message.append("\n "); - message.append(s); + message.append("\n "); + message.append(s); } _instance.initializationData().logger.warning(message.toString()); } diff --git a/java/src/IceInternal/TcpAcceptor.java b/java/src/IceInternal/TcpAcceptor.java index ca0da43319e..412211bd080 100644 --- a/java/src/IceInternal/TcpAcceptor.java +++ b/java/src/IceInternal/TcpAcceptor.java @@ -39,7 +39,7 @@ class TcpAcceptor implements Acceptor if(_traceLevels.network >= 1) { StringBuffer s = new StringBuffer("listening for tcp connections at "); - s.append(toString()); + s.append(toString()); java.util.List<String> interfaces = Network.getHostsForEndpointExpand(_addr.getAddress().getHostAddress(), _instance.protocolSupport(), diff --git a/java/src/IceInternal/Timer.java b/java/src/IceInternal/Timer.java index fe643e1e089..03a180d7f3f 100644 --- a/java/src/IceInternal/Timer.java +++ b/java/src/IceInternal/Timer.java @@ -290,25 +290,25 @@ public final class Timer extends Thread return 0; } - public boolean - equals(Object obj) - { - if(this == obj) - { - return true; - } - if(obj instanceof Token) - { - return compareTo((Token)obj) == 0; - } - return false; - } - - public int - hashCode() - { - return id ^ (int)scheduledTime; - } + public boolean + equals(Object obj) + { + if(this == obj) + { + return true; + } + if(obj instanceof Token) + { + return compareTo((Token)obj) == 0; + } + return false; + } + + public int + hashCode() + { + return id ^ (int)scheduledTime; + } long scheduledTime; int id; // Since we can't compare references, we need to use another id. diff --git a/java/src/IceSSL/AcceptorI.java b/java/src/IceSSL/AcceptorI.java index ac01fdc9f8c..25b3412265e 100644 --- a/java/src/IceSSL/AcceptorI.java +++ b/java/src/IceSSL/AcceptorI.java @@ -39,7 +39,7 @@ final class AcceptorI implements IceInternal.Acceptor if(_instance.networkTraceLevel() >= 1) { StringBuffer s = new StringBuffer("listening for ssl connections at "); - s.append(toString()); + s.append(toString()); java.util.List<String> interfaces = IceInternal.Network.getHostsForEndpointExpand(_addr.getAddress().getHostAddress(), diff --git a/java/test/Freeze/evictor/Client.java b/java/test/Freeze/evictor/Client.java index 76f89e2fc64..8c057070c59 100644 --- a/java/test/Freeze/evictor/Client.java +++ b/java/test/Freeze/evictor/Client.java @@ -579,17 +579,17 @@ public class Client extends test.Util.Application { } - // - // Call an operation that does not exist on the servant - // - try - { - int balance = AccountPrxHelper.uncheckedCast(servants[0]).getBalance(); - test(false); - } - catch(Ice.OperationNotExistException ex) - { - } + // + // Call an operation that does not exist on the servant + // + try + { + int balance = AccountPrxHelper.uncheckedCast(servants[0]).getBalance(); + test(false); + } + catch(Ice.OperationNotExistException ex) + { + } // // Remove all facets diff --git a/java/test/Freeze/evictor/RemoteEvictorI.java b/java/test/Freeze/evictor/RemoteEvictorI.java index 8f88d18d802..cfb6c7fe620 100644 --- a/java/test/Freeze/evictor/RemoteEvictorI.java +++ b/java/test/Freeze/evictor/RemoteEvictorI.java @@ -78,11 +78,11 @@ public final class RemoteEvictorI extends _RemoteEvictorDisp true); } - // - // Check that we can get an iterator on a non-existing facet - // - Freeze.EvictorIterator p = _evictor.getIterator("foo", 1); - test(p.hasNext() == false); + // + // Check that we can get an iterator on a non-existing facet + // + Freeze.EvictorIterator p = _evictor.getIterator("foo", 1); + test(p.hasNext() == false); initializer.init(this, _evictor); diff --git a/java/test/Glacier2/router/Client.java b/java/test/Glacier2/router/Client.java index 572ff0989ab..036358df2c1 100644 --- a/java/test/Glacier2/router/Client.java +++ b/java/test/Glacier2/router/Client.java @@ -468,8 +468,8 @@ public class Client extends test.Util.Application public static void main(String[] args) { - Client c = new Client(); - int status = c.main("Client", args); + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/Ice/adapterDeactivation/AllTests.java index de0b09b36ef..ecdc6935faf 100644 --- a/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/Ice/adapterDeactivation/AllTests.java @@ -28,7 +28,7 @@ public class AllTests public static TestIntfPrx allTests(Ice.Communicator communicator, java.io.PrintWriter out) { - out.print("testing stringToProxy... "); + out.print("testing stringToProxy... "); out.flush(); String ref = "test:default -p 12010"; Ice.ObjectPrx base = communicator.stringToProxy(ref); diff --git a/java/test/Ice/adapterDeactivation/Client.java b/java/test/Ice/adapterDeactivation/Client.java index 6930d16f4d5..b78b88a3dd6 100644 --- a/java/test/Ice/adapterDeactivation/Client.java +++ b/java/test/Ice/adapterDeactivation/Client.java @@ -30,7 +30,7 @@ public class Client extends test.Util.Application public static void main(String[] args) { - Client app = new Client(); + Client app = new Client(); int result = app.main("Client", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/adapterDeactivation/Server.java b/java/test/Ice/adapterDeactivation/Server.java index 0e4f6d36ea7..fdba37a4548 100644 --- a/java/test/Ice/adapterDeactivation/Server.java +++ b/java/test/Ice/adapterDeactivation/Server.java @@ -36,7 +36,7 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server app = new Server(); + Server app = new Server(); int result = app.main("Server", args); System.gc(); diff --git a/java/test/Ice/ami/Server.java b/java/test/Ice/ami/Server.java index f9e38e63dec..bf2512c1c79 100644 --- a/java/test/Ice/ami/Server.java +++ b/java/test/Ice/ami/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -41,7 +41,7 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server app = new Server(); + Server app = new Server(); int result = app.main("Server", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/background/Client.java b/java/test/Ice/background/Client.java index c640a8024c0..722f6855f41 100644 --- a/java/test/Ice/background/Client.java +++ b/java/test/Ice/background/Client.java @@ -60,7 +60,7 @@ public class Client extends test.Util.Application public static void main(String[] args) { - Client app = new Client(); + Client app = new Client(); int result = app.main("Client", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/background/Collocated.java b/java/test/Ice/background/Collocated.java index 8aadec2213c..34e930c8d04 100644 --- a/java/test/Ice/background/Collocated.java +++ b/java/test/Ice/background/Collocated.java @@ -16,66 +16,66 @@ public class Collocated public static void main(String[] args) { - final Client client = new Client(); - final Server server = new Server(); - Thread t = new Thread(new Runnable() - { - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", - "--Ice.Warn.Connections=1", - "--Ice.ThreadPool.Server.Size=1", - "--Ice.ThreadPool.Server.SizeMax=3", - "--Ice.ThreadPool.Server.SizeWarn=0", - "--Ice.PrintAdapterReady=1", - "--Ice.ServerIdleTime=30", - "--Ice.Default.Host=127.0.0.1" - }; - server.setServerReadyListener(new test.Util.Application.ServerReadyListener() - { - public void serverReady() - { - _clientThread = new Thread(new Runnable() - { - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" - }; - client.main("Client", args); - } - }); - _clientThread.start(); - } - }); + final Client client = new Client(); + final Server server = new Server(); + Thread t = new Thread(new Runnable() + { + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", + "--Ice.Warn.Connections=1", + "--Ice.ThreadPool.Server.Size=1", + "--Ice.ThreadPool.Server.SizeMax=3", + "--Ice.ThreadPool.Server.SizeWarn=0", + "--Ice.PrintAdapterReady=1", + "--Ice.ServerIdleTime=30", + "--Ice.Default.Host=127.0.0.1" + }; + server.setServerReadyListener(new test.Util.Application.ServerReadyListener() + { + public void serverReady() + { + _clientThread = new Thread(new Runnable() + { + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" + }; + client.main("Client", args); + } + }); + _clientThread.start(); + } + }); - result = server.main("Server", args); - if(_clientThread != null) - { - while(_clientThread.isAlive()) - { - try - { - _clientThread.join(); - } - catch(InterruptedException e1) - { - } - } - } - } - }); - t.start(); - try - { - t.join(); - } - catch(InterruptedException ex) - { - } + result = server.main("Server", args); + if(_clientThread != null) + { + while(_clientThread.isAlive()) + { + try + { + _clientThread.join(); + } + catch(InterruptedException e1) + { + } + } + } + } + }); + t.start(); + try + { + t.join(); + } + catch(InterruptedException ex) + { + } System.gc(); System.exit(result); } diff --git a/java/test/Ice/background/Server.java b/java/test/Ice/background/Server.java index 648229d8d33..34c012e2e73 100644 --- a/java/test/Ice/background/Server.java +++ b/java/test/Ice/background/Server.java @@ -141,7 +141,7 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server app = new Server(); + Server app = new Server(); int result = app.main("Server", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java index e21d1bc8ef4..65c84f0b2cc 100644 --- a/java/test/Ice/binding/AllTests.java +++ b/java/test/Ice/binding/AllTests.java @@ -102,7 +102,7 @@ public class AllTests String ref = "communicator:default -p 12010"; RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); - out.print("testing binding with single endpoint... "); + out.print("testing binding with single endpoint... "); out.flush(); { RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); diff --git a/java/test/Ice/binding/Server.java b/java/test/Ice/binding/Server.java index 5579fbe0035..d45c49a02cd 100644 --- a/java/test/Ice/binding/Server.java +++ b/java/test/Ice/binding/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = communicator.stringToIdentity("communicator"); adapter.add(new RemoteCommunicatorI(), id); @@ -35,7 +35,7 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server app = new Server(); + Server app = new Server(); int result = app.main("Server", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/checksum/Client.java b/java/test/Ice/checksum/Client.java index 29de6990009..f1f662592b9 100644 --- a/java/test/Ice/checksum/Client.java +++ b/java/test/Ice/checksum/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); checksum.shutdown(); return 0; @@ -34,8 +34,8 @@ public class Client extends test.Util.Application public static void main(String[] args) { - Client c = new Client(); - int status = c.main("Client", args); + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/checksum/Server.java b/java/test/Ice/checksum/Server.java index c4f249372de..3a5225764ca 100644 --- a/java/test/Ice/checksum/Server.java +++ b/java/test/Ice/checksum/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ChecksumI(); @@ -34,8 +34,8 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server c = new Server(); - int status = c.main("Server", args); + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/dispatcher/Server.java b/java/test/Ice/dispatcher/Server.java index b6d268e4bd6..980dd7aaaad 100644 --- a/java/test/Ice/dispatcher/Server.java +++ b/java/test/Ice/dispatcher/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -53,7 +53,7 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server app = new Server(); + Server app = new Server(); int result = app.main("Server", args); app.terminate(); System.gc(); diff --git a/java/test/Ice/exceptions/Collocated.java b/java/test/Ice/exceptions/Collocated.java index 1da9731cff0..7d8b27b602e 100644 --- a/java/test/Ice/exceptions/Collocated.java +++ b/java/test/Ice/exceptions/Collocated.java @@ -14,7 +14,7 @@ public class Collocated extends test.Util.Application public int run(String[] args) { - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ThrowerI(); adapter.add(object, communicator.stringToIdentity("thrower")); @@ -36,7 +36,7 @@ public class Collocated extends test.Util.Application public static void main(String[] args) { - Collocated app = new Collocated(); + Collocated app = new Collocated(); int result = app.main("Collocated", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java index 9932421b963..6cff107412c 100644 --- a/java/test/Ice/facets/AllTests.java +++ b/java/test/Ice/facets/AllTests.java @@ -35,7 +35,7 @@ public class AllTests public static GPrx allTests(Ice.Communicator communicator, PrintWriter out) { - out.print("testing Ice.Admin.Facets property... "); + out.print("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); diff --git a/java/test/Ice/faultTolerance/Client.java b/java/test/Ice/faultTolerance/Client.java index 984d5954fcb..80db5140566 100644 --- a/java/test/Ice/faultTolerance/Client.java +++ b/java/test/Ice/faultTolerance/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application { PrintWriter out = getWriter(); - Ice.Communicator communicator = communicator(); + Ice.Communicator communicator = communicator(); java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length); for(String arg : args) { @@ -56,7 +56,7 @@ public class Client extends test.Util.Application if(ports.isEmpty()) { - out.println("Client: no ports specified"); + out.println("Client: no ports specified"); usage(); return 1; } diff --git a/java/test/Ice/interceptor/Client.java b/java/test/Ice/interceptor/Client.java index b2b2bd78472..bea4345026c 100644 --- a/java/test/Ice/interceptor/Client.java +++ b/java/test/Ice/interceptor/Client.java @@ -115,7 +115,7 @@ public class Client extends test.Util.Application private int runAmd(MyObjectPrx prx, AMDInterceptorI interceptor, PrintWriter out) { - out.print("testing simple interceptor... "); + out.print("testing simple interceptor... "); out.flush(); test(interceptor.getLastOperation() == null); test(interceptor.getLastStatus() == null); @@ -201,7 +201,7 @@ public class Client extends test.Util.Application oa.activate(); PrintWriter out = getWriter(); - out.println("Collocation optimization on"); + out.println("Collocation optimization on"); int rs = run(prx, interceptor); if(rs == 0) { diff --git a/java/test/Ice/objects/AllTests.java b/java/test/Ice/objects/AllTests.java index e42ac1c167e..1e955dd02d5 100644 --- a/java/test/Ice/objects/AllTests.java +++ b/java/test/Ice/objects/AllTests.java @@ -41,7 +41,7 @@ public class AllTests public static InitialPrx allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { - out.print("testing stringToProxy... "); + out.print("testing stringToProxy... "); out.flush(); String ref = "initial:default -p 12010"; Ice.ObjectPrx base = communicator.stringToProxy(ref); diff --git a/java/test/Ice/packagemd/AllTests.java b/java/test/Ice/packagemd/AllTests.java index ed6cc29c751..525f02f51e5 100644 --- a/java/test/Ice/packagemd/AllTests.java +++ b/java/test/Ice/packagemd/AllTests.java @@ -33,7 +33,7 @@ public class AllTests public static InitialPrx allTests(Ice.Communicator communicator, PrintWriter out) { - out.print("testing stringToProxy... "); + out.print("testing stringToProxy... "); out.flush(); String ref = "initial:default -p 12010"; Ice.ObjectPrx base = communicator.stringToProxy(ref); diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java index 572c876e90d..aa23d04b40a 100644 --- a/java/test/Ice/servantLocator/AllTests.java +++ b/java/test/Ice/servantLocator/AllTests.java @@ -194,7 +194,7 @@ public class AllTests public static TestIntfPrx allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { - out.print("testing stringToProxy... "); + out.print("testing stringToProxy... "); out.flush(); String ref = "asm:default -p 12010"; Ice.ObjectPrx base = communicator.stringToProxy(ref); diff --git a/java/test/Ice/slicing/exceptions/AllTests.java b/java/test/Ice/slicing/exceptions/AllTests.java index e3e0c6dcfb2..331b6b15770 100644 --- a/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java/test/Ice/slicing/exceptions/AllTests.java @@ -673,7 +673,7 @@ public class AllTests public static TestIntfPrx allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out) { - out.print("testing stringToProxy... "); + out.print("testing stringToProxy... "); out.flush(); String ref = "Test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); diff --git a/java/test/Ice/stream/Client.java b/java/test/Ice/stream/Client.java index d6129f47b7e..0f7d46a55ef 100644 --- a/java/test/Ice/stream/Client.java +++ b/java/test/Ice/stream/Client.java @@ -173,7 +173,7 @@ public class Client extends test.Util.Application public int run(String[] args) { - Ice.Communicator comm = communicator(); + Ice.Communicator comm = communicator(); MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); comm.addObjectFactory(factoryWrapper, MyClass.ice_staticId()); comm.addObjectFactory(new MyInterfaceFactory(), _MyInterfaceDisp.ice_staticId()); diff --git a/java/test/Ice/udp/Server.java b/java/test/Ice/udp/Server.java index dd6bfb15adb..55c515cf267 100644 --- a/java/test/Ice/udp/Server.java +++ b/java/test/Ice/udp/Server.java @@ -46,7 +46,7 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/java/test/IceGrid/simple/Server.java b/java/test/IceGrid/simple/Server.java index 5f113d3dd56..c14745a05b4 100644 --- a/java/test/IceGrid/simple/Server.java +++ b/java/test/IceGrid/simple/Server.java @@ -50,8 +50,8 @@ public class Server extends test.Util.Application public static void main(String[] args) { - Server c = new Server(); - int status = c.main("test.IceGrid.simple.Server", args); + Server c = new Server(); + int status = c.main("test.IceGrid.simple.Server", args); System.gc(); System.exit(status); diff --git a/perf/include/IcePerf/Data.h b/perf/include/IcePerf/Data.h index 7da0ef73e73..457f32b2ac8 100644 --- a/perf/include/IcePerf/Data.h +++ b/perf/include/IcePerf/Data.h @@ -33,7 +33,7 @@ public: // interpretable by Python. // virtual void fmt(std::ostream&, const std::string& product, const std::string& name, const IceUtil::Time& duration, - const Ice::Int& repetitions, const Ice::Int& payloadSize, const int argc, char* argv[]); + const Ice::Int& repetitions, const Ice::Int& payloadSize, const int argc, char* argv[]); }; // @@ -44,7 +44,7 @@ public: // void IcePerf::TestPrinter::fmt(std::ostream& output, const std::string& product, const std::string& name, const IceUtil::Time& duration, - const Ice::Int& repetitions, const Ice::Int& payloadSize, const int argc, char* argv[]) + const Ice::Int& repetitions, const Ice::Int& payloadSize, const int argc, char* argv[]) { output << "{"; output << "'product' : '" << product << "', "; @@ -58,9 +58,9 @@ IcePerf::TestPrinter::fmt(std::ostream& output, const std::string& product, cons int i; for(i = 0; i < argc; ++i) { - if(i > 0) - output << ' '; - output << argv[i]; + if(i > 0) + output << ' '; + output << argv[i]; } output << "'"; output << "}"; diff --git a/perf/src/CosEvent/Consumer.cpp b/perf/src/CosEvent/Consumer.cpp index d216e9d6977..f24c6fbd62e 100644 --- a/perf/src/CosEvent/Consumer.cpp +++ b/perf/src/CosEvent/Consumer.cpp @@ -42,26 +42,26 @@ Consumer::run(int argc, char* argv[]) _nPublishers = 1; for(int i = 1; i < argc; i++) { - if(strcmp(argv[i], "-r") == 0) - { - repetitions = atoi(argv[++i]); - } - else if(strcmp(argv[i], "-w") == 0) - { - _payload = true; - } - else if(strcmp(argv[i], "-c") == 0) - { - _nPublishers = atoi(argv[++i]); - } - else if(strcmp(argv[i], "-n") == 0) - { - nthreads = atoi(argv[++i]); - } - else if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') - { - ior = strdup(argv[i]); - } + if(strcmp(argv[i], "-r") == 0) + { + repetitions = atoi(argv[++i]); + } + else if(strcmp(argv[i], "-w") == 0) + { + _payload = true; + } + else if(strcmp(argv[i], "-c") == 0) + { + _nPublishers = atoi(argv[++i]); + } + else if(strcmp(argv[i], "-n") == 0) + { + nthreads = atoi(argv[++i]); + } + else if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') + { + ior = strdup(argv[i]); + } } _nExpectedTicks = repetitions * _nPublishers; @@ -70,59 +70,59 @@ Consumer::run(int argc, char* argv[]) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - _orb = orb.in(); - - if(argc <= 1) - { - ACE_ERROR ((LM_ERROR, "Usage: Consumer <event_channel_ior>\n")); - return 1; - } - - CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - WorkerThread worker(orb.in()); - worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); - - object = orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::EventChannel_var event_channel = - CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::ConsumerAdmin_var consumer_admin = - event_channel->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::ProxyPushSupplier_var supplier = - consumer_admin->obtain_push_supplier(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventComm::PushConsumer_var consumer = _this(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - supplier->connect_push_consumer(consumer.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - cout << "Consumer ready" << endl; - - worker.thr_mgr()->wait(); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + _orb = orb.in(); + + if(argc <= 1) + { + ACE_ERROR ((LM_ERROR, "Usage: Consumer <event_channel_ior>\n")); + return 1; + } + + CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + WorkerThread worker(orb.in()); + worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); + + object = orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::EventChannel_var event_channel = + CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::ConsumerAdmin_var consumer_admin = + event_channel->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::ProxyPushSupplier_var supplier = + consumer_admin->obtain_push_supplier(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventComm::PushConsumer_var consumer = _this(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + supplier->connect_push_consumer(consumer.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + cout << "Consumer ready" << endl; + + worker.thr_mgr()->wait(); } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Consumer::run"); - return 1; + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Consumer::run"); + return 1; } ACE_ENDTRY; return 0; @@ -137,45 +137,45 @@ Consumer::push(const CORBA::Any& any ACE_ENV_ARG_DECL_NOT_USED) CORBA::LongLong time = 0; if(!_payload) { - any >>= time; + any >>= time; } else { - const Perf::Event* e; - any >>= e; - time = e->time; + const Perf::Event* e; + any >>= e; + time = e->time; } if(time > 0) { - add(time); + add(time); } else if(time == 0) { - if(_payload) - { - const Perf::Event* e; - any >>= e; - _payloadSize = 0; - _payloadSize += sizeof(e->time); - _payloadSize += sizeof(e->e); - _payloadSize += sizeof(e->i); - _payloadSize += sizeof(e->s.e); - _payloadSize += sizeof(e->s.d); - _payloadSize += strlen(e->s.s); - } - started(); + if(_payload) + { + const Perf::Event* e; + any >>= e; + _payloadSize = 0; + _payloadSize += sizeof(e->time); + _payloadSize += sizeof(e->e); + _payloadSize += sizeof(e->i); + _payloadSize += sizeof(e->s.e); + _payloadSize += sizeof(e->s.d); + _payloadSize += strlen(e->s.s); + } + started(); } else if(time == -1) { - if(stopped()) - { - _orb->shutdown(0 ACE_ENV_ARG_PARAMETER); - } + if(stopped()) + { + _orb->shutdown(0 ACE_ENV_ARG_PARAMETER); + } } else if(time < 0) { - cerr << "time < 0: " << time << endl; + cerr << "time < 0: " << time << endl; } } @@ -184,7 +184,7 @@ Consumer::started() { if(++_nStartedPublishers == _nPublishers) { - _startTime = IceUtil::Time::now().toMicroSeconds(); + _startTime = IceUtil::Time::now().toMicroSeconds(); } } @@ -202,23 +202,23 @@ Consumer::stopped() // if(_nStoppedPublishers == 0) { - _stopTime = IceUtil::Time::now().toMicroSeconds(); + _stopTime = IceUtil::Time::now().toMicroSeconds(); } if(_nStartedPublishers < _nPublishers) { - cerr << "Some publishers are already finished while others aren't even started" << endl; - cerr << _nPublishers << " " << _nStartedPublishers << " " << _nStoppedPublishers << endl; - cerr << _startTime - _stopTime << " " << _results.size() << endl; + cerr << "Some publishers are already finished while others aren't even started" << endl; + cerr << _nPublishers << " " << _nStartedPublishers << " " << _nStoppedPublishers << endl; + cerr << _startTime - _stopTime << " " << _results.size() << endl; } if(++_nStoppedPublishers == _nPublishers) { - calc(); - return true; + calc(); + return true; } else { - return false; + return false; } } @@ -231,19 +231,19 @@ Consumer::add(CORBA::LongLong time) // if(_nStartedPublishers == _nPublishers && _nStoppedPublishers == 0) { - // - // Save end to end time in microseconds. - // + // + // Save end to end time in microseconds. + // #ifdef WIN32 - LARGE_INTEGER t; - QueryPerformanceCounter(&t); - CORBA::LongLong interval = t.QuadPart - time; - QueryPerformanceFrequency(&t); - double t = (double)interval / t.QuadPart; - interval = (CORBA::LongLong)(t * 1000000); // Convert to microseconds. - _results.push_back(static_cast<long>(interval)); + LARGE_INTEGER t; + QueryPerformanceCounter(&t); + CORBA::LongLong interval = t.QuadPart - time; + QueryPerformanceFrequency(&t); + double t = (double)interval / t.QuadPart; + interval = (CORBA::LongLong)(t * 1000000); // Convert to microseconds. + _results.push_back(static_cast<long>(interval)); #else - _results.push_back((static_cast<long>(IceUtil::Time::now().toMicroSeconds() - time))); + _results.push_back((static_cast<long>(IceUtil::Time::now().toMicroSeconds() - time))); #endif } } @@ -260,7 +260,7 @@ Consumer::calc() double originalSize = _results.size(); if(_results.empty()) { - cout << "{ 'latency': -1.0, 'throughput': -1.0, 'deviation': -1.0 }" << flush; + cout << "{ 'latency': -1.0, 'throughput': -1.0, 'deviation': -1.0 }" << flush; } // @@ -271,20 +271,20 @@ Consumer::calc() double total = 0; { - for(vector<long>::const_iterator i = _results.begin(); i != _results.end(); ++i) - { - total += *i; - } + for(vector<long>::const_iterator i = _results.begin(); i != _results.end(); ++i) + { + total += *i; + } } double mean = total / _results.size(); double deviation; double x = 0.0; { - for(vector<long>::const_iterator i = _results.begin(); i != _results.end(); ++i) - { - x += (*i - mean) * (*i - mean); - } + for(vector<long>::const_iterator i = _results.begin(); i != _results.end(); ++i) + { + x += (*i - mean) * (*i - mean); + } } deviation = sqrt(x / (_results.size() - 1)); @@ -297,15 +297,15 @@ Consumer::calc() // if(originalSize < (_nExpectedTicks * 0.90)) { - cerr << "WARNING: Less than 90% of the expected ticks were used for the test. " << - _nExpectedTicks << " events were expected, but only " << originalSize << " were received.\n" << endl; - cerr << "The results are based on a smaller sample size and comparisons with other tests\n" - "may not be fair." << endl; + cerr << "WARNING: Less than 90% of the expected ticks were used for the test. " << + _nExpectedTicks << " events were expected, but only " << originalSize << " were received.\n" << endl; + cerr << "The results are based on a smaller sample size and comparisons with other tests\n" + "may not be fair." << endl; } cout << "{ 'latency' : " << mean / 1000 << ", 'deviation' : " << deviation << ", 'throughput' : " << - ((double)(originalSize * _payloadSize) / (1024^2)) / (_stopTime - _startTime) * 1000000.0 << - ", 'repetitions': " << originalSize << ", 'payload': " << _payloadSize << "}" << endl; + ((double)(originalSize * _payloadSize) / (1024^2)) / (_stopTime - _startTime) * 1000000.0 << + ", 'repetitions': " << originalSize << ", 'payload': " << _payloadSize << "}" << endl; _results.clear(); _nStartedPublishers = 0; diff --git a/perf/src/CosEvent/Consumer.h b/perf/src/CosEvent/Consumer.h index 919fbfb175b..af0e86da47e 100644 --- a/perf/src/CosEvent/Consumer.h +++ b/perf/src/CosEvent/Consumer.h @@ -21,9 +21,9 @@ public: int run(int argc, char* argv[]); virtual void push(const CORBA::Any &event ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void disconnect_push_consumer(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); private: diff --git a/perf/src/CosEvent/Destroyer.cpp b/perf/src/CosEvent/Destroyer.cpp index 34bf7880066..a9f2bac10dd 100644 --- a/perf/src/CosEvent/Destroyer.cpp +++ b/perf/src/CosEvent/Destroyer.cpp @@ -28,39 +28,39 @@ Destroyer::run(int argc, char* argv[]) CORBA::String_var ior; for(int i = 1; i < argc; i++) { - if(strlen(argv[i]) > 3 && strncmp(argv[i], "IOR", strlen("IOR"))) - { - ior = CORBA::string_dup(argv[i]); - } + if(strlen(argv[i]) > 3 && strncmp(argv[i], "IOR", strlen("IOR"))) + { + ior = CORBA::string_dup(argv[i]); + } } ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - if(argc <= 1) - { - ACE_ERROR ((LM_ERROR, "Usage: Destroyer <event_channel_ior>\n")); - return 1; - } + if(argc <= 1) + { + ACE_ERROR ((LM_ERROR, "Usage: Destroyer <event_channel_ior>\n")); + return 1; + } - CORBA::Object_var object = orb->string_to_object(ior.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::Object_var object = orb->string_to_object(ior.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - CosEventChannelAdmin::EventChannel_var event_channel = - CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CosEventChannelAdmin::EventChannel_var event_channel = + CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - // Destroy the EC.... - event_channel->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + // Destroy the EC.... + event_channel->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Destroyer::run"); - return 1; + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Destroyer::run"); + return 1; } ACE_ENDTRY; return 0; diff --git a/perf/src/CosEvent/Notifier.cpp b/perf/src/CosEvent/Notifier.cpp index d706e4cb47f..0251fd95334 100644 --- a/perf/src/CosEvent/Notifier.cpp +++ b/perf/src/CosEvent/Notifier.cpp @@ -20,54 +20,54 @@ public: int run(int argc, char* argv[]) { - vector<string> iors; - for(int i = 1; i < argc; i++) - { - if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') - { - iors.push_back(argv[i]); - } - } + vector<string> iors; + for(int i = 1; i < argc; i++) + { + if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') + { + iors.push_back(argv[i]); + } + } - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - if(argc <= 1) - { - ACE_ERROR ((LM_ERROR, "Usage: Notifier <event_channel_ior>\n")); - return 1; - } + if(argc <= 1) + { + ACE_ERROR ((LM_ERROR, "Usage: Notifier <event_channel_ior>\n")); + return 1; + } - vector<Perf::Sync_var> syncs; - for(vector<string>::const_iterator p = iors.begin(); p != iors.end(); ++p) - { - CORBA::Object_var object = orb->string_to_object(p->c_str() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + vector<Perf::Sync_var> syncs; + for(vector<string>::const_iterator p = iors.begin(); p != iors.end(); ++p) + { + CORBA::Object_var object = orb->string_to_object(p->c_str() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - Perf::Sync_var sync = Perf::Sync::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + Perf::Sync_var sync = Perf::Sync::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - syncs.push_back(Perf::Sync::_duplicate(sync.in())); - } + syncs.push_back(Perf::Sync::_duplicate(sync.in())); + } - for(vector<Perf::Sync_var>::const_iterator i = syncs.begin(); i != syncs.end(); ++i) - { - (*i)->notify(); - ACE_TRY_CHECK; - } + for(vector<Perf::Sync_var>::const_iterator i = syncs.begin(); i != syncs.end(); ++i) + { + (*i)->notify(); + ACE_TRY_CHECK; + } - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Notifier::run"); - return 1; - } - ACE_ENDTRY; - return 0; + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Notifier::run"); + return 1; + } + ACE_ENDTRY; + return 0; } }; diff --git a/perf/src/CosEvent/Service.cpp b/perf/src/CosEvent/Service.cpp index 5aeb71219d3..fd6d77e1368 100644 --- a/perf/src/CosEvent/Service.cpp +++ b/perf/src/CosEvent/Service.cpp @@ -20,19 +20,19 @@ class EventChannel : public TAO_CEC_EventChannel public: EventChannel(CORBA::ORB* orb, - const TAO_CEC_EventChannel_Attributes& attr, - TAO_CEC_Factory* factory = 0, - int own_factory = 0) : - TAO_CEC_EventChannel(attr, factory, own_factory), - _orb(CORBA::ORB::_duplicate(orb)) + const TAO_CEC_EventChannel_Attributes& attr, + TAO_CEC_Factory* factory = 0, + int own_factory = 0) : + TAO_CEC_EventChannel(attr, factory, own_factory), + _orb(CORBA::ORB::_duplicate(orb)) { } void destroy(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO_CEC_EventChannel::destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - _orb->shutdown(0 ACE_ENV_ARG_PARAMETER); + TAO_CEC_EventChannel::destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + _orb->shutdown(0 ACE_ENV_ARG_PARAMETER); } private: @@ -48,59 +48,59 @@ main(int argc, char* argv[]) int nthreads = 1; for(int i = 1; i < argc; i++) { - if(strcmp(argv[i], "-n") == 0) - { - nthreads = atoi(argv[++i]); - } + if(strcmp(argv[i], "-n") == 0) + { + nthreads = atoi(argv[++i]); + } } ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - TAO_CEC_EventChannel_Attributes attributes(poa.in(), poa.in()); - - EventChannel ec_impl(orb.in(), attributes); - ec_impl.activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::EventChannel_var event_channel = ec_impl._this(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = orb->object_to_string(event_channel.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in())); - - // If the ior_output_file exists, output the ior to it - if(ior_output_file != 0) - { - FILE *output_file= ACE_OS::fopen(ior_output_file, "w"); - if(output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); - ACE_OS::fprintf(output_file, "%s", ior.in()); - ACE_OS::fclose(output_file); - } - - WorkerThread worker(orb.in()); - worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); - worker.thr_mgr()->wait(); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_CEC_EventChannel_Attributes attributes(poa.in(), poa.in()); + + EventChannel ec_impl(orb.in(), attributes); + ec_impl.activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::EventChannel_var event_channel = ec_impl._this(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = orb->object_to_string(event_channel.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in())); + + // If the ior_output_file exists, output the ior to it + if(ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen(ior_output_file, "w"); + if(output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); + ACE_OS::fprintf(output_file, "%s", ior.in()); + ACE_OS::fclose(output_file); + } + + WorkerThread worker(orb.in()); + worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); + worker.thr_mgr()->wait(); } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Service"); - return 1; + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Service"); + return 1; } ACE_ENDTRY; return 0; diff --git a/perf/src/CosEvent/Supplier.cpp b/perf/src/CosEvent/Supplier.cpp index 8b98f4acfee..addcdfe5fda 100644 --- a/perf/src/CosEvent/Supplier.cpp +++ b/perf/src/CosEvent/Supplier.cpp @@ -44,21 +44,21 @@ class Sync_impl : public POA_Perf::Sync, public PortableServer::RefCountServantB public: Sync_impl() : - _semaphore(0) + _semaphore(0) { } void wait() { - _semaphore.acquire(); + _semaphore.acquire(); } virtual void notify() - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - _semaphore.release(); + _semaphore.release(); } private: @@ -76,175 +76,175 @@ Supplier::run(int argc, char* argv[]) int nthreads = 1; for(int i = 1; i < argc; i++) { - if(strcmp(argv[i], "-p") == 0) - { - period = atoi(argv[++i]); - } - else if(strcmp(argv[i], "-r") == 0) - { - repetitions = atoi(argv[++i]); - } - else if(strcmp(argv[i], "-w") == 0) - { - payload = true; - } - else if(strcmp(argv[i], "-n") == 0) - { - nthreads = atoi(argv[++i]); - } - else if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') - { - ior = CORBA::string_dup(argv[i]); - } + if(strcmp(argv[i], "-p") == 0) + { + period = atoi(argv[++i]); + } + else if(strcmp(argv[i], "-r") == 0) + { + repetitions = atoi(argv[++i]); + } + else if(strcmp(argv[i], "-w") == 0) + { + payload = true; + } + else if(strcmp(argv[i], "-n") == 0) + { + nthreads = atoi(argv[++i]); + } + else if(strlen(argv[i]) > 3 && argv[i][0] == 'I' && argv[i][1] == 'O' && argv[i][2] == 'R') + { + ior = CORBA::string_dup(argv[i]); + } } ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if(argc <= 1) - { - ACE_ERROR ((LM_ERROR, "Usage: Supplier <event_channel_ior>\n")); - return 1; - } - - CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if(argc <= 1) + { + ACE_ERROR ((LM_ERROR, "Usage: Supplier <event_channel_ior>\n")); + return 1; + } + + CORBA::Object_var object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var poa = PortableServer::POA::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POAManager_var poa_manager = poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - object = orb->string_to_object(ior.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::EventChannel_var event_channel = - CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventChannelAdmin::SupplierAdmin_var supplier_admin = - event_channel->for_suppliers(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + object = orb->string_to_object(ior.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::EventChannel_var event_channel = + CosEventChannelAdmin::EventChannel::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventChannelAdmin::SupplierAdmin_var supplier_admin = + event_channel->for_suppliers(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - CosEventChannelAdmin::ProxyPushConsumer_var consumer = - supplier_admin->obtain_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosEventComm::PushSupplier_var supplier = _this(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - consumer->connect_push_supplier(supplier.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CosEventChannelAdmin::ProxyPushConsumer_var consumer = + supplier_admin->obtain_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CosEventComm::PushSupplier_var supplier = _this(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + consumer->connect_push_supplier(supplier.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - // - // Start the ORB. - // - WorkerThread worker(orb.in()); - worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); - - Sync_impl* syncImpl = new Sync_impl; - PortableServer::ServantBase_var servant = syncImpl; + // + // Start the ORB. + // + WorkerThread worker(orb.in()); + worker.activate(THR_NEW_LWP | THR_JOINABLE, nthreads, 1); + + Sync_impl* syncImpl = new Sync_impl; + PortableServer::ServantBase_var servant = syncImpl; - // - // Note that the Sync servant will be instantiated on the default - // ORB and default POA. - // - CORBA::Object_var obj = syncImpl->_this(); - Perf::Sync_var sync = Perf::Sync::_narrow(obj); + // + // Note that the Sync servant will be instantiated on the default + // ORB and default POA. + // + CORBA::Object_var obj = syncImpl->_this(); + Perf::Sync_var sync = Perf::Sync::_narrow(obj); - ACE_Time_Value sleep_time(0, period * 1000); + ACE_Time_Value sleep_time(0, period * 1000); - ior = orb->object_to_string(sync.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - cout << ior.in() << endl; - cout << "Supplier ready" << endl; - syncImpl->wait(); - - if(!payload) - { - { - CORBA::Any event; - event <<= CORBA::LongLong(0); - consumer->push(event ACE_ENV_ARG_PARAMETER); - } - for(int i = 0; i < repetitions; ++i) - { - CORBA::Any event; - CORBA::LongLong start = getTick(); - event <<= start; - - consumer->push(event ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if(period > 0) - { - ACE_OS::sleep(sleep_time); - } - } - { - CORBA::Any event; - event <<= CORBA::LongLong(-1); - consumer->push(event ACE_ENV_ARG_PARAMETER); - } - } - else - { - { - CORBA::Any event; - Perf::Event e; - e.time = 0; - event <<= e; - consumer->push(event ACE_ENV_ARG_PARAMETER); - } - for(int i = 0; i < repetitions; ++i) - { - Perf::Event e; - e.e = Perf::A; - e.i = 10; - e.s.s = "TEST"; - e.time = getTick(); - CORBA::Any event; - event <<= e; - consumer->push(event ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if(period > 0) - { - ACE_OS::sleep(sleep_time); - } - } - { - CORBA::Any event; - Perf::Event e; - e.time = -1; - event <<= e; - consumer->push(event ACE_ENV_ARG_PARAMETER); - } - } - - // Disconnect from the EC - consumer->disconnect_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + ior = orb->object_to_string(sync.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + cout << ior.in() << endl; + cout << "Supplier ready" << endl; + syncImpl->wait(); + + if(!payload) + { + { + CORBA::Any event; + event <<= CORBA::LongLong(0); + consumer->push(event ACE_ENV_ARG_PARAMETER); + } + for(int i = 0; i < repetitions; ++i) + { + CORBA::Any event; + CORBA::LongLong start = getTick(); + event <<= start; + + consumer->push(event ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if(period > 0) + { + ACE_OS::sleep(sleep_time); + } + } + { + CORBA::Any event; + event <<= CORBA::LongLong(-1); + consumer->push(event ACE_ENV_ARG_PARAMETER); + } + } + else + { + { + CORBA::Any event; + Perf::Event e; + e.time = 0; + event <<= e; + consumer->push(event ACE_ENV_ARG_PARAMETER); + } + for(int i = 0; i < repetitions; ++i) + { + Perf::Event e; + e.e = Perf::A; + e.i = 10; + e.s.s = "TEST"; + e.time = getTick(); + CORBA::Any event; + event <<= e; + consumer->push(event ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if(period > 0) + { + ACE_OS::sleep(sleep_time); + } + } + { + CORBA::Any event; + Perf::Event e; + e.time = -1; + event <<= e; + consumer->push(event ACE_ENV_ARG_PARAMETER); + } + } + + // Disconnect from the EC + consumer->disconnect_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - // Deactivate this object... - PortableServer::ObjectId_var id = poa->servant_to_id(this ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - poa->deactivate_object(id.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Destroy the POA - poa->destroy(1, 0 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // Deactivate this object... + PortableServer::ObjectId_var id = poa->servant_to_id(this ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + poa->deactivate_object(id.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Destroy the POA + poa->destroy(1, 0 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - orb->shutdown(1); - worker.thr_mgr()->wait(); + orb->shutdown(1); + worker.thr_mgr()->wait(); } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Supplier::run"); - return 1; + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Supplier::run"); + return 1; } ACE_ENDTRY; return 0; diff --git a/perf/src/Ice/dummy/Client.cpp b/perf/src/Ice/dummy/Client.cpp index 588a6c10e69..a84943c7715 100644 --- a/perf/src/Ice/dummy/Client.cpp +++ b/perf/src/Ice/dummy/Client.cpp @@ -50,10 +50,10 @@ using namespace std; char request[41] = { 0x49, 0x63, 0x65, 0x50, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, - 0x63, 0x79, 0x00, 0x00, 0x04, 0x70, 0x69, 0x6e, - 0x67, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, - 0x00 }; + 0x00, 0x00, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, + 0x63, 0x79, 0x00, 0x00, 0x04, 0x70, 0x69, 0x6e, + 0x67, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, + 0x00 }; int main(int argc, char* argv[]) @@ -73,7 +73,7 @@ main(int argc, char* argv[]) if(fd == INVALID_SOCKET) { cerr << "Create socket failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } struct sockaddr_in addr; @@ -108,10 +108,10 @@ main(int argc, char* argv[]) for(int i = 0; i < repetitions; ++i) { char* id = reinterpret_cast<char*>(&repetitions); - for(unsigned int j = 0; j < sizeof(int); ++j) - { - request[j + 14] = id[j]; - } + for(unsigned int j = 0; j < sizeof(int); ++j) + { + request[j + 14] = id[j]; + } if(::send(fd, request, 41, 0) != 41) { diff --git a/perf/src/Ice/dummy/Server.cpp b/perf/src/Ice/dummy/Server.cpp index 793cf846d3b..b1e4c61a265 100644 --- a/perf/src/Ice/dummy/Server.cpp +++ b/perf/src/Ice/dummy/Server.cpp @@ -73,7 +73,7 @@ main(int argc, char* argv[]) if(fd == INVALID_SOCKET) { cerr << "Create socket failed! " << WSAGetLastError() << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } struct sockaddr_in addr; @@ -85,13 +85,13 @@ main(int argc, char* argv[]) if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR) { cerr << "Bind failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } if(::listen(fd, 5) == SOCKET_ERROR) { cerr << "Listen failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } cout << "Latency ready" << endl; @@ -100,7 +100,7 @@ main(int argc, char* argv[]) if(fd2 == INVALID_SOCKET) { cerr << "Accept failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } if(::send(fd2, validate, 14, 0) != 14) @@ -123,10 +123,10 @@ main(int argc, char* argv[]) return EXIT_FAILURE; } - for(unsigned int i = 0; i < sizeof(int); ++i) - { - response[i + 14] = buffer[i]; - } + for(unsigned int i = 0; i < sizeof(int); ++i) + { + response[i + 14] = buffer[i]; + } if(::send(fd2, response, 25, 0) != 25) { diff --git a/perf/src/Ice/latency/Client.cpp b/perf/src/Ice/latency/Client.cpp index fa9b7760718..51b171cd3c9 100644 --- a/perf/src/Ice/latency/Client.cpp +++ b/perf/src/Ice/latency/Client.cpp @@ -26,11 +26,11 @@ public: waitFinished() { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_finished) - { - wait(); - } - _finished = false; + while(!_finished) + { + wait(); + } + _finished = false; } private: @@ -38,9 +38,9 @@ private: ice_response() { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_finished); - _finished = true; - notify(); + assert(!_finished); + _finished = true; + notify(); } virtual void @@ -58,35 +58,35 @@ class AMI_Latency_withDataI : public Demo::AMI_Latency_withData, IceUtil::Monito { public: AMI_Latency_withDataI() : - _finished(false) + _finished(false) { } void waitFinished() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_finished) - { - wait(); - } - _finished = false; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_finished) + { + wait(); + } + _finished = false; } private: virtual void ice_response() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_finished); - _finished = true; - notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_finished); + _finished = true; + notify(); } virtual void ice_exception(const ::Ice::Exception&) { - assert(false); + assert(false); } bool _finished; @@ -98,7 +98,7 @@ class TestAdapter { public: TestAdapter(const LatencyPrx prx) : - _prx(prx) + _prx(prx) { } @@ -111,7 +111,7 @@ public: virtual void flush() { - _prx->ice_getConnection()->flushBatchRequests(); + _prx->ice_getConnection()->flushBatchRequests(); } protected: @@ -122,22 +122,22 @@ class NoPayload : public TestAdapter { public: NoPayload(const LatencyPrx prx): - TestAdapter(prx), - _cb(new AMI_Latency_pingI) + TestAdapter(prx), + _cb(new AMI_Latency_pingI) { } virtual void doIt() { - _prx->ping(); + _prx->ping(); } virtual void doItAsync() { - _prx->ping_async(_cb); - _cb->waitFinished(); + _prx->ping_async(_cb); + _cb->waitFinished(); } private: @@ -148,25 +148,25 @@ class WithPayload : public TestAdapter { public: WithPayload(const LatencyPrx prx, const long payLoadSize): - TestAdapter(prx), _payload(payLoadSize), _cb(new AMI_Latency_withDataI) + TestAdapter(prx), _payload(payLoadSize), _cb(new AMI_Latency_withDataI) { - for(long i = 0; i < payLoadSize; ++i) - { - _payload[i] = '0' + (char)(i % 10); - } + for(long i = 0; i < payLoadSize; ++i) + { + _payload[i] = '0' + (char)(i % 10); + } } virtual void doIt() { - _prx->withData(_payload); + _prx->withData(_payload); } virtual void doItAsync() { - _prx->withData_async(_cb, _payload); - _cb->waitFinished(); + _prx->withData_async(_cb, _payload); + _cb->waitFinished(); } private: @@ -179,11 +179,11 @@ createAdapter(const LatencyPrx prx, const long payLoadSize) { if(payLoadSize > 0) { - return new WithPayload(prx, payLoadSize); + return new WithPayload(prx, payLoadSize); } else { - return new NoPayload(prx); + return new NoPayload(prx); } return 0; } @@ -200,49 +200,49 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) for(i = 0; i < argc; i++) { - if(strcmp(argv[i], "oneway") == 0) - { - oneway = true; - } - else if(strcmp(argv[i], "batch") == 0) - { - batch = true; - } - else if(strcmp(argv[i], "twoway") == 0) - { - twoway = true; - } - else if(strcmp(argv[i], "ami") == 0) - { - ami = true; - } - else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) - { - payLoadSize = strtol(argv[i] + strlen("--payload="), 0, 10); - if(errno == ERANGE) - { - cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; - return EXIT_FAILURE; - } - } + if(strcmp(argv[i], "oneway") == 0) + { + oneway = true; + } + else if(strcmp(argv[i], "batch") == 0) + { + batch = true; + } + else if(strcmp(argv[i], "twoway") == 0) + { + twoway = true; + } + else if(strcmp(argv[i], "ami") == 0) + { + ami = true; + } + else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) + { + payLoadSize = strtol(argv[i] + strlen("--payload="), 0, 10); + if(errno == ERANGE) + { + cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; + return EXIT_FAILURE; + } + } } if(!oneway && !twoway && !batch) { - twoway = true; + twoway = true; } int repetitions = 0; if(twoway) { - repetitions = 100000; + repetitions = 100000; } else if(oneway) { - repetitions = 500000; + repetitions = 500000; } else if(batch) { - repetitions = 1000000; + repetitions = 1000000; } Ice::PropertiesPtr properties = communicator->getProperties(); @@ -251,16 +251,16 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) if(proxy.empty()) { - cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator->stringToProxy(proxy); LatencyPrx latency = LatencyPrx::uncheckedCast(base); if(!latency) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } // Initial ping to setup the connection. @@ -275,66 +275,66 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) TestAdapter* adapter = 0; try { - if(batch) - { - adapter = createAdapter(LatencyPrx::uncheckedCast(base->ice_batchOneway()), payLoadSize); - } - else if(oneway) - { - adapter = createAdapter(LatencyPrx::uncheckedCast(base->ice_oneway()), payLoadSize); - } - else - { - adapter = createAdapter(latency, payLoadSize); - } - - // - // MAIN TEST LOOP. - // - IceUtil::Time tm = IceUtil::Time::now(); - for(i = 0; i < repetitions; ++i) - { - if(batch) - { - if(i != 0 && i % 100 == 0) - { - adapter->flush(); - } - } - if(ami) - { - adapter->doItAsync(); - } - else - { - adapter->doIt(); - } - } - // - // END OF MAIN TEST LOOP - // - - // - // Tidy up laggart requests. - // - if(oneway || batch) - { - if(batch) - { - adapter->flush(); - } - latency->ping(); - } - - IcePerf::TestPrinter formatter; - formatter.fmt(cout, "Ice", "latency", IceUtil::Time::now() - tm, repetitions, payLoadSize * sizeof(Ice::Byte), argc, argv); - latency->shutdown(); - delete adapter; + if(batch) + { + adapter = createAdapter(LatencyPrx::uncheckedCast(base->ice_batchOneway()), payLoadSize); + } + else if(oneway) + { + adapter = createAdapter(LatencyPrx::uncheckedCast(base->ice_oneway()), payLoadSize); + } + else + { + adapter = createAdapter(latency, payLoadSize); + } + + // + // MAIN TEST LOOP. + // + IceUtil::Time tm = IceUtil::Time::now(); + for(i = 0; i < repetitions; ++i) + { + if(batch) + { + if(i != 0 && i % 100 == 0) + { + adapter->flush(); + } + } + if(ami) + { + adapter->doItAsync(); + } + else + { + adapter->doIt(); + } + } + // + // END OF MAIN TEST LOOP + // + + // + // Tidy up laggart requests. + // + if(oneway || batch) + { + if(batch) + { + adapter->flush(); + } + latency->ping(); + } + + IcePerf::TestPrinter formatter; + formatter.fmt(cout, "Ice", "latency", IceUtil::Time::now() - tm, repetitions, payLoadSize * sizeof(Ice::Byte), argc, argv); + latency->shutdown(); + delete adapter; } catch(...) { - delete adapter; - throw; + delete adapter; + throw; } return EXIT_SUCCESS; } @@ -347,29 +347,29 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->load("config"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex << endl; - status = EXIT_FAILURE; + cerr << ex << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/Ice/latency/Server.cpp b/perf/src/Ice/latency/Server.cpp index 49b8ed9782d..fb5b8db3800 100644 --- a/perf/src/Ice/latency/Server.cpp +++ b/perf/src/Ice/latency/Server.cpp @@ -23,13 +23,13 @@ class LatencyI : public Latency virtual void withData(const ByteSeq&, const Ice::Current&) { - // We don't need to do anything here. + // We don't need to do anything here. } virtual void shutdown(const Ice::Current& current) { - current.adapter->getCommunicator()->shutdown(); + current.adapter->getCommunicator()->shutdown(); } }; @@ -52,29 +52,29 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->load("config"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex << endl; - status = EXIT_FAILURE; + cerr << ex << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/Ice/raw/cpp/Client.cpp b/perf/src/Ice/raw/cpp/Client.cpp index ba90ddab168..1cb37841d53 100644 --- a/perf/src/Ice/raw/cpp/Client.cpp +++ b/perf/src/Ice/raw/cpp/Client.cpp @@ -88,7 +88,7 @@ const char closeConnectionMsg = 4; // The request header, batch request header and reply header. // -const char magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' +const char magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' const char requestHdr[] = { @@ -226,17 +226,17 @@ run(SOCKET fd) int size = sizeof(header); while(len != size) { - int n = ::recv(fd, &header[len], size - len, 0); - if(n <= 0) - { - return; - } - len += n; + int n = ::recv(fd, &header[len], size - len, 0); + if(n <= 0) + { + return; + } + len += n; } // Process validation message. assert(header[0] == Protocol::magic[0] && header[1] == Protocol::magic[1] && - header[2] == Protocol::magic[2] && header[3] == Protocol::magic[3]); + header[2] == Protocol::magic[2] && header[3] == Protocol::magic[3]); offset = 4; char pMajor = header[offset++]; @@ -270,27 +270,27 @@ run(SOCKET fd) int repetitions = 200; for (int i = 0; i < repetitions; ++i) { - // Request message body. - offset = 14; - putInt(req, offset, requestId); - ++requestId; - - if(::send(fd, req, sizeof(req), 0) != sizeof(req)) - { - return; - } - - len = 0; - size = sizeof(reply); - while(len != size) - { - int n = ::recv(fd, &reply[len], size-len, 0); - if(n <= 0) - { - return; - } - len += n; - } + // Request message body. + offset = 14; + putInt(req, offset, requestId); + ++requestId; + + if(::send(fd, req, sizeof(req), 0) != sizeof(req)) + { + return; + } + + len = 0; + size = sizeof(reply); + while(len != size) + { + int n = ::recv(fd, &reply[len], size-len, 0); + if(n <= 0) + { + return; + } + len += n; + } } #ifdef WIN32 @@ -312,7 +312,7 @@ main(int argc, char* argv[]) WSADATA data; if(WSAStartup(version, &data) != 0) { - cerr << "WSAStartup failed!" << endl; + cerr << "WSAStartup failed!" << endl; } #endif @@ -321,8 +321,8 @@ main(int argc, char* argv[]) SOCKET fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if(fd == INVALID_SOCKET) { - cerr << "Create socket failed!" << endl; - return EXIT_FAILURE; + cerr << "Create socket failed!" << endl; + return EXIT_FAILURE; } struct sockaddr_in addr; @@ -333,8 +333,8 @@ main(int argc, char* argv[]) if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR) { - cerr << "Connect failed!" << endl; - return EXIT_FAILURE; + cerr << "Connect failed!" << endl; + return EXIT_FAILURE; } run(fd); diff --git a/perf/src/Ice/raw/cpp/Server.cpp b/perf/src/Ice/raw/cpp/Server.cpp index 3fccab79d42..094cbab127a 100644 --- a/perf/src/Ice/raw/cpp/Server.cpp +++ b/perf/src/Ice/raw/cpp/Server.cpp @@ -89,7 +89,7 @@ const char closeConnectionMsg = 4; // The request header, batch request header and reply header. // -const char magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' +const char magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' const char requestHdr[] = { @@ -189,7 +189,7 @@ readSize(char* base, int& offset) int sz = base[offset++]; if(sz == 255) { - return getInt(base, offset); + return getInt(base, offset); } return sz; } @@ -199,14 +199,14 @@ rawcmp(char* src, int srcLen, char* dest, int offset, int len) { if(srcLen != len) { - return false; + return false; } for(int i = 0; i < len; ++i) { - if(src[i] != dest[i+offset]) - { - return false; - } + if(src[i] != dest[i+offset]) + { + return false; + } } return true; } @@ -232,7 +232,7 @@ run(SOCKET fd) if(::send(fd, header, sizeof(header), 0) != sizeof(header)) { - return; + return; } char req[500042]; @@ -269,113 +269,113 @@ run(SOCKET fd) // while(true) { - int len = 0; - while(len != sizeof(header)) - { - int n = ::recv(fd, &header[len], sizeof(header) - len, 0); - if(n <= 0) - { - return; - } - len += n; - } - - assert(header[0] == Protocol::magic[0] && header[1] == Protocol::magic[1] && - header[2] == Protocol::magic[2] && header[3] == Protocol::magic[3]); - - offset = 4; - char pMajor = header[offset++]; - assert(pMajor == Protocol::protocolMajor); - //char pMinor = header[offset++]; - offset++; - - char eMajor = header[offset++]; - assert(eMajor == Protocol::encodingMajor); - //char eMinor = header[offset++]; - offset++; - - char messageType = header[offset++]; - //char compress = header[offset++]; - offset++; - int size = getInt(header, offset); - //Console.WriteLine("size: " + size); - - if(messageType == Protocol::closeConnectionMsg) - { - return; - } - if(messageType != Protocol::requestMsg) - { - cerr << "unexpected message: " << messageType << endl; - return; - } - - size -= Protocol::headerSize; - if(size < 0 || size > sizeof(req)) - { - cerr << "booting client: unsupported size" << endl; - return; - } - //assert(size <= req.Length); - - len = 0; - while(len != size) - { - int n = ::recv(fd, &req[len], size - len, 0); - if(n <= 0) - { - return; - } - //Console.WriteLine("read: " + n); - len += n; - } - - offset = 0; - int requestId = getInt(req, offset); - - // id - int sz = readSize(req, offset); - offset += sz; - sz = readSize(req, offset); - offset += sz; - assert(req[offset] == 0); - ++offset; // facet - // operation - sz = readSize(req, offset); - - if(!rawcmp(opIceIsA, sizeof(opIceIsA)-1, req, offset, sz) && - !rawcmp(opIcePing, sizeof(opIcePing)-1, req, offset, sz) && - !rawcmp(opSendByteSeq, sizeof(opSendByteSeq)-1, req, offset, sz)) - { - string op(&req[offset], sz); - cerr << "unsupported op: " << op << endl; - return; - } - - - char* r; - int l; - if(rawcmp(opIceIsA, sizeof(opIceIsA)-1, req, offset, sz)) - { - r = isaReply; - l = sizeof(isaReply); - } - else - { - r = reply; - l = sizeof(reply); - } - - // - // Compose the reply. - // - offset = 14; - putInt(r, offset, requestId); - - if(::send(fd, r, l, 0) != l) - { - return; - } + int len = 0; + while(len != sizeof(header)) + { + int n = ::recv(fd, &header[len], sizeof(header) - len, 0); + if(n <= 0) + { + return; + } + len += n; + } + + assert(header[0] == Protocol::magic[0] && header[1] == Protocol::magic[1] && + header[2] == Protocol::magic[2] && header[3] == Protocol::magic[3]); + + offset = 4; + char pMajor = header[offset++]; + assert(pMajor == Protocol::protocolMajor); + //char pMinor = header[offset++]; + offset++; + + char eMajor = header[offset++]; + assert(eMajor == Protocol::encodingMajor); + //char eMinor = header[offset++]; + offset++; + + char messageType = header[offset++]; + //char compress = header[offset++]; + offset++; + int size = getInt(header, offset); + //Console.WriteLine("size: " + size); + + if(messageType == Protocol::closeConnectionMsg) + { + return; + } + if(messageType != Protocol::requestMsg) + { + cerr << "unexpected message: " << messageType << endl; + return; + } + + size -= Protocol::headerSize; + if(size < 0 || size > sizeof(req)) + { + cerr << "booting client: unsupported size" << endl; + return; + } + //assert(size <= req.Length); + + len = 0; + while(len != size) + { + int n = ::recv(fd, &req[len], size - len, 0); + if(n <= 0) + { + return; + } + //Console.WriteLine("read: " + n); + len += n; + } + + offset = 0; + int requestId = getInt(req, offset); + + // id + int sz = readSize(req, offset); + offset += sz; + sz = readSize(req, offset); + offset += sz; + assert(req[offset] == 0); + ++offset; // facet + // operation + sz = readSize(req, offset); + + if(!rawcmp(opIceIsA, sizeof(opIceIsA)-1, req, offset, sz) && + !rawcmp(opIcePing, sizeof(opIcePing)-1, req, offset, sz) && + !rawcmp(opSendByteSeq, sizeof(opSendByteSeq)-1, req, offset, sz)) + { + string op(&req[offset], sz); + cerr << "unsupported op: " << op << endl; + return; + } + + + char* r; + int l; + if(rawcmp(opIceIsA, sizeof(opIceIsA)-1, req, offset, sz)) + { + r = isaReply; + l = sizeof(isaReply); + } + else + { + r = reply; + l = sizeof(reply); + } + + // + // Compose the reply. + // + offset = 14; + putInt(r, offset, requestId); + + if(::send(fd, r, l, 0) != l) + { + return; + } } } @@ -399,7 +399,7 @@ main(int argc, char* argv[]) #else cerr << "Create socket failed! " << errno << endl; #endif - return EXIT_FAILURE; + return EXIT_FAILURE; } struct sockaddr_in addr; @@ -411,32 +411,32 @@ main(int argc, char* argv[]) if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR) { cerr << "Bind failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } if(::listen(fd, 5) == SOCKET_ERROR) { cerr << "Listen failed!" << endl; - return EXIT_FAILURE; + return EXIT_FAILURE; } cout << "Server ready" << endl; while(true) { - SOCKET fd2 = ::accept(fd, 0, 0); - if(fd2 == INVALID_SOCKET) - { - cerr << "Accept failed!" << endl; - return EXIT_FAILURE; - } - cout << "Accepted new client" << endl; - run(fd2); - cout << "Disconnected client" << endl; + SOCKET fd2 = ::accept(fd, 0, 0); + if(fd2 == INVALID_SOCKET) + { + cerr << "Accept failed!" << endl; + return EXIT_FAILURE; + } + cout << "Accepted new client" << endl; + run(fd2); + cout << "Disconnected client" << endl; #ifdef WIN32 - ::closesocket(fd2); + ::closesocket(fd2); #else - ::close(fd2); + ::close(fd2); #endif } diff --git a/perf/src/Ice/raw/cs/Client.cs b/perf/src/Ice/raw/cs/Client.cs index a3cc96298cf..a52adba67e8 100644 --- a/perf/src/Ice/raw/cs/Client.cs +++ b/perf/src/Ice/raw/cs/Client.cs @@ -25,7 +25,7 @@ sealed class Protocol // The magic number at the front of each message // internal static readonly byte[] magic - = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P' + = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P' // // The current Ice protocol and encoding version @@ -46,37 +46,37 @@ sealed class Protocol internal static readonly byte[] requestHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.requestMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.requestMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). }; internal static readonly byte[] requestBatchHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.requestBatchMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.requestBatchMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). }; internal static readonly byte[] replyHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.replyMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.replyMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). }; } @@ -86,163 +86,163 @@ public class Client public enum ByteOrder { BIG_ENDIAN, LITTLE_ENDIAN }; private class NO // Native Order { - static NO() - { - byte[] b = BitConverter.GetBytes((int)1); - _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; - } - internal static readonly ByteOrder _o; + static NO() + { + byte[] b = BitConverter.GetBytes((int)1); + _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; + } + internal static readonly ByteOrder _o; } //static ByteOrder _order = ByteOrder.BIG_ENDIAN; static ByteOrder _order = ByteOrder.LITTLE_ENDIAN; static unsafe void putInt(ref byte[] buf, ref int pos, int val) { - if(NO._o == _order) - { - fixed(byte* p = &buf[pos]) - { - *((int*)p) = val; - } - pos += 4; - } - else - { - byte* p = (byte*)&val; - buf[pos++] = *(p+3); - buf[pos++] = *(p+2); - buf[pos++] = *(p+1); - buf[pos++] = *(p+0); - } + if(NO._o == _order) + { + fixed(byte* p = &buf[pos]) + { + *((int*)p) = val; + } + pos += 4; + } + else + { + byte* p = (byte*)&val; + buf[pos++] = *(p+3); + buf[pos++] = *(p+2); + buf[pos++] = *(p+1); + buf[pos++] = *(p+0); + } } static unsafe int getInt(byte[] buf, ref int pos) { - int ret; - if(NO._o == _order) - { - fixed(byte* p = &buf[pos]) - { - ret = *((int*)p); - } - } - else - { - byte* p = (byte*)&ret; - *p++ = buf[pos+3]; - *p++ = buf[pos+2]; - *p++ = buf[pos+1]; - *p = buf[pos+0]; - } - pos += 4; - return ret; + int ret; + if(NO._o == _order) + { + fixed(byte* p = &buf[pos]) + { + ret = *((int*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = buf[pos+3]; + *p++ = buf[pos+2]; + *p++ = buf[pos+1]; + *p = buf[pos+0]; + } + pos += 4; + return ret; } public static void run(Socket sock) { - System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); + System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); - int seq = 500000; - byte[] req = new byte[seq + Protocol.headerSize + 42]; // 42 is the size of the message header - Array.Copy(Protocol.requestHdr, 0, req, 0, Protocol.headerSize); + int seq = 500000; + byte[] req = new byte[seq + Protocol.headerSize + 42]; // 42 is the size of the message header + Array.Copy(Protocol.requestHdr, 0, req, 0, Protocol.headerSize); - int offset = 10; - putInt(ref req, ref offset, req.Length); - putInt(ref req, ref offset, 0); // request id - String idName = "throughput"; - req[offset++] = (byte)idName.Length; - byte[] data = utf8.GetBytes(idName); - Array.Copy(data, 0, req, offset, data.Length); - offset += data.Length; + int offset = 10; + putInt(ref req, ref offset, req.Length); + putInt(ref req, ref offset, 0); // request id + String idName = "throughput"; + req[offset++] = (byte)idName.Length; + byte[] data = utf8.GetBytes(idName); + Array.Copy(data, 0, req, offset, data.Length); + offset += data.Length; - req[offset++] = 0; - req[offset++] = 0; // facet + req[offset++] = 0; + req[offset++] = 0; // facet - String opName = "sendByteSeq"; // operation name - req[offset++] = (byte)opName.Length; - data = utf8.GetBytes(opName); - Array.Copy(data, 0, req, offset, data.Length); - offset += data.Length; + String opName = "sendByteSeq"; // operation name + req[offset++] = (byte)opName.Length; + data = utf8.GetBytes(opName); + Array.Copy(data, 0, req, offset, data.Length); + offset += data.Length; - req[offset++] = 0; // mode - req[offset++] = 0; // context - + req[offset++] = 0; // mode + req[offset++] = 0; // context + // encapsulation for the sendByteSeq request data. - putInt(ref req, ref offset, seq + 11); - req[offset++] = Protocol.encodingMajor; - req[offset++] = Protocol.encodingMinor; - req[offset++] = 255; // size - putInt(ref req, ref offset, seq); + putInt(ref req, ref offset, seq + 11); + req[offset++] = Protocol.encodingMajor; + req[offset++] = Protocol.encodingMinor; + req[offset++] = 255; // size + putInt(ref req, ref offset, seq); - int requestId = 1; - byte[] reply = new byte[25]; - byte[] header = new byte[14]; - - // Read connection validation. - int len = 0; - int size = header.Length; - while(len != size) - { - int n = sock.Receive(header, len, size - len, 0); - if(n <= 0) - { - return; - } - len += n; - } + int requestId = 1; + byte[] reply = new byte[25]; + byte[] header = new byte[14]; + + // Read connection validation. + int len = 0; + int size = header.Length; + while(len != size) + { + int n = sock.Receive(header, len, size - len, 0); + if(n <= 0) + { + return; + } + len += n; + } - // Process validation message. - Debug.Assert(header[0] == Protocol.magic[0] && header[1] == Protocol.magic[1] && - header[2] == Protocol.magic[2] && header[3] == Protocol.magic[3]); - offset = 4; + // Process validation message. + Debug.Assert(header[0] == Protocol.magic[0] && header[1] == Protocol.magic[1] && + header[2] == Protocol.magic[2] && header[3] == Protocol.magic[3]); + offset = 4; - byte pMajor = header[offset++]; - Debug.Assert(pMajor == Protocol.protocolMajor); - //byte pMinor = header[offset++]; - offset++; + byte pMajor = header[offset++]; + Debug.Assert(pMajor == Protocol.protocolMajor); + //byte pMinor = header[offset++]; + offset++; - byte eMajor = header[offset++]; - Debug.Assert(eMajor == Protocol.encodingMajor); - //byte eMinor = header[offset++]; - offset++; + byte eMajor = header[offset++]; + Debug.Assert(eMajor == Protocol.encodingMajor); + //byte eMinor = header[offset++]; + offset++; - byte messageType = header[offset++]; - Debug.Assert(messageType == Protocol.validateConnectionMsg); + byte messageType = header[offset++]; + Debug.Assert(messageType == Protocol.validateConnectionMsg); - //byte compress = header[offset++]; - offset++; - size = getInt(header, ref offset); + //byte compress = header[offset++]; + offset++; + size = getInt(header, ref offset); - long tmsec = System.DateTime.Now.Ticks / 10000; + long tmsec = System.DateTime.Now.Ticks / 10000; - int repetitions = 200; - for (int i = 0; i < repetitions; ++i) - { - // Request message body. - offset = 14; - putInt(ref req, ref offset, requestId); - ++requestId; + int repetitions = 200; + for (int i = 0; i < repetitions; ++i) + { + // Request message body. + offset = 14; + putInt(ref req, ref offset, requestId); + ++requestId; - if(sock.Send(req) != req.Length) - { - return; - } + if(sock.Send(req) != req.Length) + { + return; + } - len = 0; - size = reply.Length; - while(len != size) - { - int n = sock.Receive(reply, len, size - len, 0); - if(n <= 0) - { - return; - } - len += n; - } - } - - double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec; - Console.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms"); - Console.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms"); + len = 0; + size = reply.Length; + while(len != size) + { + int n = sock.Receive(reply, len, size - len, 0); + if(n <= 0) + { + return; + } + len += n; + } + } + + double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec; + Console.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms"); + Console.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms"); } public static void Main() { @@ -252,7 +252,7 @@ public class Client Console.WriteLine("Connecting....."); s.Connect(ipe); - run(s); + run(s); s.Close(); } diff --git a/perf/src/Ice/raw/cs/Server.cs b/perf/src/Ice/raw/cs/Server.cs index 8f0b81f1d0d..3a21d694f32 100644 --- a/perf/src/Ice/raw/cs/Server.cs +++ b/perf/src/Ice/raw/cs/Server.cs @@ -24,7 +24,7 @@ sealed class Protocol // The magic number at the front of each message // internal static readonly byte[] magic - = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P' + = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P' // // The current Ice protocol and encoding version @@ -45,37 +45,37 @@ sealed class Protocol internal static readonly byte[] requestHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.requestMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.requestMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). }; internal static readonly byte[] requestBatchHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.requestBatchMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.requestBatchMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). }; internal static readonly byte[] replyHdr = new byte[] { - Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, Protocol.protocolMinor, - Protocol.encodingMajor, Protocol.encodingMinor, - Protocol.replyMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). + Protocol.magic[0], Protocol.magic[1], Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, Protocol.protocolMinor, + Protocol.encodingMajor, Protocol.encodingMinor, + Protocol.replyMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). }; } @@ -85,267 +85,267 @@ public class Server public enum ByteOrder { BIG_ENDIAN, LITTLE_ENDIAN }; private class NO // Native Order { - static NO() - { - byte[] b = BitConverter.GetBytes((int)1); - _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; - } - internal static readonly ByteOrder _o; + static NO() + { + byte[] b = BitConverter.GetBytes((int)1); + _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; + } + internal static readonly ByteOrder _o; } //static ByteOrder _order = ByteOrder.BIG_ENDIAN; static ByteOrder _order = ByteOrder.LITTLE_ENDIAN; static unsafe void putInt(ref byte[] buf, ref int pos, int val) { - if(NO._o == _order) - { - fixed(byte* p = &buf[pos]) - { - *((int*)p) = val; - } - pos += 4; - } - else - { - byte* p = (byte*)&val; - buf[pos++] = *(p+3); - buf[pos++] = *(p+2); - buf[pos++] = *(p+1); - buf[pos++] = *(p+0); - } + if(NO._o == _order) + { + fixed(byte* p = &buf[pos]) + { + *((int*)p) = val; + } + pos += 4; + } + else + { + byte* p = (byte*)&val; + buf[pos++] = *(p+3); + buf[pos++] = *(p+2); + buf[pos++] = *(p+1); + buf[pos++] = *(p+0); + } } static unsafe int getInt(byte[] buf, ref int pos) { - int ret; - if(NO._o == _order) - { - fixed(byte* p = &buf[pos]) - { - ret = *((int*)p); - } - } - else - { - byte* p = (byte*)&ret; - *p++ = buf[pos+3]; - *p++ = buf[pos+2]; - *p++ = buf[pos+1]; - *p = buf[pos+0]; - } - pos += 4; - return ret; + int ret; + if(NO._o == _order) + { + fixed(byte* p = &buf[pos]) + { + ret = *((int*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = buf[pos+3]; + *p++ = buf[pos+2]; + *p++ = buf[pos+1]; + *p = buf[pos+0]; + } + pos += 4; + return ret; } static int readSize(byte[] buf, ref int pos) { - int sz = buf[pos++]; - if(sz == 255) - { - return getInt(buf, ref pos); - } - return sz; + int sz = buf[pos++]; + if(sz == 255) + { + return getInt(buf, ref pos); + } + return sz; } static bool rawcmp(byte[] src, byte[] dest, int offset, int len) { - if(src.Length != len) - { - return false; - } - for(int i = 0; i < len; ++i) - { - if(src[i] != dest[offset + i]) - { - return false; - } - } - return true; + if(src.Length != len) + { + return false; + } + for(int i = 0; i < len; ++i) + { + if(src[i] != dest[offset + i]) + { + return false; + } + } + return true; } public static void run(Socket sock) { - System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); - - byte[] header = new byte[Protocol.headerSize]; - - // - // Construct validation message, send. - // - int offset = 0; - Array.Copy(Protocol.magic, 0, header, 0, Protocol.magic.Length); - offset += Protocol.magic.Length; - header[offset++] = Protocol.protocolMajor; - header[offset++] = Protocol.protocolMinor; - header[offset++] = Protocol.encodingMajor; - header[offset++] = Protocol.encodingMinor; - header[offset++] = Protocol.validateConnectionMsg; - header[offset++] = (byte)0; - putInt(ref header, ref offset, Protocol.headerSize); - - if(sock.Send(header) != header.Length) - { - return; - } - - byte[] req = new byte[500042]; - - byte[] reply = new byte[25]; - Array.Copy(Protocol.replyHdr, 0, reply, 0, Protocol.replyHdr.Length); - offset = 10; - putInt(ref reply, ref offset, reply.Length); - putInt(ref reply, ref offset, 0); // request id - reply[offset++] = (byte)0; // Success - // Encapsulation - putInt(ref reply, ref offset, 6); - reply[offset++] = Protocol.encodingMajor; - reply[offset++] = Protocol.encodingMinor; - - byte[] isaReply = new byte[26]; - Array.Copy(Protocol.replyHdr, 0, isaReply, 0, Protocol.replyHdr.Length); - offset = 10; - putInt(ref isaReply, ref offset, isaReply.Length); - putInt(ref isaReply, ref offset, 0); // request id - isaReply[offset++] = (byte)0; // Success - // Encapsulation - putInt(ref isaReply, ref offset, 7); - isaReply[offset++] = Protocol.encodingMajor; - isaReply[offset++] = Protocol.encodingMinor; - isaReply[offset++] = (byte)1; - - byte[] opIceIsA = utf8.GetBytes("ice_isA"); - byte[] opIcePing = utf8.GetBytes("ice_ping"); - byte[] opSendByteSeq = utf8.GetBytes("sendByteSeq"); - - // - // Process requests. - // - while(true) - { - int len = 0; - while(len != header.Length) - { - int n = sock.Receive(header, len, header.Length - len, 0); - if(n <= 0) - { - return; - } - len += n; - } - - Debug.Assert(header[0] == Protocol.magic[0] && header[1] == Protocol.magic[1] && - header[2] == Protocol.magic[2] && header[3] == Protocol.magic[3]); - - offset = 4; - byte pMajor = header[offset++]; - Debug.Assert(pMajor == Protocol.protocolMajor); - //byte pMinor = header[offset++]; - offset++; - - byte eMajor = header[offset++]; - Debug.Assert(eMajor == Protocol.encodingMajor); - //byte eMinor = header[offset++]; - offset++; - - byte messageType = header[offset++]; - //byte compress = header[offset++]; - offset++; - int size = getInt(header, ref offset); - //Console.WriteLine("size: " + size); - - if(messageType == Protocol.closeConnectionMsg) - { - return; - } - if(messageType != Protocol.requestMsg) - { - Console.WriteLine("unexpected message: " + messageType); - return; - } - - size -= Protocol.headerSize; - if(size < 0 || size > req.Length) - { - Console.WriteLine("booting client: unsupported size"); - return; - } - //assert(size <= req.Length); - - len = 0; - while(len != size) - { - int n = sock.Receive(req, len, size - len, 0); - if(n <= 0) - { - return; - } - //Console.WriteLine("read: " + n); - len += n; - } - - offset = 0; - int requestId = getInt(req, ref offset); - - // id - int sz = readSize(req, ref offset); - offset += sz; - sz = readSize(req, ref offset); - offset += sz; - Debug.Assert(req[offset] == 0); - ++offset; // facet - // operation - sz = readSize(req, ref offset); - - if(!rawcmp(opIceIsA, req, offset, sz) && !rawcmp(opIcePing, req, offset, sz) && - !rawcmp(opSendByteSeq, req, offset, sz)) - { - Console.WriteLine("unsupported op: " + utf8.GetString(req, offset, sz)); - return; - } - - byte[] r; - if(rawcmp(opIceIsA, req, offset, sz)) - { - r = isaReply; - } - else - { - r = reply; - } - - // - // Compose the reply. - // - offset = 14; - putInt(ref r, ref offset, requestId); - - if(sock.Send(r) != r.Length) - { - return; - } - } + System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); + + byte[] header = new byte[Protocol.headerSize]; + + // + // Construct validation message, send. + // + int offset = 0; + Array.Copy(Protocol.magic, 0, header, 0, Protocol.magic.Length); + offset += Protocol.magic.Length; + header[offset++] = Protocol.protocolMajor; + header[offset++] = Protocol.protocolMinor; + header[offset++] = Protocol.encodingMajor; + header[offset++] = Protocol.encodingMinor; + header[offset++] = Protocol.validateConnectionMsg; + header[offset++] = (byte)0; + putInt(ref header, ref offset, Protocol.headerSize); + + if(sock.Send(header) != header.Length) + { + return; + } + + byte[] req = new byte[500042]; + + byte[] reply = new byte[25]; + Array.Copy(Protocol.replyHdr, 0, reply, 0, Protocol.replyHdr.Length); + offset = 10; + putInt(ref reply, ref offset, reply.Length); + putInt(ref reply, ref offset, 0); // request id + reply[offset++] = (byte)0; // Success + // Encapsulation + putInt(ref reply, ref offset, 6); + reply[offset++] = Protocol.encodingMajor; + reply[offset++] = Protocol.encodingMinor; + + byte[] isaReply = new byte[26]; + Array.Copy(Protocol.replyHdr, 0, isaReply, 0, Protocol.replyHdr.Length); + offset = 10; + putInt(ref isaReply, ref offset, isaReply.Length); + putInt(ref isaReply, ref offset, 0); // request id + isaReply[offset++] = (byte)0; // Success + // Encapsulation + putInt(ref isaReply, ref offset, 7); + isaReply[offset++] = Protocol.encodingMajor; + isaReply[offset++] = Protocol.encodingMinor; + isaReply[offset++] = (byte)1; + + byte[] opIceIsA = utf8.GetBytes("ice_isA"); + byte[] opIcePing = utf8.GetBytes("ice_ping"); + byte[] opSendByteSeq = utf8.GetBytes("sendByteSeq"); + + // + // Process requests. + // + while(true) + { + int len = 0; + while(len != header.Length) + { + int n = sock.Receive(header, len, header.Length - len, 0); + if(n <= 0) + { + return; + } + len += n; + } + + Debug.Assert(header[0] == Protocol.magic[0] && header[1] == Protocol.magic[1] && + header[2] == Protocol.magic[2] && header[3] == Protocol.magic[3]); + + offset = 4; + byte pMajor = header[offset++]; + Debug.Assert(pMajor == Protocol.protocolMajor); + //byte pMinor = header[offset++]; + offset++; + + byte eMajor = header[offset++]; + Debug.Assert(eMajor == Protocol.encodingMajor); + //byte eMinor = header[offset++]; + offset++; + + byte messageType = header[offset++]; + //byte compress = header[offset++]; + offset++; + int size = getInt(header, ref offset); + //Console.WriteLine("size: " + size); + + if(messageType == Protocol.closeConnectionMsg) + { + return; + } + if(messageType != Protocol.requestMsg) + { + Console.WriteLine("unexpected message: " + messageType); + return; + } + + size -= Protocol.headerSize; + if(size < 0 || size > req.Length) + { + Console.WriteLine("booting client: unsupported size"); + return; + } + //assert(size <= req.Length); + + len = 0; + while(len != size) + { + int n = sock.Receive(req, len, size - len, 0); + if(n <= 0) + { + return; + } + //Console.WriteLine("read: " + n); + len += n; + } + + offset = 0; + int requestId = getInt(req, ref offset); + + // id + int sz = readSize(req, ref offset); + offset += sz; + sz = readSize(req, ref offset); + offset += sz; + Debug.Assert(req[offset] == 0); + ++offset; // facet + // operation + sz = readSize(req, ref offset); + + if(!rawcmp(opIceIsA, req, offset, sz) && !rawcmp(opIcePing, req, offset, sz) && + !rawcmp(opSendByteSeq, req, offset, sz)) + { + Console.WriteLine("unsupported op: " + utf8.GetString(req, offset, sz)); + return; + } + + byte[] r; + if(rawcmp(opIceIsA, req, offset, sz)) + { + r = isaReply; + } + else + { + r = reply; + } + + // + // Compose the reply. + // + offset = 14; + putInt(ref r, ref offset, requestId); + + if(sock.Send(r) != r.Length) + { + return; + } + } } public static void Main() { - try - { - IPAddress address = IPAddress.Parse("127.0.0.1"); - TcpListener listener = new TcpListener(address,10000); - listener.Start(); - - while (true) - { - Socket s = listener.AcceptSocket(); - Console.WriteLine("Connection accepted from " + s.RemoteEndPoint); - run(s); - s.Close(); - } - } - catch (Exception e) - { - Console.WriteLine("Error..... " + e.StackTrace); - } + try + { + IPAddress address = IPAddress.Parse("127.0.0.1"); + TcpListener listener = new TcpListener(address,10000); + listener.Start(); + + while (true) + { + Socket s = listener.AcceptSocket(); + Console.WriteLine("Connection accepted from " + s.RemoteEndPoint); + run(s); + s.Close(); + } + } + catch (Exception e) + { + Console.WriteLine("Error..... " + e.StackTrace); + } } } diff --git a/perf/src/Ice/raw/java/Client.java b/perf/src/Ice/raw/java/Client.java index ed123e91fab..295d9700815 100644 --- a/perf/src/Ice/raw/java/Client.java +++ b/perf/src/Ice/raw/java/Client.java @@ -20,7 +20,7 @@ final class Protocol // // The magic number at the front of each message // - public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' + public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' // // The current Ice protocol and encoding version @@ -41,49 +41,49 @@ final class Protocol public final static byte[] requestHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.requestMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.requestMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). }; public final static byte[] requestBatchHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.requestBatchMsg, - 0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.requestBatchMsg, + 0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). }; public final static byte[] replyHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.replyMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.replyMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). }; } @@ -91,141 +91,141 @@ final class Protocol public class Client { static public void run(Socket sock) - throws IOException + throws IOException { - InputStream is = sock.getInputStream(); - OutputStream os = sock.getOutputStream(); - - int seq = 500000; // byte sequence length - byte[] req = new byte[seq + Protocol.headerSize + 42]; // 42 is the size of the message header - for(int i = 0; i < Protocol.headerSize; ++i) - { - req[i] = Protocol.requestHdr[i]; - } - java.nio.ByteBuffer reqBuf = java.nio.ByteBuffer.wrap(req); - reqBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - reqBuf.position(10); - reqBuf.putInt(req.length); - reqBuf.putInt(0); // request id - // Ice::Identity - String idName = "throughput"; - reqBuf.put((byte)idName.length()); - reqBuf.put(idName.getBytes()); - reqBuf.put((byte)0); - reqBuf.put((byte)0); // facet - String opName = "sendByteSeq"; // operation name - reqBuf.put((byte)opName.length()); - reqBuf.put(opName.getBytes()); - reqBuf.put((byte)0); // mode - reqBuf.put((byte)0); // context - // encapsulation - reqBuf.putInt(seq + 11); - reqBuf.put(Protocol.encodingMajor).put(Protocol.encodingMinor); - reqBuf.put((byte)255); - reqBuf.putInt(seq); - - int requestId = 1; - - byte[] reply = new byte[25]; - - byte[] header = new byte[14]; - java.nio.ByteBuffer headerBuf = java.nio.ByteBuffer.wrap(header); - headerBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - - byte[] magic = new byte[4]; - - // Read connection validation. - int len = 0; - int size = header.length; - while(len != size) - { - int n = is.read(header, len, size - len); - if(n <= 0) - { - return; - } - len += n; - } - - // Process validation message. - headerBuf.position(0); - magic[0] = headerBuf.get(); - magic[1] = headerBuf.get(); - magic[2] = headerBuf.get(); - magic[3] = headerBuf.get(); - assert(magic[0] == Protocol.magic[0] && magic[1] == Protocol.magic[1] && - magic[2] == Protocol.magic[2] && magic[3] == Protocol.magic[3]); - - byte pMajor = headerBuf.get(); - assert(pMajor == Protocol.protocolMajor); - byte pMinor = headerBuf.get(); - - byte eMajor = headerBuf.get(); - assert(eMajor == Protocol.encodingMajor); - byte eMinor = headerBuf.get(); - - byte messageType = headerBuf.get(); - assert(messageType == Protocol.validateConnectionMsg); - - byte compress = headerBuf.get(); - size = headerBuf.getInt(); - - double tmsec = 0; - - // Send some requests. First we want to "warm up" the JIT compiler. - int warm = 0; - int repetitions = 200; - for (int i = 0; i < repetitions + warm; ++i) - { - if(i == warm) - { - tmsec = System.currentTimeMillis(); - } - - // Request message body. - reqBuf.position(14); - reqBuf.putInt(requestId); // id - ++requestId; - - os.write(req); - os.flush(); - - len = 0; - size = reply.length; - while(len != size) - { - int n = is.read(reply, len, size - len); - if(n <= 0) - { - return; - } - len += n; - } - } - - double dmsec = System.currentTimeMillis() - tmsec; - System.err.println("time for " + repetitions + " sequences: " + dmsec + "ms"); - System.err.println("time per sequence: " + (dmsec / repetitions) + "ms"); + InputStream is = sock.getInputStream(); + OutputStream os = sock.getOutputStream(); + + int seq = 500000; // byte sequence length + byte[] req = new byte[seq + Protocol.headerSize + 42]; // 42 is the size of the message header + for(int i = 0; i < Protocol.headerSize; ++i) + { + req[i] = Protocol.requestHdr[i]; + } + java.nio.ByteBuffer reqBuf = java.nio.ByteBuffer.wrap(req); + reqBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + reqBuf.position(10); + reqBuf.putInt(req.length); + reqBuf.putInt(0); // request id + // Ice::Identity + String idName = "throughput"; + reqBuf.put((byte)idName.length()); + reqBuf.put(idName.getBytes()); + reqBuf.put((byte)0); + reqBuf.put((byte)0); // facet + String opName = "sendByteSeq"; // operation name + reqBuf.put((byte)opName.length()); + reqBuf.put(opName.getBytes()); + reqBuf.put((byte)0); // mode + reqBuf.put((byte)0); // context + // encapsulation + reqBuf.putInt(seq + 11); + reqBuf.put(Protocol.encodingMajor).put(Protocol.encodingMinor); + reqBuf.put((byte)255); + reqBuf.putInt(seq); + + int requestId = 1; + + byte[] reply = new byte[25]; + + byte[] header = new byte[14]; + java.nio.ByteBuffer headerBuf = java.nio.ByteBuffer.wrap(header); + headerBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + + byte[] magic = new byte[4]; + + // Read connection validation. + int len = 0; + int size = header.length; + while(len != size) + { + int n = is.read(header, len, size - len); + if(n <= 0) + { + return; + } + len += n; + } + + // Process validation message. + headerBuf.position(0); + magic[0] = headerBuf.get(); + magic[1] = headerBuf.get(); + magic[2] = headerBuf.get(); + magic[3] = headerBuf.get(); + assert(magic[0] == Protocol.magic[0] && magic[1] == Protocol.magic[1] && + magic[2] == Protocol.magic[2] && magic[3] == Protocol.magic[3]); + + byte pMajor = headerBuf.get(); + assert(pMajor == Protocol.protocolMajor); + byte pMinor = headerBuf.get(); + + byte eMajor = headerBuf.get(); + assert(eMajor == Protocol.encodingMajor); + byte eMinor = headerBuf.get(); + + byte messageType = headerBuf.get(); + assert(messageType == Protocol.validateConnectionMsg); + + byte compress = headerBuf.get(); + size = headerBuf.getInt(); + + double tmsec = 0; + + // Send some requests. First we want to "warm up" the JIT compiler. + int warm = 0; + int repetitions = 200; + for (int i = 0; i < repetitions + warm; ++i) + { + if(i == warm) + { + tmsec = System.currentTimeMillis(); + } + + // Request message body. + reqBuf.position(14); + reqBuf.putInt(requestId); // id + ++requestId; + + os.write(req); + os.flush(); + + len = 0; + size = reply.length; + while(len != size) + { + int n = is.read(reply, len, size - len); + if(n <= 0) + { + return; + } + len += n; + } + } + + double dmsec = System.currentTimeMillis() - tmsec; + System.err.println("time for " + repetitions + " sequences: " + dmsec + "ms"); + System.err.println("time per sequence: " + (dmsec / repetitions) + "ms"); } public static void main(String[] args) { - try - { - Socket sock = new Socket("127.0.0.1", 10000); - System.out.println("connected"); - - run(sock); - - sock.close(); - } - catch (UnknownHostException e) - { - System.err.println("Trying to connect to unknown host: " + e); - } - catch (Exception e) - { - System.err.println("Exception: " + e); - } + try + { + Socket sock = new Socket("127.0.0.1", 10000); + System.out.println("connected"); + + run(sock); + + sock.close(); + } + catch (UnknownHostException e) + { + System.err.println("Trying to connect to unknown host: " + e); + } + catch (Exception e) + { + System.err.println("Exception: " + e); + } } } diff --git a/perf/src/Ice/raw/java/Server.java b/perf/src/Ice/raw/java/Server.java index f5c083c491d..657d3a59a08 100644 --- a/perf/src/Ice/raw/java/Server.java +++ b/perf/src/Ice/raw/java/Server.java @@ -20,7 +20,7 @@ final class Protocol // // The magic number at the front of each message // - public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' + public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' // // The current Ice protocol and encoding version @@ -41,49 +41,49 @@ final class Protocol public final static byte[] requestHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.requestMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.requestMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). }; public final static byte[] requestBatchHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.requestBatchMsg, - 0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.requestBatchMsg, + 0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). }; public final static byte[] replyHdr = { - Protocol.magic[0], - Protocol.magic[1], - Protocol.magic[2], - Protocol.magic[3], - Protocol.protocolMajor, - Protocol.protocolMinor, - Protocol.encodingMajor, - Protocol.encodingMinor, - Protocol.replyMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.encodingMajor, + Protocol.encodingMinor, + Protocol.replyMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). }; } @@ -93,276 +93,276 @@ class Server static int readSize(java.nio.ByteBuffer buf) { - int sz = buf.get(); - if(sz == 255) - { - return buf.getInt(); - } - return sz; + int sz = buf.get(); + if(sz == 255) + { + return buf.getInt(); + } + return sz; } static boolean rawcmp(byte[] src, byte[] dest, int len) { - if(src.length != len) - { - return false; - } - for(int i = 0; i < len; ++i) - { - if(src[i] != dest[i]) - { - return false; - } - } - return true; + if(src.length != len) + { + return false; + } + for(int i = 0; i < len; ++i) + { + if(src[i] != dest[i]) + { + return false; + } + } + return true; } static void run(Socket clientSocket) - throws IOException + throws IOException { - InputStream is = clientSocket.getInputStream(); - OutputStream os = clientSocket.getOutputStream(); - - byte[] header = new byte[14]; - - // - // Construct validation message, send. - // - java.nio.ByteBuffer headerBuf = java.nio.ByteBuffer.wrap(header); - headerBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - headerBuf.put(Protocol.magic); - headerBuf.put(Protocol.protocolMajor).put(Protocol.protocolMinor); - headerBuf.put(Protocol.encodingMajor).put(Protocol.encodingMinor); - headerBuf.put(Protocol.validateConnectionMsg); - headerBuf.put((byte)0); - headerBuf.putInt(Protocol.headerSize); - - os.write(header); - os.flush(); - - byte[] opNameRaw = new byte[100]; - byte[] magic = new byte[4]; - byte[] req = new byte[500042]; - java.nio.ByteBuffer reqBuf = java.nio.ByteBuffer.wrap(req); - reqBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - - byte[] reply = new byte[25]; - for(int i = 0; i < Protocol.replyHdr.length; ++i) - { - reply[i] = Protocol.replyHdr[i]; - } - java.nio.ByteBuffer replyBuf = java.nio.ByteBuffer.wrap(reply); - replyBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - replyBuf.position(10); - replyBuf.putInt(reply.length); - replyBuf.putInt(0); // requestId - replyBuf.put((byte)0); // Success - // Encapsulation - replyBuf.putInt(6); - replyBuf.put(Protocol.encodingMajor); - replyBuf.put(Protocol.encodingMinor); - - byte[] isaReply = new byte[26]; - for(int i = 0; i < Protocol.replyHdr.length; ++i) - { - isaReply[i] = Protocol.replyHdr[i]; - } - java.nio.ByteBuffer isaReplyBuf = java.nio.ByteBuffer.wrap(isaReply); - isaReplyBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); - isaReplyBuf.position(10); - isaReplyBuf.putInt(isaReply.length); - isaReplyBuf.putInt(0); // requestId - isaReplyBuf.put((byte)0); // Success - // Encapsulation - isaReplyBuf.putInt(7); - isaReplyBuf.put(Protocol.encodingMajor); - isaReplyBuf.put(Protocol.encodingMinor); - isaReplyBuf.put((byte)1); - - byte[] opIceIsA = "ice_isA".getBytes(); - byte[] opIcePing = "ice_ping".getBytes(); - byte[] opSendByteSeq = "sendByteSeq".getBytes(); - - // - // Process requests. - // - while(true) - { - int len = 0; - while(len != header.length) - { - int n = is.read(header, len, header.length - len); - if(n <= 0) - { - return; - } - len += n; - } - - headerBuf.position(0); - magic[0] = headerBuf.get(); - magic[1] = headerBuf.get(); - magic[2] = headerBuf.get(); - magic[3] = headerBuf.get(); - assert(magic[0] == Protocol.magic[0] && magic[1] == Protocol.magic[1] && - magic[2] == Protocol.magic[2] && magic[3] == Protocol.magic[3]); - - byte pMajor = headerBuf.get(); - assert(pMajor == Protocol.protocolMajor); - byte pMinor = headerBuf.get(); - - byte eMajor = headerBuf.get(); - assert(eMajor == Protocol.encodingMajor); - byte eMinor = headerBuf.get(); - - byte messageType = headerBuf.get(); - byte compress = headerBuf.get(); - int size = headerBuf.getInt(); - //System.err.println("size: " + size); - - if(messageType == Protocol.closeConnectionMsg) - { - return; - } - if(messageType != Protocol.requestMsg) - { - System.err.println("unexpected message: " + messageType); - return; - } - - size -= Protocol.headerSize; - if(size < 0 || size > req.length) - - { - System.err.println("booting client: unsupported size"); - return; - } - //assert(size <= req.length); - //System.err.println("size: " + size); - - len = 0; - while(len != size) - { - int n = is.read(req, len, size - len); - if(n <= 0) - { - return; - } - //System.out.println("read: " + n); - len += n; - } - - reqBuf.position(0); - int requestId = reqBuf.getInt(); - - // - // Partially parse the message header. - // - - // id - int sz = readSize(reqBuf); - while(sz != 0) - { - reqBuf.get(); --sz; - } - sz = readSize(reqBuf); - while(sz != 0) - { - reqBuf.get(); --sz; - } - // facet - sz = reqBuf.get(); - assert(sz == 0); - // operation - sz = readSize(reqBuf); - assert(sz < opNameRaw.length); - if(sz != 0) - { - reqBuf.get(opNameRaw, 0, sz); - } - - if(!rawcmp(opIceIsA, opNameRaw, sz) && !rawcmp(opIcePing, opNameRaw, sz) && - !rawcmp(opSendByteSeq, opNameRaw, sz)) - { - System.err.println("unsupported op: " + new String(opNameRaw, 0, sz)); - return; - } - - java.nio.ByteBuffer rb; - byte[] r; - if(rawcmp(opIceIsA, opNameRaw, sz)) - { - r = isaReply; - rb = isaReplyBuf; - } - else - { - r = reply; - rb = replyBuf; - } - - // - // Compose the reply. - // - rb.position(14); - rb.putInt(requestId); - - os.write(r); - os.flush(); - } + InputStream is = clientSocket.getInputStream(); + OutputStream os = clientSocket.getOutputStream(); + + byte[] header = new byte[14]; + + // + // Construct validation message, send. + // + java.nio.ByteBuffer headerBuf = java.nio.ByteBuffer.wrap(header); + headerBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + headerBuf.put(Protocol.magic); + headerBuf.put(Protocol.protocolMajor).put(Protocol.protocolMinor); + headerBuf.put(Protocol.encodingMajor).put(Protocol.encodingMinor); + headerBuf.put(Protocol.validateConnectionMsg); + headerBuf.put((byte)0); + headerBuf.putInt(Protocol.headerSize); + + os.write(header); + os.flush(); + + byte[] opNameRaw = new byte[100]; + byte[] magic = new byte[4]; + byte[] req = new byte[500042]; + java.nio.ByteBuffer reqBuf = java.nio.ByteBuffer.wrap(req); + reqBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + + byte[] reply = new byte[25]; + for(int i = 0; i < Protocol.replyHdr.length; ++i) + { + reply[i] = Protocol.replyHdr[i]; + } + java.nio.ByteBuffer replyBuf = java.nio.ByteBuffer.wrap(reply); + replyBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + replyBuf.position(10); + replyBuf.putInt(reply.length); + replyBuf.putInt(0); // requestId + replyBuf.put((byte)0); // Success + // Encapsulation + replyBuf.putInt(6); + replyBuf.put(Protocol.encodingMajor); + replyBuf.put(Protocol.encodingMinor); + + byte[] isaReply = new byte[26]; + for(int i = 0; i < Protocol.replyHdr.length; ++i) + { + isaReply[i] = Protocol.replyHdr[i]; + } + java.nio.ByteBuffer isaReplyBuf = java.nio.ByteBuffer.wrap(isaReply); + isaReplyBuf.order(java.nio.ByteOrder.LITTLE_ENDIAN); + isaReplyBuf.position(10); + isaReplyBuf.putInt(isaReply.length); + isaReplyBuf.putInt(0); // requestId + isaReplyBuf.put((byte)0); // Success + // Encapsulation + isaReplyBuf.putInt(7); + isaReplyBuf.put(Protocol.encodingMajor); + isaReplyBuf.put(Protocol.encodingMinor); + isaReplyBuf.put((byte)1); + + byte[] opIceIsA = "ice_isA".getBytes(); + byte[] opIcePing = "ice_ping".getBytes(); + byte[] opSendByteSeq = "sendByteSeq".getBytes(); + + // + // Process requests. + // + while(true) + { + int len = 0; + while(len != header.length) + { + int n = is.read(header, len, header.length - len); + if(n <= 0) + { + return; + } + len += n; + } + + headerBuf.position(0); + magic[0] = headerBuf.get(); + magic[1] = headerBuf.get(); + magic[2] = headerBuf.get(); + magic[3] = headerBuf.get(); + assert(magic[0] == Protocol.magic[0] && magic[1] == Protocol.magic[1] && + magic[2] == Protocol.magic[2] && magic[3] == Protocol.magic[3]); + + byte pMajor = headerBuf.get(); + assert(pMajor == Protocol.protocolMajor); + byte pMinor = headerBuf.get(); + + byte eMajor = headerBuf.get(); + assert(eMajor == Protocol.encodingMajor); + byte eMinor = headerBuf.get(); + + byte messageType = headerBuf.get(); + byte compress = headerBuf.get(); + int size = headerBuf.getInt(); + //System.err.println("size: " + size); + + if(messageType == Protocol.closeConnectionMsg) + { + return; + } + if(messageType != Protocol.requestMsg) + { + System.err.println("unexpected message: " + messageType); + return; + } + + size -= Protocol.headerSize; + if(size < 0 || size > req.length) + + { + System.err.println("booting client: unsupported size"); + return; + } + //assert(size <= req.length); + //System.err.println("size: " + size); + + len = 0; + while(len != size) + { + int n = is.read(req, len, size - len); + if(n <= 0) + { + return; + } + //System.out.println("read: " + n); + len += n; + } + + reqBuf.position(0); + int requestId = reqBuf.getInt(); + + // + // Partially parse the message header. + // + + // id + int sz = readSize(reqBuf); + while(sz != 0) + { + reqBuf.get(); --sz; + } + sz = readSize(reqBuf); + while(sz != 0) + { + reqBuf.get(); --sz; + } + // facet + sz = reqBuf.get(); + assert(sz == 0); + // operation + sz = readSize(reqBuf); + assert(sz < opNameRaw.length); + if(sz != 0) + { + reqBuf.get(opNameRaw, 0, sz); + } + + if(!rawcmp(opIceIsA, opNameRaw, sz) && !rawcmp(opIcePing, opNameRaw, sz) && + !rawcmp(opSendByteSeq, opNameRaw, sz)) + { + System.err.println("unsupported op: " + new String(opNameRaw, 0, sz)); + return; + } + + java.nio.ByteBuffer rb; + byte[] r; + if(rawcmp(opIceIsA, opNameRaw, sz)) + { + r = isaReply; + rb = isaReplyBuf; + } + else + { + r = reply; + rb = replyBuf; + } + + // + // Compose the reply. + // + rb.position(14); + rb.putInt(requestId); + + os.write(r); + os.flush(); + } } public static void main(String args[]) { - int port = 10000; - ServerSocket serverSocket = null; - try - { - serverSocket = new ServerSocket(port); - } - catch (IOException e) - { - System.out.println("Could not listen on port: " + port + ", " + e); - System.exit(1); - } - - while(true) - { - Socket clientSocket = null; - try - { - clientSocket = serverSocket.accept(); - } - catch (IOException e) - { - System.out.println("accept failed"); - e.printStackTrace(); - System.exit(1); - } - System.out.println("accepted new client"); - - try - { - run(clientSocket); - } - catch (IOException e) - { - e.printStackTrace(); - } - - try - { - clientSocket.close(); - } - catch (IOException e) - { - e.printStackTrace(); - } - System.out.println("client is gone"); - } - //serverSocket.close(); + int port = 10000; + ServerSocket serverSocket = null; + try + { + serverSocket = new ServerSocket(port); + } + catch (IOException e) + { + System.out.println("Could not listen on port: " + port + ", " + e); + System.exit(1); + } + + while(true) + { + Socket clientSocket = null; + try + { + clientSocket = serverSocket.accept(); + } + catch (IOException e) + { + System.out.println("accept failed"); + e.printStackTrace(); + System.exit(1); + } + System.out.println("accepted new client"); + + try + { + run(clientSocket); + } + catch (IOException e) + { + e.printStackTrace(); + } + + try + { + clientSocket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + System.out.println("client is gone"); + } + //serverSocket.close(); } } diff --git a/perf/src/Ice/throughput/Client.cpp b/perf/src/Ice/throughput/Client.cpp index 1b2e3d2c369..71c44b85a9d 100644 --- a/perf/src/Ice/throughput/Client.cpp +++ b/perf/src/Ice/throughput/Client.cpp @@ -27,11 +27,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { if(strcmp(argv[i], "structSeq") == 0) { - structSeqTest = true; + structSeqTest = true; } else if(strcmp(argv[i], "noZeroCopy") == 0) { - zeroCopy = false; + zeroCopy = false; } else if(strcmp(argv[i], "longStringSeq") == 0) { @@ -43,7 +43,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } else if(strcmp(argv[i], "byte") == 0) { - byteTest = true; + byteTest = true; } } if(!byteTest && !stringSeqTest && !longStringSeqTest && !structSeqTest) @@ -56,16 +56,16 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) std::string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { - cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator->stringToProxy(proxy); ThroughputPrx throughput = ThroughputPrx::checkedCast(base); if(!throughput) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway()); @@ -77,20 +77,20 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) StringSeq stringSeq(StringSeqSize, "hello"); StringSeq longStringSeq(LongStringSeqSize, "As far as the laws of mathematics refer to reality, " - "they are not certain; and as far as they are certain, they do not refer to reality."); + "they are not certain; and as far as they are certain, they do not refer to reality."); StringDoubleSeq structSeq(StringDoubleSeqSize); for(i = 0; i < StringDoubleSeqSize; ++i) { structSeq[i].s = "hello"; - structSeq[i].d = 3.14; + structSeq[i].d = 3.14; } Ice::Int byteSeqSize = ByteSeqSize * sizeof(Ice::Byte); Ice::Int stringSeqSize = StringSeqSize * stringSeq[0].size() * sizeof(stringSeq[0][0]); Ice::Int longSeqSize = LongStringSeqSize * longStringSeq[0].size() * sizeof(longStringSeq[0][0]); Ice::Int structSeqSize = StringDoubleSeqSize * sizeof(structSeq[0].d) + - StringDoubleSeqSize * structSeq[0].s.size() * sizeof(structSeq[0].s[0]); + StringDoubleSeqSize * structSeq[0].s.size() * sizeof(structSeq[0].s[0]); Ice::Int payloadSize = 0; // @@ -102,45 +102,45 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) const int repetitions = 1000; if(byteTest) { - payloadSize = byteSeqSize; - if(zeroCopy) - { - for(i = 0; i < repetitions; ++i) - { - throughput->sendByteSeq(byteArr); - } - } - else - { - for(i = 0; i < repetitions; ++i) - { - throughput->sendByteSeqNZ(byteSeq); - } - } + payloadSize = byteSeqSize; + if(zeroCopy) + { + for(i = 0; i < repetitions; ++i) + { + throughput->sendByteSeq(byteArr); + } + } + else + { + for(i = 0; i < repetitions; ++i) + { + throughput->sendByteSeqNZ(byteSeq); + } + } } else if(stringSeqTest) { - payloadSize = stringSeqSize; - for(i = 0; i < repetitions; ++i) - { - throughput->sendStringSeq(stringSeq); - } + payloadSize = stringSeqSize; + for(i = 0; i < repetitions; ++i) + { + throughput->sendStringSeq(stringSeq); + } } else if(longStringSeqTest) { - payloadSize = longSeqSize; - for(i = 0; i < repetitions; ++i) - { - throughput->sendStringSeq(longStringSeq); - } + payloadSize = longSeqSize; + for(i = 0; i < repetitions; ++i) + { + throughput->sendStringSeq(longStringSeq); + } } else if(structSeqTest) { - payloadSize = structSeqSize; - for(i = 0; i < repetitions; ++i) - { - throughput->sendStructSeq(structSeq); - } + payloadSize = structSeqSize; + for(i = 0; i < repetitions; ++i) + { + throughput->sendStructSeq(structSeq); + } } IcePerf::TestPrinter formatter; @@ -159,29 +159,29 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->load("config"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex << endl; - status = EXIT_FAILURE; + cerr << ex << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/Ice/throughput/Server.cpp b/perf/src/Ice/throughput/Server.cpp index cff51ea3ccd..1159fe9f74c 100644 --- a/perf/src/Ice/throughput/Server.cpp +++ b/perf/src/Ice/throughput/Server.cpp @@ -30,29 +30,29 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->load("config"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); + communicator = Ice::initialize(argc, argv, initData); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex << endl; - status = EXIT_FAILURE; + cerr << ex << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/Ice/throughput/ThroughputI.h b/perf/src/Ice/throughput/ThroughputI.h index f411a02905e..593dbc82778 100644 --- a/perf/src/Ice/throughput/ThroughputI.h +++ b/perf/src/Ice/throughput/ThroughputI.h @@ -18,15 +18,15 @@ class ThroughputI : public Demo::Throughput public: ThroughputI() : - _byteSeq(Demo::ByteSeqSize, 0), - _stringSeq(Demo::StringSeqSize, "hello"), - _structSeq(Demo::StringDoubleSeqSize) + _byteSeq(Demo::ByteSeqSize, 0), + _stringSeq(Demo::StringSeqSize, "hello"), + _structSeq(Demo::StringDoubleSeqSize) { for(int i = 0; i < Demo::StringDoubleSeqSize; ++i) - { - _structSeq[i].s = "hello"; - _structSeq[i].d = 3.14; - } + { + _structSeq[i].s = "hello"; + _structSeq[i].d = 3.14; + } } virtual void @@ -42,13 +42,13 @@ public: virtual Demo::ByteSeq recvByteSeq(const Ice::Current&) { - return _byteSeq; + return _byteSeq; } virtual Demo::ByteSeq echoByteSeq(const Demo::ByteSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void @@ -59,13 +59,13 @@ public: virtual Demo::StringSeq recvStringSeq(const Ice::Current&) { - return _stringSeq; + return _stringSeq; } virtual Demo::StringSeq echoStringSeq(const Demo::StringSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void @@ -76,19 +76,19 @@ public: virtual Demo::StringDoubleSeq recvStructSeq(const Ice::Current&) { - return _structSeq; + return _structSeq; } virtual Demo::StringDoubleSeq echoStructSeq(const Demo::StringDoubleSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void shutdown(const Ice::Current& c) { - c.adapter->getCommunicator()->shutdown(); + c.adapter->getCommunicator()->shutdown(); } private: diff --git a/perf/src/IceE/latency/Client.cpp b/perf/src/IceE/latency/Client.cpp index 40e2daeb326..5534ca1e046 100644 --- a/perf/src/IceE/latency/Client.cpp +++ b/perf/src/IceE/latency/Client.cpp @@ -20,7 +20,7 @@ class TestAdapter { public: TestAdapter(const LatencyPrx prx) : - _prx(prx) + _prx(prx) { } @@ -36,13 +36,13 @@ class NoPayload : public TestAdapter { public: NoPayload(const LatencyPrx prx): - TestAdapter(prx) + TestAdapter(prx) { } virtual void doIt() { - _prx->ping(); + _prx->ping(); } }; @@ -50,17 +50,17 @@ class WithPayload : public TestAdapter { public: WithPayload(const LatencyPrx prx, const long payLoadSize): - TestAdapter(prx), _payload(payLoadSize) + TestAdapter(prx), _payload(payLoadSize) { - for(long i = 0; i < payLoadSize; ++i) - { - _payload[i] = '0' + (char)(i % 10); - } + for(long i = 0; i < payLoadSize; ++i) + { + _payload[i] = '0' + (char)(i % 10); + } } virtual void doIt() { - _prx->withData(_payload); + _prx->withData(_payload); } private: @@ -72,11 +72,11 @@ createAdapter(const LatencyPrx prx, const long payLoadSize) { if(payLoadSize > 0) { - return new WithPayload(prx, payLoadSize); + return new WithPayload(prx, payLoadSize); } else { - return new NoPayload(prx); + return new NoPayload(prx); } return 0; } @@ -91,45 +91,45 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) long payLoadSize = 0; for(i = 0; i < argc; i++) { - if(strcmp(argv[i], "oneway") == 0) - { - oneway = true; - } - else if(strcmp(argv[i], "batch") == 0) - { - batch = true; - } - else if(strcmp(argv[i], "twoway") == 0) - { - twoway = true; - } - else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) - { - payLoadSize = strtol(argv[i] + strlen("--payload="), 0, 10); - if(errno == ERANGE) - { - cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; - return EXIT_FAILURE; - } - } + if(strcmp(argv[i], "oneway") == 0) + { + oneway = true; + } + else if(strcmp(argv[i], "batch") == 0) + { + batch = true; + } + else if(strcmp(argv[i], "twoway") == 0) + { + twoway = true; + } + else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) + { + payLoadSize = strtol(argv[i] + strlen("--payload="), 0, 10); + if(errno == ERANGE) + { + cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; + return EXIT_FAILURE; + } + } } if(!oneway && !twoway && !batch) { - twoway = true; + twoway = true; } int repetitions = 0; if(twoway) { - repetitions = 100000; + repetitions = 100000; } else if(oneway) { - repetitions = 500000; + repetitions = 500000; } else if(batch) { - repetitions = 1000000; + repetitions = 1000000; } Ice::PropertiesPtr properties = communicator->getProperties(); @@ -137,16 +137,16 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) std::string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { - cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator->stringToProxy(proxy); LatencyPrx latency = LatencyPrx::uncheckedCast(base); if(!latency) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } LatencyPrx onewayprx = LatencyPrx::uncheckedCast(base->ice_oneway()); @@ -158,59 +158,59 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) TestAdapter* testAdapter = 0; try { - if(twoway) - { - testAdapter = createAdapter(latency, payLoadSize); - } - else if(oneway) - { - testAdapter = createAdapter(onewayprx, payLoadSize); - } - else if(batch) - { - testAdapter = createAdapter(batchprx, payLoadSize); - } - - // - // MAIN TEST LOOP. - // - IceUtil::Time tm = IceUtil::Time::now(); - for(i = 0; i < repetitions; ++i) - { - if(batch) - { - if(i != 0 && i % 100 == 0) - { - batchprx->ice_connection()->flushBatchRequests(); - } - } - testAdapter->doIt(); - } - // - // END OF MAIN TEST LOOP - // - - // - // Tidy up laggart requests. - // - if(oneway || batch) - { - if(batch) - { - batchprx->ice_connection()->flushBatchRequests(); - } - latency->ping(); - } - - IcePerf::TestPrinter formatter; - formatter.fmt(cout, "IceE", "latency", IceUtil::Time::now() - tm, repetitions, payLoadSize * sizeof(Ice::Byte), argc, argv); - latency->shutdown(); - delete testAdapter; + if(twoway) + { + testAdapter = createAdapter(latency, payLoadSize); + } + else if(oneway) + { + testAdapter = createAdapter(onewayprx, payLoadSize); + } + else if(batch) + { + testAdapter = createAdapter(batchprx, payLoadSize); + } + + // + // MAIN TEST LOOP. + // + IceUtil::Time tm = IceUtil::Time::now(); + for(i = 0; i < repetitions; ++i) + { + if(batch) + { + if(i != 0 && i % 100 == 0) + { + batchprx->ice_connection()->flushBatchRequests(); + } + } + testAdapter->doIt(); + } + // + // END OF MAIN TEST LOOP + // + + // + // Tidy up laggart requests. + // + if(oneway || batch) + { + if(batch) + { + batchprx->ice_connection()->flushBatchRequests(); + } + latency->ping(); + } + + IcePerf::TestPrinter formatter; + formatter.fmt(cout, "IceE", "latency", IceUtil::Time::now() - tm, repetitions, payLoadSize * sizeof(Ice::Byte), argc, argv); + latency->shutdown(); + delete testAdapter; } catch(...) { - delete testAdapter; - throw; + delete testAdapter; + throw; } @@ -225,28 +225,28 @@ main(int argc, char* argv[]) try { - Ice::PropertiesPtr properties = Ice::createProperties(); + Ice::PropertiesPtr properties = Ice::createProperties(); properties->load("config"); - communicator = Ice::initializeWithProperties(argc, argv, properties); - status = run(argc, argv, communicator); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/IceE/latency/Server.cpp b/perf/src/IceE/latency/Server.cpp index af5b51f0275..dc0ecb51538 100644 --- a/perf/src/IceE/latency/Server.cpp +++ b/perf/src/IceE/latency/Server.cpp @@ -31,7 +31,7 @@ class LatencyI : public Latency virtual void shutdown(const Ice::Current& current) { - current.adapter->getCommunicator()->shutdown(); + current.adapter->getCommunicator()->shutdown(); } }; @@ -54,28 +54,28 @@ main(int argc, char* argv[]) try { - Ice::PropertiesPtr properties = Ice::createProperties(); + Ice::PropertiesPtr properties = Ice::createProperties(); properties->load("config"); - communicator = Ice::initializeWithProperties(argc, argv, properties); - status = run(argc, argv, communicator); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/IceE/throughput/Client.cpp b/perf/src/IceE/throughput/Client.cpp index 5199f756f25..292ddd7ba6c 100644 --- a/perf/src/IceE/throughput/Client.cpp +++ b/perf/src/IceE/throughput/Client.cpp @@ -30,11 +30,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { if(strcmp(argv[i], "structSeq") == 0) { - structSeqTest = true; + structSeqTest = true; } else if(strcmp(argv[i], "noZeroCopy") == 0) { - zeroCopy = false; + zeroCopy = false; } else if(strcmp(argv[i], "longStringSeq") == 0) { @@ -46,11 +46,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } else if(strcmp(argv[i], "byte") == 0) { - byteTest = true; + byteTest = true; } else if(strcmp(argv[i], "receive") == 0) { - receive = true; + receive = true; } } if(!byteTest && !stringSeqTest && !longStringSeqTest && !structSeqTest) @@ -63,16 +63,16 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) std::string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { - cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator->stringToProxy(proxy); ThroughputPrx throughput = ThroughputPrx::checkedCast(base); if(!throughput) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway()); @@ -91,13 +91,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) for(i = 0; i < StringDoubleSeqSize; ++i) { structSeq[i].s = "hello"; - structSeq[i].d = 3.14; + structSeq[i].d = 3.14; } Ice::Int byteSeqSize = ByteSeqSize * sizeof(Ice::Byte); Ice::Int stringSeqSize = StringSeqSize * stringSeq[0].size() * sizeof(stringSeq[0][0]); Ice::Int longSeqSize = LongStringSeqSize * longStringSeq[0].size() * sizeof(longStringSeq[0][0]); Ice::Int structSeqSize = StringDoubleSeqSize * sizeof(structSeq[0].d) + - StringDoubleSeqSize * structSeq[0].s.size() * sizeof(structSeq[0].s[0]); + StringDoubleSeqSize * structSeq[0].s.size() * sizeof(structSeq[0].s[0]); Ice::Int payloadSize = 0; throughput->ice_ping(); // Initial ping to setup the connection. @@ -106,93 +106,93 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) const int repetitions = 1000; if(byteTest) { - payloadSize = byteSeqSize; - if(!receive) - { - if(zeroCopy) - { - for(i = 0; i < repetitions; ++i) - { + payloadSize = byteSeqSize; + if(!receive) + { + if(zeroCopy) + { + for(i = 0; i < repetitions; ++i) + { #ifdef ICEE_USE_ARRAY_MAPPING - throughput->sendByteSeq(byteArr); + throughput->sendByteSeq(byteArr); #else - throughput->sendByteSeq(byteSeq); + throughput->sendByteSeq(byteSeq); #endif - } - } - else - { - for(i = 0; i < repetitions; ++i) - { + } + } + else + { + for(i = 0; i < repetitions; ++i) + { #ifdef ICEE_USE_ARRAY_MAPPING - throughput->sendByteSeqNZ(byteSeq); + throughput->sendByteSeqNZ(byteSeq); #else - throughput->sendByteSeq(byteSeq); + throughput->sendByteSeq(byteSeq); #endif - } - } - } - else - { - for(i = 0; i < repetitions; ++i) - { - throughput->recvByteSeq(); - } - } + } + } + } + else + { + for(i = 0; i < repetitions; ++i) + { + throughput->recvByteSeq(); + } + } } else if(stringSeqTest) { - payloadSize = stringSeqSize; - if(!receive) - { - for(i = 0; i < repetitions; ++i) - { - throughput->sendStringSeq(stringSeq); - } - } - else - { - for(i = 0; i < repetitions; ++i) - { - throughput->recvStringSeq(); - } - } + payloadSize = stringSeqSize; + if(!receive) + { + for(i = 0; i < repetitions; ++i) + { + throughput->sendStringSeq(stringSeq); + } + } + else + { + for(i = 0; i < repetitions; ++i) + { + throughput->recvStringSeq(); + } + } } else if(longStringSeqTest) { - payloadSize = longSeqSize; - if(!receive) - { - for(i = 0; i < repetitions; ++i) - { - throughput->sendStringSeq(longStringSeq); - } - } - else - { - for(i = 0; i < repetitions; ++i) - { - throughput->recvLongStringSeq(); - } - } + payloadSize = longSeqSize; + if(!receive) + { + for(i = 0; i < repetitions; ++i) + { + throughput->sendStringSeq(longStringSeq); + } + } + else + { + for(i = 0; i < repetitions; ++i) + { + throughput->recvLongStringSeq(); + } + } } else if(structSeqTest) { - payloadSize = structSeqSize; - if(!receive) - { - for(i = 0; i < repetitions; ++i) - { - throughput->sendStructSeq(structSeq); - } - } - else - { - for(i = 0; i < repetitions; ++i) - { - throughput->recvStructSeq(); - } - } + payloadSize = structSeqSize; + if(!receive) + { + for(i = 0; i < repetitions; ++i) + { + throughput->sendStructSeq(structSeq); + } + } + else + { + for(i = 0; i < repetitions; ++i) + { + throughput->recvStructSeq(); + } + } } IcePerf::TestPrinter formatter; @@ -211,28 +211,28 @@ main(int argc, char* argv[]) try { - Ice::PropertiesPtr properties = Ice::createProperties(); + Ice::PropertiesPtr properties = Ice::createProperties(); properties->load("config"); - communicator = Ice::initializeWithProperties(argc, argv, properties); - status = run(argc, argv, communicator); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/IceE/throughput/Server.cpp b/perf/src/IceE/throughput/Server.cpp index f87922aff10..47901de0fd1 100644 --- a/perf/src/IceE/throughput/Server.cpp +++ b/perf/src/IceE/throughput/Server.cpp @@ -32,28 +32,28 @@ main(int argc, char* argv[]) Ice::CommunicatorPtr communicator; try - { Ice::PropertiesPtr properties = Ice::createProperties(); + { Ice::PropertiesPtr properties = Ice::createProperties(); properties->load("config"); - communicator = Ice::initializeWithProperties(argc, argv, properties); - status = run(argc, argv, communicator); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; } if(communicator) { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex.ice_name() << endl; - status = EXIT_FAILURE; - } + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + cerr << ex.ice_name() << endl; + status = EXIT_FAILURE; + } } return status; diff --git a/perf/src/IceE/throughput/ThroughputI.h b/perf/src/IceE/throughput/ThroughputI.h index 4b92fc1bb2c..f2d4f5ec759 100644 --- a/perf/src/IceE/throughput/ThroughputI.h +++ b/perf/src/IceE/throughput/ThroughputI.h @@ -18,16 +18,16 @@ class ThroughputI : public Demo::Throughput public: ThroughputI() : - _byteSeq(Demo::ByteSeqSize, 0), - _stringSeq(Demo::StringSeqSize, "hello"), - _longStringSeq(Demo::LongStringSeqSize, "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality."), - _structSeq(Demo::StringDoubleSeqSize) + _byteSeq(Demo::ByteSeqSize, 0), + _stringSeq(Demo::StringSeqSize, "hello"), + _longStringSeq(Demo::LongStringSeqSize, "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality."), + _structSeq(Demo::StringDoubleSeqSize) { for(int i = 0; i < Demo::StringDoubleSeqSize; ++i) - { - _structSeq[i].s = "hello"; - _structSeq[i].d = 3.14; - } + { + _structSeq[i].s = "hello"; + _structSeq[i].d = 3.14; + } } #ifdef ICEE_USE_ARRAY_MAPPING @@ -50,13 +50,13 @@ public: virtual Demo::ByteSeq recvByteSeq(const Ice::Current&) { - return _byteSeq; + return _byteSeq; } virtual Demo::ByteSeq echoByteSeq(const Demo::ByteSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void @@ -67,19 +67,19 @@ public: virtual Demo::StringSeq recvStringSeq(const Ice::Current&) { - return _stringSeq; + return _stringSeq; } virtual Demo::StringSeq recvLongStringSeq(const Ice::Current&) { - return _longStringSeq; + return _longStringSeq; } virtual Demo::StringSeq echoStringSeq(const Demo::StringSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void @@ -90,19 +90,19 @@ public: virtual Demo::StringDoubleSeq recvStructSeq(const Ice::Current&) { - return _structSeq; + return _structSeq; } virtual Demo::StringDoubleSeq echoStructSeq(const Demo::StringDoubleSeq& seq, const Ice::Current&) { - return seq; + return seq; } virtual void shutdown(const Ice::Current& c) { - c.adapter->getCommunicator()->shutdown(); + c.adapter->getCommunicator()->shutdown(); } private: diff --git a/perf/src/IceStorm/Notifier.cpp b/perf/src/IceStorm/Notifier.cpp index 8b69dc15cd4..8692fba10fd 100644 --- a/perf/src/IceStorm/Notifier.cpp +++ b/perf/src/IceStorm/Notifier.cpp @@ -35,24 +35,24 @@ Notifier::run(int argc, char* argv[]) vector<string> proxies; for(int i = 1; i < argc; i++) { - proxies.push_back(argv[i]); + proxies.push_back(argv[i]); } vector<Perf::SyncPrx> syncs; { - for(vector<string>::const_iterator p = proxies.begin(); p != proxies.end(); ++p) - { - SyncPrx s = Perf::SyncPrx::uncheckedCast(communicator()->stringToProxy(*p)->ice_oneway()); - s->ice_ping(); - syncs.push_back(s); - } + for(vector<string>::const_iterator p = proxies.begin(); p != proxies.end(); ++p) + { + SyncPrx s = Perf::SyncPrx::uncheckedCast(communicator()->stringToProxy(*p)->ice_oneway()); + s->ice_ping(); + syncs.push_back(s); + } } { - for(vector<Perf::SyncPrx>::const_iterator p = syncs.begin(); p != syncs.end(); ++p) - { - (*p)->notify(); - } + for(vector<Perf::SyncPrx>::const_iterator p = syncs.begin(); p != syncs.end(); ++p) + { + (*p)->notify(); + } } return EXIT_SUCCESS; diff --git a/perf/src/IceStorm/PerfI.cpp b/perf/src/IceStorm/PerfI.cpp index 26241d8134b..b184e519dfd 100644 --- a/perf/src/IceStorm/PerfI.cpp +++ b/perf/src/IceStorm/PerfI.cpp @@ -35,28 +35,28 @@ PingI::tick(Ice::Long time, Perf::AEnum e , int, const Perf::AStruct& s, const I Lock sync(*this); if(time > 0) { - add(time); + add(time); } else if(time == 0) { - _payloadSize += sizeof(e); - _payloadSize += sizeof(Ice::Int); + _payloadSize += sizeof(e); + _payloadSize += sizeof(Ice::Int); - // - // This needs to be kept up to date with the definition of the - // structure in the slice. - // - _payloadSize += sizeof(s.e); - _payloadSize += sizeof(s.d); - _payloadSize += s.s.size(); - started(); + // + // This needs to be kept up to date with the definition of the + // structure in the slice. + // + _payloadSize += sizeof(s.e); + _payloadSize += sizeof(s.d); + _payloadSize += s.s.size(); + started(); } else if(time < 0) { - if(stopped()) - { - current.adapter->getCommunicator()->shutdown(); - } + if(stopped()) + { + current.adapter->getCommunicator()->shutdown(); + } } } @@ -66,22 +66,22 @@ PingI::tickVoid(Ice::Long time, const Ice::Current& current) Lock sync(*this); if(time > 0) { - add(time); + add(time); } else if(time == 0) { - started(); + started(); } else if(time == -1) { - if(stopped()) - { - current.adapter->getCommunicator()->shutdown(); - } + if(stopped()) + { + current.adapter->getCommunicator()->shutdown(); + } } else if(time < 0) { - cerr << "time < 0: " << time << endl; + cerr << "time < 0: " << time << endl; } } @@ -90,7 +90,7 @@ PingI::started() { if(++_nStartedPublishers == _nPublishers) { - _startTime = IceUtil::Time::now(); + _startTime = IceUtil::Time::now(); } } @@ -108,22 +108,22 @@ PingI::stopped() // if(_nStoppedPublishers == 0) { - _stopTime = IceUtil::Time::now(); + _stopTime = IceUtil::Time::now(); } if(_nStartedPublishers < _nPublishers) { - cerr << "Some publishers are already finished while others aren't even started" << endl; - cerr << _nPublishers << " " << _nStartedPublishers << " " << _nStoppedPublishers << endl; - cerr << _startTime - _stopTime << " " << _results.size() << " " << _nReceived << endl; + cerr << "Some publishers are already finished while others aren't even started" << endl; + cerr << _nPublishers << " " << _nStartedPublishers << " " << _nStoppedPublishers << endl; + cerr << _startTime - _stopTime << " " << _results.size() << " " << _nReceived << endl; } if(++_nStoppedPublishers == _nPublishers) { - calc(); - return true; + calc(); + return true; } else { - return false; + return false; } } @@ -138,17 +138,17 @@ PingI::add(Ice::Long time) if(_nStartedPublishers == _nPublishers && _nStoppedPublishers == 0) { #ifdef WIN32 - LARGE_INTEGER t; - QueryPerformanceCounter(&t); - Ice::Long interval = t.QuadPart - time; - QueryPerformanceFrequency(&t); - interval /= t.QuadPart; // Frequency is counts per second. - interval *= 1000000; // Convert to microseconds. - _results.push_back(interval); + LARGE_INTEGER t; + QueryPerformanceCounter(&t); + Ice::Long interval = t.QuadPart - time; + QueryPerformanceFrequency(&t); + interval /= t.QuadPart; // Frequency is counts per second. + interval *= 1000000; // Convert to microseconds. + _results.push_back(interval); #else - IceUtil::Time t = IceUtil::Time::microSeconds(time); - IceUtil::Time interval = IceUtil::Time::now() - t; - _results.push_back(static_cast<Ice::Long>(interval.toMicroSeconds())); + IceUtil::Time t = IceUtil::Time::microSeconds(time); + IceUtil::Time interval = IceUtil::Time::now() - t; + _results.push_back(static_cast<Ice::Long>(interval.toMicroSeconds())); #endif } } @@ -165,10 +165,10 @@ PingI::calc() double total = 0.0; { - for(vector<Ice::Long>::const_iterator p = _results.begin(); p != _results.end(); ++p) - { - total += (*p); - } + for(vector<Ice::Long>::const_iterator p = _results.begin(); p != _results.end(); ++p) + { + total += (*p); + } } double newSize = _results.size(); double mean = total / newSize; @@ -176,10 +176,10 @@ PingI::calc() double deviation; double x = 0.0; { - for(vector<Ice::Long>::const_iterator p = _results.begin(); p != _results.end(); ++p) - { - x += (*p - mean) * (*p - mean); - } + for(vector<Ice::Long>::const_iterator p = _results.begin(); p != _results.end(); ++p) + { + x += (*p - mean) * (*p - mean); + } } deviation = sqrt(x / (_results.size() - 1)); @@ -192,14 +192,14 @@ PingI::calc() // if(originalSize < (_nExpectedTicks * 0.90)) { - cerr << "WARNING: Less than 90% of the expected ticks were used for the test. " << - _nExpectedTicks << " events were expected, but only " << originalSize << " were received.\n" << endl; - cerr << "The results are based on a smaller sample size and comparisons with other tests\n" - "may not be fair." << endl; + cerr << "WARNING: Less than 90% of the expected ticks were used for the test. " << + _nExpectedTicks << " events were expected, but only " << originalSize << " were received.\n" << endl; + cerr << "The results are based on a smaller sample size and comparisons with other tests\n" + "may not be fair." << endl; } cout << "{ 'latency' : " << mean / 1000 << ", 'deviation' : " << deviation << ", 'throughput' : " << - ((double)(originalSize * _payloadSize) / (1024^2)) / (_stopTime - _startTime).toMilliSecondsDouble() * 1000.0 << - ", 'repetitions': " << originalSize << ", 'payload': " << _payloadSize << "}" << endl; + ((double)(originalSize * _payloadSize) / (1024^2)) / (_stopTime - _startTime).toMilliSecondsDouble() * 1000.0 << + ", 'repetitions': " << originalSize << ", 'payload': " << _payloadSize << "}" << endl; _results.clear(); _nStartedPublishers = 0; diff --git a/perf/src/IceStorm/Publisher.cpp b/perf/src/IceStorm/Publisher.cpp index 03261d1d9ec..da7e0a56586 100644 --- a/perf/src/IceStorm/Publisher.cpp +++ b/perf/src/IceStorm/Publisher.cpp @@ -44,19 +44,19 @@ public: virtual void waitNotification() { - Lock sync(*this); - while(!_notified) - { - wait(); - } + Lock sync(*this); + while(!_notified) + { + wait(); + } } virtual void notify(const Ice::Current&) { - Lock sync(*this); - _notified = true; - notifyAll(); + Lock sync(*this); + _notified = true; + notifyAll(); } private: @@ -88,22 +88,22 @@ Publisher::run(int argc, char* argv[]) bool payload = false; for(int i = 0; i < argc; i++) { - if(strcmp(argv[i], "-p") == 0) - { - period = atoi(argv[++i]); - } - else if(strcmp(argv[i], "-r") == 0) - { - repetitions = atoi(argv[++i]); - } - if(strcmp(argv[i], "-t") == 0) - { - twoway = true; - } - if(strcmp(argv[i], "-w") == 0) - { - payload = true; - } + if(strcmp(argv[i], "-p") == 0) + { + period = atoi(argv[++i]); + } + else if(strcmp(argv[i], "-r") == 0) + { + repetitions = atoi(argv[++i]); + } + if(strcmp(argv[i], "-t") == 0) + { + twoway = true; + } + if(strcmp(argv[i], "-w") == 0) + { + payload = true; + } } Ice::PropertiesPtr properties = communicator()->getProperties(); @@ -112,16 +112,16 @@ Publisher::run(int argc, char* argv[]) string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { - cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator()->stringToProxy(proxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << appName() << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << appName() << ": invalid proxy" << endl; + return EXIT_FAILURE; } // @@ -130,12 +130,12 @@ Publisher::run(int argc, char* argv[]) IceStorm::TopicPrx topic; try { - topic = manager->retrieve("time"); + topic = manager->retrieve("time"); } catch(const IceStorm::NoSuchTopic& e) { - cerr << appName() << ": " << e << " name: " << e.name << endl; - return EXIT_FAILURE; + cerr << appName() << ": " << e << " name: " << e.name << endl; + return EXIT_FAILURE; } assert(topic); @@ -149,11 +149,11 @@ Publisher::run(int argc, char* argv[]) PingPrx ping; if(twoway) { - ping = PingPrx::uncheckedCast(topic->getPublisher()->ice_twoway()); + ping = PingPrx::uncheckedCast(topic->getPublisher()->ice_twoway()); } else { - ping = PingPrx::uncheckedCast(topic->getPublisher()->ice_oneway()); + ping = PingPrx::uncheckedCast(topic->getPublisher()->ice_oneway()); } ping->ice_ping(); cout << communicator()->proxyToString(obj) << endl; @@ -168,31 +168,31 @@ Publisher::run(int argc, char* argv[]) if(!payload) { - ping->tickVoid(0); - for(int i = 0; i < repetitions; ++i) - { - ping->tickVoid(getTick()); - if(period > 0) - { - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(period)); - } - } - ping->tickVoid(-1); + ping->tickVoid(0); + for(int i = 0; i < repetitions; ++i) + { + ping->tickVoid(getTick()); + if(period > 0) + { + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(period)); + } + } + ping->tickVoid(-1); } else { - ping->tick(0, A, 10, AStruct()); - for(int i = 0; i < repetitions; ++i) - { - AStruct s; - s.s = "TEST"; - ping->tick(getTick(), A, 10, s); - if(period > 0) - { - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(period)); - } - } - ping->tick(-1, A, 10, AStruct()); + ping->tick(0, A, 10, AStruct()); + for(int i = 0; i < repetitions; ++i) + { + AStruct s; + s.s = "TEST"; + ping->tick(getTick(), A, 10, s); + if(period > 0) + { + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(period)); + } + } + ping->tick(-1, A, 10, AStruct()); } return EXIT_SUCCESS; diff --git a/perf/src/IceStorm/Subscriber.cpp b/perf/src/IceStorm/Subscriber.cpp index 57a93ef3a59..f2e561f0189 100644 --- a/perf/src/IceStorm/Subscriber.cpp +++ b/perf/src/IceStorm/Subscriber.cpp @@ -44,26 +44,26 @@ Subscriber::run(int argc, char* argv[]) int nPublishers = 1; for(int i = 0; i < argc; i++) { - if(strcmp(argv[i], "-r") == 0) - { - repetitions = atoi(argv[++i]); - } - if(strcmp(argv[i], "-b") == 0) - { - batch = true; - } - if(strcmp(argv[i], "-t") == 0) - { - twoway = true; - } - if(strcmp(argv[i], "-o") == 0) - { - ordered = true; - } - if(strcmp(argv[i], "-c") == 0) - { - nPublishers = atoi(argv[++i]); - } + if(strcmp(argv[i], "-r") == 0) + { + repetitions = atoi(argv[++i]); + } + if(strcmp(argv[i], "-b") == 0) + { + batch = true; + } + if(strcmp(argv[i], "-t") == 0) + { + twoway = true; + } + if(strcmp(argv[i], "-o") == 0) + { + ordered = true; + } + if(strcmp(argv[i], "-c") == 0) + { + nPublishers = atoi(argv[++i]); + } } Ice::PropertiesPtr properties = communicator()->getProperties(); @@ -72,16 +72,16 @@ Subscriber::run(int argc, char* argv[]) string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { - cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; - return EXIT_FAILURE; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; + return EXIT_FAILURE; } Ice::ObjectPrx base = communicator()->stringToProxy(proxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << appName() << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << appName() << ": invalid proxy" << endl; + return EXIT_FAILURE; } // @@ -92,15 +92,15 @@ Subscriber::run(int argc, char* argv[]) IceStorm::QoS qos; if(batch) { - qos["reliability"] = "batch"; + qos["reliability"] = "batch"; } else if(twoway) { - qos["reliability"] = "twoway"; + qos["reliability"] = "twoway"; } else if(ordered) { - qos["reliability"] = "twoway-ordered"; + qos["reliability"] = "twoway-ordered"; } // @@ -116,18 +116,18 @@ Subscriber::run(int argc, char* argv[]) IceStorm::TopicPrx topic; try { - topic = manager->retrieve("time"); + topic = manager->retrieve("time"); } catch(const IceStorm::NoSuchTopic&) { - try - { - topic = manager->create("time"); - } - catch(const IceStorm::TopicExists&) - { - topic = manager->retrieve("time"); - } + try + { + topic = manager->create("time"); + } + catch(const IceStorm::TopicExists&) + { + topic = manager->retrieve("time"); + } } topic->subscribe(qos, object); diff --git a/perf/src/TAO/Roundtrip.h b/perf/src/TAO/Roundtrip.h index a8c51ebf1f9..91bf2749980 100644 --- a/perf/src/TAO/Roundtrip.h +++ b/perf/src/TAO/Roundtrip.h @@ -31,25 +31,25 @@ public: // = The skeleton methods virtual void sendByteSeq(const Test::ByteSeq & seq ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void sendStringSeq(const Test::StringSeq & seq ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void sendStringDoubleSeq(const Test::StringDoubleSeq & seq ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void test_method(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void test_oneway(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void test_oneway_with_data(const Test::ByteSeq& seq ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); virtual void shutdown(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC((CORBA::SystemException)); + ACE_THROW_SPEC((CORBA::SystemException)); private: // diff --git a/perf/src/TAO/Roundtrip_Handler.cpp b/perf/src/TAO/Roundtrip_Handler.cpp index 119c51dace4..71d15833e25 100644 --- a/perf/src/TAO/Roundtrip_Handler.cpp +++ b/perf/src/TAO/Roundtrip_Handler.cpp @@ -41,12 +41,12 @@ Roundtrip_Handler::sendByteSeq_excep(Messaging::ExceptionHolder *holder { ACE_TRY { - holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendByteSeq:"); + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendByteSeq:"); } ACE_ENDTRY; } @@ -64,12 +64,12 @@ Roundtrip_Handler::sendStringSeq_excep(Messaging::ExceptionHolder *holder { ACE_TRY { - holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendStringSeq:"); + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendStringSeq:"); } ACE_ENDTRY; } @@ -87,12 +87,12 @@ Roundtrip_Handler::sendStringDoubleSeq_excep(Messaging::ExceptionHolder *holder { ACE_TRY { - holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendStringDoubleSeq:"); + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "sendStringDoubleSeq:"); } ACE_ENDTRY; } @@ -113,12 +113,12 @@ Roundtrip_Handler::test_method_excep(Messaging::ExceptionHolder *holder { ACE_TRY { - holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "test_method:"); + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "test_method:"); } ACE_ENDTRY; } @@ -139,12 +139,12 @@ Roundtrip_Handler::shutdown_excep(Messaging::ExceptionHolder *holder { ACE_TRY { - holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + holder->raise_exception(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "shutdown:"); + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "shutdown:"); } ACE_ENDTRY; } diff --git a/perf/src/TAO/Roundtrip_Handler.h b/perf/src/TAO/Roundtrip_Handler.h index 1f35e109497..ef4a15ad2bb 100644 --- a/perf/src/TAO/Roundtrip_Handler.h +++ b/perf/src/TAO/Roundtrip_Handler.h @@ -36,35 +36,35 @@ public: // = The skeleton methods virtual void sendByteSeq(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void sendByteSeq_excep(Messaging::ExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void sendStringSeq(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void sendStringSeq_excep(Messaging::ExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void sendStringDoubleSeq(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void sendStringDoubleSeq_excep(Messaging::ExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void test_method(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void test_method_excep(Messaging::ExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void shutdown(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC ((CORBA::SystemException)); virtual void shutdown_excep(Messaging::ExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); private: diff --git a/perf/src/TAO/WorkerThread.cpp b/perf/src/TAO/WorkerThread.cpp index ad576fd7fab..eac0161701c 100644 --- a/perf/src/TAO/WorkerThread.cpp +++ b/perf/src/TAO/WorkerThread.cpp @@ -20,8 +20,8 @@ WorkerThread::svc() ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - _orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + _orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY {} ACE_ENDTRY; return 0; diff --git a/perf/src/TAO/client.cpp b/perf/src/TAO/client.cpp index eea59e8b436..e639e932919 100644 --- a/perf/src/TAO/client.cpp +++ b/perf/src/TAO/client.cpp @@ -24,326 +24,326 @@ main(int argc, char *argv[]) { ACE_TRY_NEW_ENV { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var object = orb->resolve_initial_references("PolicyCurrent" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::PolicyCurrent_var policy_current = CORBA::PolicyCurrent::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Any scope_as_any; - scope_as_any <<= Messaging::SYNC_WITH_TRANSPORT; - - CORBA::PolicyList policies(1); - policies.length(1); - policies[0] = orb->create_policy(Messaging::SYNC_SCOPE_POLICY_TYPE, scope_as_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - policy_current->set_policy_overrides(policies, CORBA::ADD_OVERRIDE ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - policies[0]->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - bool latency = false; - bool oneway = false; - bool twoway = false; - bool ami = false; - - bool throughput = false; - bool sendBytes = false; - bool sendStrings = false; - bool sendLongStrings = false; - bool sendStructs = false; - long byteSeqSize = 0; - Ice::Int payloadSize = 0; - int repetitions; - - int i; - for(i = 0; i < argc; ++i) - { - if(strcmp(argv[i], "latency") == 0) - { - latency = true; - } - else if(strcmp(argv[i], "throughput") == 0) - { - throughput = true; - } - else if(strcmp(argv[i], "oneway") == 0) - { - oneway = true; - } - else if(strcmp(argv[i], "twoway") == 0) - { - twoway = true; - } - else if(strcmp(argv[i], "ami") == 0) - { - ami = true; - } - else if(strcmp(argv[i], "byte") == 0) - { - sendBytes = true; - } - else if(strcmp(argv[i], "string") == 0) - { - sendStrings = true; - } - else if(strcmp(argv[i], "longString") == 0) - { - sendLongStrings = true; - } - else if(strcmp(argv[i], "struct") == 0) - { - sendStructs = true; - } - else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) - { - byteSeqSize = strtol(argv[i] + strlen("--payload="), 0, 10); - if(errno == ERANGE) - { - cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; - return EXIT_FAILURE; - } - } - } - - // - // Defaults to latency test if neither was selected. - // - if(!latency && !throughput) - { - latency = true; - } - - if(latency) - { - if(!oneway && !twoway) - { - twoway = true; - } - } - else if(throughput) - { - if(!sendBytes && !sendStrings && !sendLongStrings && !sendStructs) - { - sendBytes = true; - } - } - - object = orb->string_to_object("file://test.ior" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = Test::Roundtrip::_narrow(object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if(CORBA::is_nil(roundtrip.in())) + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var object = orb->resolve_initial_references("PolicyCurrent" ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::PolicyCurrent_var policy_current = CORBA::PolicyCurrent::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Any scope_as_any; + scope_as_any <<= Messaging::SYNC_WITH_TRANSPORT; + + CORBA::PolicyList policies(1); + policies.length(1); + policies[0] = orb->create_policy(Messaging::SYNC_SCOPE_POLICY_TYPE, scope_as_any ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policy_current->set_policy_overrides(policies, CORBA::ADD_OVERRIDE ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policies[0]->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + bool latency = false; + bool oneway = false; + bool twoway = false; + bool ami = false; + + bool throughput = false; + bool sendBytes = false; + bool sendStrings = false; + bool sendLongStrings = false; + bool sendStructs = false; + long byteSeqSize = 0; + Ice::Int payloadSize = 0; + int repetitions; + + int i; + for(i = 0; i < argc; ++i) + { + if(strcmp(argv[i], "latency") == 0) + { + latency = true; + } + else if(strcmp(argv[i], "throughput") == 0) + { + throughput = true; + } + else if(strcmp(argv[i], "oneway") == 0) + { + oneway = true; + } + else if(strcmp(argv[i], "twoway") == 0) + { + twoway = true; + } + else if(strcmp(argv[i], "ami") == 0) + { + ami = true; + } + else if(strcmp(argv[i], "byte") == 0) + { + sendBytes = true; + } + else if(strcmp(argv[i], "string") == 0) + { + sendStrings = true; + } + else if(strcmp(argv[i], "longString") == 0) + { + sendLongStrings = true; + } + else if(strcmp(argv[i], "struct") == 0) + { + sendStructs = true; + } + else if(strncmp(argv[i], "--payload=", strlen("--payload=")) == 0) + { + byteSeqSize = strtol(argv[i] + strlen("--payload="), 0, 10); + if(errno == ERANGE) + { + cerr << argv[0] << ": payload argument range error: " << argv[i] << endl; + return EXIT_FAILURE; + } + } + } + + // + // Defaults to latency test if neither was selected. + // + if(!latency && !throughput) { - ACE_ERROR_RETURN((LM_ERROR, "Nil Test::Roundtrip reference <%s>\n", "file://test.ior"), 1); + latency = true; } - roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if(latency) - { - Roundtrip_Handler *roundtrip_handler_impl; - ACE_NEW_RETURN(roundtrip_handler_impl, Roundtrip_Handler(), 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_handler_impl); - - Test::AMI_RoundtripHandler_var roundtrip_handler = - roundtrip_handler_impl->_this(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if(ami) - { - WorkerThread *worker = new WorkerThread(orb.in()); - worker->activate(THR_NEW_LWP | THR_JOINABLE, 1, 1); - } - - IceUtil::Time start = IceUtil::Time::now(); - - if(oneway) - { - repetitions = 500000; - } - else - { - repetitions = 100000; - } - - Test::ByteSeq seq; - if(byteSeqSize > 0) - { - seq.length(byteSeqSize); - for(int i = 0; i < byteSeqSize; ++i) - { - seq[i] = '0' + (char)(i % 10); - } - payloadSize = seq.length() * sizeof(seq[0]); - } - - for(int i = 0; i != repetitions; ++i) - { - if(oneway) - { - if(byteSeqSize > 0) - { - roundtrip->test_oneway_with_data(seq ACE_ENV_ARG_DECL_WITH_DEFAULTS); - ACE_TRY_CHECK; - } - else - { - roundtrip->test_oneway(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - else if(ami) - { - if(byteSeqSize > 0) - { + if(latency) + { + if(!oneway && !twoway) + { + twoway = true; + } + } + else if(throughput) + { + if(!sendBytes && !sendStrings && !sendLongStrings && !sendStructs) + { + sendBytes = true; + } + } + + object = orb->string_to_object("file://test.ior" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Test::Roundtrip_var roundtrip = Test::Roundtrip::_narrow(object.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if(CORBA::is_nil(roundtrip.in())) + { + ACE_ERROR_RETURN((LM_ERROR, "Nil Test::Roundtrip reference <%s>\n", "file://test.ior"), 1); + } + + roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if(latency) + { + Roundtrip_Handler *roundtrip_handler_impl; + ACE_NEW_RETURN(roundtrip_handler_impl, Roundtrip_Handler(), 1); + PortableServer::ServantBase_var owner_transfer(roundtrip_handler_impl); + + Test::AMI_RoundtripHandler_var roundtrip_handler = + roundtrip_handler_impl->_this(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if(ami) + { + WorkerThread *worker = new WorkerThread(orb.in()); + worker->activate(THR_NEW_LWP | THR_JOINABLE, 1, 1); + } + + IceUtil::Time start = IceUtil::Time::now(); + + if(oneway) + { + repetitions = 500000; + } + else + { + repetitions = 100000; + } + + Test::ByteSeq seq; + if(byteSeqSize > 0) + { + seq.length(byteSeqSize); + for(int i = 0; i < byteSeqSize; ++i) + { + seq[i] = '0' + (char)(i % 10); + } + payloadSize = seq.length() * sizeof(seq[0]); + } + + for(int i = 0; i != repetitions; ++i) + { + if(oneway) + { + if(byteSeqSize > 0) + { + roundtrip->test_oneway_with_data(seq ACE_ENV_ARG_DECL_WITH_DEFAULTS); + ACE_TRY_CHECK; + } + else + { + roundtrip->test_oneway(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + else if(ami) + { + if(byteSeqSize > 0) + { + + roundtrip->sendc_sendByteSeq(roundtrip_handler.in(), seq ACE_ENV_ARG_DECL_WITH_DEFAULTS); + ACE_TRY_CHECK; + roundtrip_handler_impl->waitFinished(); + } + else + { + roundtrip->sendc_test_method(roundtrip_handler.in() ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + roundtrip_handler_impl->waitFinished(); + } + } + else if(byteSeqSize > 0) + { + roundtrip->sendByteSeq(seq ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + + if(oneway) + { + roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); + } + + IcePerf::TestPrinter formatter; + formatter.fmt(cout, "TAO", "latency", IceUtil::Time::now() - start, repetitions, payloadSize, argc, argv); + + roundtrip->shutdown(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + repetitions = 1000; + int i; + Test::ByteSeq seq; + seq.length(500000); + + Test::StringSeq stringSeq; + stringSeq.length(50000); + for(i = 0; i < 50000; ++i) + { + stringSeq[i] = CORBA::string_dup("hello"); + } + + Test::StringSeq longStringSeq; + longStringSeq.length(5000); + for(i = 0; i < 5000; ++i) + { + longStringSeq[i] = CORBA::string_dup("As far as the laws of mathematics refer to reality, " + "they are not certain; and as far as they are certain, " + "they do not refer to reality."); + } - roundtrip->sendc_sendByteSeq(roundtrip_handler.in(), seq ACE_ENV_ARG_DECL_WITH_DEFAULTS); - ACE_TRY_CHECK; - roundtrip_handler_impl->waitFinished(); - } - else - { - roundtrip->sendc_test_method(roundtrip_handler.in() ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - roundtrip_handler_impl->waitFinished(); - } - } - else if(byteSeqSize > 0) - { - roundtrip->sendByteSeq(seq ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - else - { - roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - - if(oneway) - { - roundtrip->test_method(ACE_ENV_SINGLE_ARG_PARAMETER); - } - - IcePerf::TestPrinter formatter; - formatter.fmt(cout, "TAO", "latency", IceUtil::Time::now() - start, repetitions, payloadSize, argc, argv); - - roundtrip->shutdown(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - else - { - repetitions = 1000; - int i; - Test::ByteSeq seq; - seq.length(500000); - - Test::StringSeq stringSeq; - stringSeq.length(50000); - for(i = 0; i < 50000; ++i) - { - stringSeq[i] = CORBA::string_dup("hello"); - } - - Test::StringSeq longStringSeq; - longStringSeq.length(5000); - for(i = 0; i < 5000; ++i) - { - longStringSeq[i] = CORBA::string_dup("As far as the laws of mathematics refer to reality, " - "they are not certain; and as far as they are certain, " - "they do not refer to reality."); - } - - Test::StringDoubleSeq stringDoubleSeq; - stringDoubleSeq.length(50000); - for(i = 0; i < 50000; ++i) - { - stringDoubleSeq[i].str = CORBA::string_dup("hello"); - stringDoubleSeq[i].d = 3.14; - } - - IceUtil::Time start = IceUtil::Time::now(); - - if(sendBytes) - { - payloadSize = seq.length() * sizeof(seq[0]); - } - else if(sendStrings) - { - payloadSize = stringSeq.length() * strlen(stringSeq[0]) * sizeof(stringSeq[0][0]); - } - else if(sendLongStrings) - { - payloadSize = longStringSeq.length() * strlen(longStringSeq[0]) * sizeof(longStringSeq[0][0]); - } - else if(sendStructs) - { - payloadSize = stringDoubleSeq.length() * (strlen(stringDoubleSeq[0].str) * sizeof(stringDoubleSeq[0].str[0]) + - sizeof(stringDoubleSeq[0].d)); - } - else - { - assert(false); - } - - for(i = 0; i < repetitions; ++i) - { - if(sendBytes) - { - roundtrip->sendByteSeq(seq); - } - else if(sendStrings) - { - roundtrip->sendStringSeq(stringSeq); - } - else if(sendLongStrings) - { - roundtrip->sendStringSeq(longStringSeq); - } - else if(sendStructs) - { - roundtrip->sendStringDoubleSeq(stringDoubleSeq); - } - } - - IcePerf::TestPrinter formatter; - formatter.fmt(cout, "TAO", "throughput", IceUtil::Time::now() - start, repetitions, payloadSize, argc, argv); - - roundtrip->shutdown(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } + Test::StringDoubleSeq stringDoubleSeq; + stringDoubleSeq.length(50000); + for(i = 0; i < 50000; ++i) + { + stringDoubleSeq[i].str = CORBA::string_dup("hello"); + stringDoubleSeq[i].d = 3.14; + } + + IceUtil::Time start = IceUtil::Time::now(); + + if(sendBytes) + { + payloadSize = seq.length() * sizeof(seq[0]); + } + else if(sendStrings) + { + payloadSize = stringSeq.length() * strlen(stringSeq[0]) * sizeof(stringSeq[0][0]); + } + else if(sendLongStrings) + { + payloadSize = longStringSeq.length() * strlen(longStringSeq[0]) * sizeof(longStringSeq[0][0]); + } + else if(sendStructs) + { + payloadSize = stringDoubleSeq.length() * (strlen(stringDoubleSeq[0].str) * sizeof(stringDoubleSeq[0].str[0]) + + sizeof(stringDoubleSeq[0].d)); + } + else + { + assert(false); + } + + for(i = 0; i < repetitions; ++i) + { + if(sendBytes) + { + roundtrip->sendByteSeq(seq); + } + else if(sendStrings) + { + roundtrip->sendStringSeq(stringSeq); + } + else if(sendLongStrings) + { + roundtrip->sendStringSeq(longStringSeq); + } + else if(sendStructs) + { + roundtrip->sendStringDoubleSeq(stringDoubleSeq); + } + } + + IcePerf::TestPrinter formatter; + formatter.fmt(cout, "TAO", "throughput", IceUtil::Time::now() - start, repetitions, payloadSize, argc, argv); + + roundtrip->shutdown(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Exception caught:"); + return 1; } ACE_ENDTRY; diff --git a/perf/src/TAO/server.cpp b/perf/src/TAO/server.cpp index 36ce8241c9b..a5f51fe405f 100644 --- a/perf/src/TAO/server.cpp +++ b/perf/src/TAO/server.cpp @@ -16,88 +16,88 @@ main(int argc, char *argv[]) { ACE_TRY_NEW_ENV { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poaObject = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poaObject = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - if(CORBA::is_nil(poaObject.in())) - { - ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to initialize the POA.\n"), 1); - } + if(CORBA::is_nil(poaObject.in())) + { + ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) Unable to initialize the POA.\n"), 1); + } - PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObject.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poaManager = rootPOA->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObject.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poaManager = rootPOA->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - int i; - int numthreads = 0; - for(i = 0; i < argc; ++i) - { - if(strcmp(argv[i], "threadPool") == 0) - { - ++i; - if(i == argc) - { - ACE_ERROR_RETURN((LM_ERROR, "missing number of threads\n"), 1); - } - numthreads = atoi(argv[i]); - } - } + int i; + int numthreads = 0; + for(i = 0; i < argc; ++i) + { + if(strcmp(argv[i], "threadPool") == 0) + { + ++i; + if(i == argc) + { + ACE_ERROR_RETURN((LM_ERROR, "missing number of threads\n"), 1); + } + numthreads = atoi(argv[i]); + } + } - Roundtrip *roundtripImpl; - ACE_NEW_RETURN(roundtripImpl, Roundtrip(orb.in()), 1); - PortableServer::ServantBase_var ownerTransfer(roundtripImpl); + Roundtrip *roundtripImpl; + ACE_NEW_RETURN(roundtripImpl, Roundtrip(orb.in()), 1); + PortableServer::ServantBase_var ownerTransfer(roundtripImpl); - Test::Roundtrip_var roundtrip = roundtripImpl->_this(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + Test::Roundtrip_var roundtrip = roundtripImpl->_this(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - CORBA::String_var ior = orb->object_to_string(roundtrip.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::String_var ior = orb->object_to_string(roundtrip.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - // - // If the iorFile exists, output the ior to it - // - FILE *output_file= ACE_OS::fopen("test.ior", "w"); - if(output_file == 0) - { - ACE_ERROR_RETURN((LM_ERROR, "Cannot open output file for writing IOR: %s", "test.ior"), 1); - } + // + // If the iorFile exists, output the ior to it + // + FILE *output_file= ACE_OS::fopen("test.ior", "w"); + if(output_file == 0) + { + ACE_ERROR_RETURN((LM_ERROR, "Cannot open output file for writing IOR: %s", "test.ior"), 1); + } - ACE_OS::fprintf(output_file, "%s", ior.in()); - ACE_OS::fclose(output_file); - - poaManager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - WorkerThread worker(orb.in()); - - std::cout << "POA ready" << std::endl; + ACE_OS::fprintf(output_file, "%s", ior.in()); + ACE_OS::fclose(output_file); + + poaManager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + WorkerThread worker(orb.in()); + + std::cout << "POA ready" << std::endl; - if(numthreads > 0) - { - worker.activate(THR_NEW_LWP | THR_JOINABLE, numthreads, 1); - worker.thr_mgr()->wait(); - } - else - { - orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } + if(numthreads > 0) + { + worker.activate(THR_NEW_LWP | THR_JOINABLE, numthreads, 1); + worker.thr_mgr()->wait(); + } + else + { + orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } - rootPOA->destroy(1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + rootPOA->destroy(1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; + ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Exception caught:"); + return 1; } ACE_ENDTRY; return 0; diff --git a/perf/src/omniORB/Client.cpp b/perf/src/omniORB/Client.cpp index 77bf04b31a7..8366dc43e1f 100644 --- a/perf/src/omniORB/Client.cpp +++ b/perf/src/omniORB/Client.cpp @@ -25,237 +25,237 @@ int main(int argc, char** argv) { try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - bool latency = false; - bool oneway = false; - bool twoway = false; + bool latency = false; + bool oneway = false; + bool twoway = false; - bool throughput = false; - bool sendbytes = false; - bool sendstrings = false; - bool sendlongstrings = false; - bool sendstructs = false; + bool throughput = false; + bool sendbytes = false; + bool sendstrings = false; + bool sendlongstrings = false; + bool sendstructs = false; - int i; - for(i = 0; i < argc; ++i) - { - if(strcmp(argv[i], "latency") == 0) - { - latency = true; - } - else if(strcmp(argv[i], "throughput") == 0) - { - throughput = true; - } - else if(strcmp(argv[i], "oneway") == 0) - { - oneway = true; - } - else if(strcmp(argv[i], "twoway") == 0) - { - twoway = true; - } - else if(strcmp(argv[i], "byte") == 0) - { - sendbytes = true; - } - else if(strcmp(argv[i], "string") == 0) - { - sendstrings = true; - } - else if(strcmp(argv[i], "longString") == 0) - { - sendlongstrings = true; - } - else if(strcmp(argv[i], "struct") == 0) - { - sendstructs = true; - } - } + int i; + for(i = 0; i < argc; ++i) + { + if(strcmp(argv[i], "latency") == 0) + { + latency = true; + } + else if(strcmp(argv[i], "throughput") == 0) + { + throughput = true; + } + else if(strcmp(argv[i], "oneway") == 0) + { + oneway = true; + } + else if(strcmp(argv[i], "twoway") == 0) + { + twoway = true; + } + else if(strcmp(argv[i], "byte") == 0) + { + sendbytes = true; + } + else if(strcmp(argv[i], "string") == 0) + { + sendstrings = true; + } + else if(strcmp(argv[i], "longString") == 0) + { + sendlongstrings = true; + } + else if(strcmp(argv[i], "struct") == 0) + { + sendstructs = true; + } + } - if(!latency && !throughput) - { - latency = true; - } + if(!latency && !throughput) + { + latency = true; + } - if(latency) - { - if(!oneway && !twoway) - { - twoway = true; - } - } - else if(throughput) - { - if(!sendbytes && !sendstrings && !sendlongstrings && !sendstructs) - { - sendbytes = true; - } - } + if(latency) + { + if(!oneway && !twoway) + { + twoway = true; + } + } + else if(throughput) + { + if(!sendbytes && !sendstrings && !sendlongstrings && !sendstructs) + { + sendbytes = true; + } + } - FILE* in = fopen("test.ior", "r"); - if(!in) - { - cerr << "Cannot open test.ior" << endl; - } - char ior[4096]; - fgets(ior, 4096, in); - fclose(in); + FILE* in = fopen("test.ior", "r"); + if(!in) + { + cerr << "Cannot open test.ior" << endl; + } + char ior[4096]; + fgets(ior, 4096, in); + fclose(in); - CORBA::Object_var obj = orb->string_to_object(ior); - if(latency) - { - Throughput_var pingref = Throughput::_narrow(obj); - if( CORBA::is_nil(pingref) ) - { - cerr << "Can't narrow reference to type Throughput (or it was nil)." << endl; - return 1; - } + CORBA::Object_var obj = orb->string_to_object(ior); + if(latency) + { + Throughput_var pingref = Throughput::_narrow(obj); + if( CORBA::is_nil(pingref) ) + { + cerr << "Can't narrow reference to type Throughput (or it was nil)." << endl; + return 1; + } - pingref->ping(); - + pingref->ping(); + #ifdef WIN32 - struct _timeb tb; - _ftime(&tb); - __time64_t start = tb.time * 1000000 + tb.millitm * 1000; + struct _timeb tb; + _ftime(&tb); + __time64_t start = tb.time * 1000000 + tb.millitm * 1000; #else - struct timeval tv; - gettimeofday(&tv, 0); - long start = tv.tv_sec * 1000000 + tv.tv_usec; + struct timeval tv; + gettimeofday(&tv, 0); + long start = tv.tv_sec * 1000000 + tv.tv_usec; #endif - const int repetitions = 100000; - for(int i = 0; i < repetitions; ++i) - { - if(oneway) - { - pingref->ping_oneway(); - } - else - { - pingref->ping(); - } - } + const int repetitions = 100000; + for(int i = 0; i < repetitions; ++i) + { + if(oneway) + { + pingref->ping_oneway(); + } + else + { + pingref->ping(); + } + } - if(oneway) - { - pingref->ping(); - } - + if(oneway) + { + pingref->ping(); + } + #ifdef WIN32 - _ftime(&tb); - float tm = (tb.time * 1000000 + tb.millitm * 1000 - start) / 1000.0f; + _ftime(&tb); + float tm = (tb.time * 1000000 + tb.millitm * 1000 - start) / 1000.0f; #else - gettimeofday(&tv, 0); - float tm = (tv.tv_sec * 1000000 + tv.tv_usec - start) / 1000; + gettimeofday(&tv, 0); + float tm = (tv.tv_sec * 1000000 + tv.tv_usec - start) / 1000; #endif - cout << (float) tm / repetitions << endl; + cout << (float) tm / repetitions << endl; - pingref->shutdown(); - } - else - { - int i; - Throughput_var throughput = Throughput::_narrow(obj); - if( CORBA::is_nil(throughput) ) - { - cerr << "Can't narrow reference to type Throughput (or it was nil)." << endl; - return 1; - } + pingref->shutdown(); + } + else + { + int i; + Throughput_var throughput = Throughput::_narrow(obj); + if( CORBA::is_nil(throughput) ) + { + cerr << "Can't narrow reference to type Throughput (or it was nil)." << endl; + return 1; + } - ByteSeq seq; - seq.length(ByteSeqSize); + ByteSeq seq; + seq.length(ByteSeqSize); - StringSeq stringSeq; - stringSeq.length(StringSeqSize); - for(i = 0; i < StringSeqSize; ++i) - { - stringSeq[i] = CORBA::string_dup("hello"); - } + StringSeq stringSeq; + stringSeq.length(StringSeqSize); + for(i = 0; i < StringSeqSize; ++i) + { + stringSeq[i] = CORBA::string_dup("hello"); + } - StringSeq longStringSeq; - longStringSeq.length(5000); - for(i = 0; i < 5000; ++i) - { - longStringSeq[i] = CORBA::string_dup("As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality."); - } - - StringDoubleSeq stringDoubleSeq; - stringDoubleSeq.length(StringDoubleSeqSize); - for(i = 0; i < StringDoubleSeqSize; ++i) - { - stringDoubleSeq[i].str = CORBA::string_dup("hello"); - stringDoubleSeq[i].d = 3.14; - } + StringSeq longStringSeq; + longStringSeq.length(5000); + for(i = 0; i < 5000; ++i) + { + longStringSeq[i] = CORBA::string_dup("As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality."); + } + + StringDoubleSeq stringDoubleSeq; + stringDoubleSeq.length(StringDoubleSeqSize); + for(i = 0; i < StringDoubleSeqSize; ++i) + { + stringDoubleSeq[i].str = CORBA::string_dup("hello"); + stringDoubleSeq[i].d = 3.14; + } #ifdef WIN32 - struct _timeb tb; - _ftime(&tb); - __time64_t start = tb.time * 1000000 + tb.millitm * 1000; + struct _timeb tb; + _ftime(&tb); + __time64_t start = tb.time * 1000000 + tb.millitm * 1000; #else - struct timeval tv; - gettimeofday(&tv, 0); - long start = tv.tv_sec * 1000000 + tv.tv_usec; + struct timeval tv; + gettimeofday(&tv, 0); + long start = tv.tv_sec * 1000000 + tv.tv_usec; #endif - - const int repetitions = 1000; - for(i = 0; i < repetitions; ++i) - { - if(sendbytes) - { - throughput->sendByteSeq(seq); - } - else if(sendstrings) - { - throughput->sendStringSeq(stringSeq); - } - else if(sendlongstrings) - { - throughput->sendStringSeq(longStringSeq); - } - else if(sendstructs) - { - throughput->sendStringDoubleSeq(stringDoubleSeq); - } - } + + const int repetitions = 1000; + for(i = 0; i < repetitions; ++i) + { + if(sendbytes) + { + throughput->sendByteSeq(seq); + } + else if(sendstrings) + { + throughput->sendStringSeq(stringSeq); + } + else if(sendlongstrings) + { + throughput->sendStringSeq(longStringSeq); + } + else if(sendstructs) + { + throughput->sendStringDoubleSeq(stringDoubleSeq); + } + } #ifdef WIN32 - _ftime(&tb); - float tm = (tb.time * 1000000 + tb.millitm * 1000 - start) / 1000.0f; + _ftime(&tb); + float tm = (tb.time * 1000000 + tb.millitm * 1000 - start) / 1000.0f; #else - gettimeofday(&tv, 0); - float tm = (tv.tv_sec * 1000000 + tv.tv_usec - start) / 1000; + gettimeofday(&tv, 0); + float tm = (tv.tv_sec * 1000000 + tv.tv_usec - start) / 1000; #endif - cout << tm / repetitions << endl; + cout << tm / repetitions << endl; - throughput->shutdown(); - } + throughput->shutdown(); + } - orb->destroy(); + orb->destroy(); } catch(CORBA::COMM_FAILURE&) { - cerr << "Caught system exception COMM_FAILURE -- unable to contact the object." << endl; + cerr << "Caught system exception COMM_FAILURE -- unable to contact the object." << endl; } catch(CORBA::SystemException&) { - cerr << "Caught a CORBA::SystemException." << endl; + cerr << "Caught a CORBA::SystemException." << endl; } catch(CORBA::Exception&) { - cerr << "Caught CORBA::Exception." << endl; + cerr << "Caught CORBA::Exception." << endl; } catch(omniORB::fatalException& fe) { - cerr << "Caught omniORB::fatalException:" << endl; - cerr << " file: " << fe.file() << endl; - cerr << " line: " << fe.line() << endl; - cerr << " mesg: " << fe.errmsg() << endl; + cerr << "Caught omniORB::fatalException:" << endl; + cerr << " file: " << fe.file() << endl; + cerr << " line: " << fe.line() << endl; + cerr << " mesg: " << fe.errmsg() << endl; } catch(...) { - cerr << "Caught unknown exception." << endl; + cerr << "Caught unknown exception." << endl; } return 0; } diff --git a/perf/src/omniORB/Server.cpp b/perf/src/omniORB/Server.cpp index 83d5ab37b73..91269962fc1 100644 --- a/perf/src/omniORB/Server.cpp +++ b/perf/src/omniORB/Server.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace Test; class Throughput_i : public POA_Test::Throughput, - public PortableServer::RefCountServantBase + public PortableServer::RefCountServantBase { public: Throughput_i(CORBA::ORB_ptr); @@ -68,48 +68,48 @@ int main(int argc, char** argv) { try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); - - Throughput_i* myservant = new Throughput_i(orb); - PortableServer::ObjectId_var myservantid = poa->activate_object(myservant); - obj = myservant->_this(); - - // Obtain a reference to the object, and print it out as a - // stringified IOR. - CORBA::String_var sior(orb->object_to_string(obj)); - ofstream os("test.ior"); - os << sior.in() << endl; - os.close(); - - //myecho->_remove_ref(); - - PortableServer::POAManager_var pman = poa->the_POAManager(); - pman->activate(); - cout << "Adapter ready" << endl; - - orb->run(); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); + + Throughput_i* myservant = new Throughput_i(orb); + PortableServer::ObjectId_var myservantid = poa->activate_object(myservant); + obj = myservant->_this(); + + // Obtain a reference to the object, and print it out as a + // stringified IOR. + CORBA::String_var sior(orb->object_to_string(obj)); + ofstream os("test.ior"); + os << sior.in() << endl; + os.close(); + + //myecho->_remove_ref(); + + PortableServer::POAManager_var pman = poa->the_POAManager(); + pman->activate(); + cout << "Adapter ready" << endl; + + orb->run(); } catch(CORBA::SystemException&) { - cerr << "Caught CORBA::SystemException." << endl; + cerr << "Caught CORBA::SystemException." << endl; } catch(CORBA::Exception&) { - cerr << "Caught CORBA::Exception." << endl; + cerr << "Caught CORBA::Exception." << endl; } catch(omniORB::fatalException& fe) { - cerr << "Caught omniORB::fatalException:" << endl; - cerr << " file: " << fe.file() << endl; - cerr << " line: " << fe.line() << endl; - cerr << " mesg: " << fe.errmsg() << endl; + cerr << "Caught omniORB::fatalException:" << endl; + cerr << " file: " << fe.file() << endl; + cerr << " line: " << fe.line() << endl; + cerr << " mesg: " << fe.errmsg() << endl; } catch(...) { - cerr << "Caught unknown exception." << endl; + cerr << "Caught unknown exception." << endl; } return 0; diff --git a/php/test/Ice/checksum/Client.php b/php/test/Ice/checksum/Client.php index 51bbd277b2f..51bbd277b2f 100755..100644 --- a/php/test/Ice/checksum/Client.php +++ b/php/test/Ice/checksum/Client.php diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php index db1158a94eb..5af9c43ce11 100644 --- a/php/test/Ice/objects/Client.php +++ b/php/test/Ice/objects/Client.php @@ -146,7 +146,7 @@ class MyObjectFactory implements Ice_ObjectFactory { return new FI(); } - else if($id == "::Test::I") + else if($id == "::Test::I") { return new II(); } diff --git a/vsaddin/src/IceCsharpConfigurationDialog.cs b/vsaddin/src/IceCsharpConfigurationDialog.cs index 57a58ce5775..57a58ce5775 100755..100644 --- a/vsaddin/src/IceCsharpConfigurationDialog.cs +++ b/vsaddin/src/IceCsharpConfigurationDialog.cs |