summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-04-20 21:24:48 +0000
committerMark Spruiell <mes@zeroc.com>2004-04-20 21:24:48 +0000
commit8d17c0a0c6cffab3da3415b33599fa7a76645491 (patch)
tree156727536a4215aae32c66fe184fc50c0d5d6eaf /cpp/src
parentAdded guard (diff)
downloadice-8d17c0a0c6cffab3da3415b33599fa7a76645491.tar.bz2
ice-8d17c0a0c6cffab3da3415b33599fa7a76645491.tar.xz
ice-8d17c0a0c6cffab3da3415b33599fa7a76645491.zip
adding support for download totals; misc minor cleanup
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IcePatch/.depend3
-rw-r--r--cpp/src/IcePatch/Calc.cpp435
-rw-r--r--cpp/src/IcePatch/Client.cpp117
-rw-r--r--cpp/src/IcePatch/FileLocator.cpp11
-rw-r--r--cpp/src/IcePatch/FileLocator.h2
-rw-r--r--cpp/src/IcePatch/IcePatchI.cpp80
-rw-r--r--cpp/src/IcePatch/IcePatchI.h11
-rw-r--r--cpp/src/IcePatch/Makefile27
-rw-r--r--cpp/src/IcePatch/Server.cpp224
-rw-r--r--cpp/src/IcePatch/Util.cpp154
-rw-r--r--cpp/src/IcePatch/icepatchcalc.dsp118
11 files changed, 988 insertions, 194 deletions
diff --git a/cpp/src/IcePatch/.depend b/cpp/src/IcePatch/.depend
index 9d3ff6cb0a2..cc175112b17 100644
--- a/cpp/src/IcePatch/.depend
+++ b/cpp/src/IcePatch/.depend
@@ -3,7 +3,8 @@ FileDescFactory.o: FileDescFactory.cpp ../../include/IcePatch/FileDescFactory.h
Util.o: Util.cpp ../../include/IcePatch/Util.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/IceUtil/InputUtil.h
ClientUtil.o: ClientUtil.cpp ../../include/IcePatch/Util.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/IcePatch/ClientUtil.h
Client.o: Client.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/IcePatch/FileDescFactory.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/IcePatch/Util.h ../../include/IcePatch/ClientUtil.h ../../include/Glacier/Glacier.h ../../include/Glacier/Starter.h ../../include/Glacier/Router.h ../../include/Ice/Router.h ../../include/Glacier/SessionF.h ../../include/Glacier/Session.h ../../include/Glacier/SessionManager.h ../../include/IceUtil/Base64.h ../../include/IceSSL/Plugin.h ../../include/Ice/Plugin.h ../../include/IceSSL/CertificateVerifierF.h
-Server.o: Server.cpp ../../include/IceUtil/IceUtil.h ../../include/IceUtil/Functional.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Unicode.h ../../include/IceUtil/UUID.h ../../include/IceUtil/AbstractMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/RWRecMutex.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/IceUtil/Thread.h ../../include/IceUtil/StaticMutex.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Base64.h ../../include/IceUtil/InputUtil.h ../../include/IceUtil/OutputUtil.h ../../include/IceUtil/GC.h ../../include/Ice/Config.h ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../IcePatch/FileLocator.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/Ice/UserExceptionFactoryF.h ../IcePatch/IcePatchI.h
+Calc.o: Calc.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IcePatch/Util.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h
+Server.o: Server.cpp ../../include/IceUtil/IceUtil.h ../../include/IceUtil/Functional.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Unicode.h ../../include/IceUtil/UUID.h ../../include/IceUtil/AbstractMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/RWRecMutex.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/IceUtil/Thread.h ../../include/IceUtil/StaticMutex.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Base64.h ../../include/IceUtil/InputUtil.h ../../include/IceUtil/OutputUtil.h ../../include/IceUtil/GC.h ../../include/Ice/Config.h ../../include/Ice/Service.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/LoggerF.h ../IcePatch/FileLocator.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/Ice/UserExceptionFactoryF.h ../IcePatch/IcePatchI.h ../../include/IcePatch/Util.h
IcePatchI.o: IcePatchI.cpp ../IcePatch/IcePatchI.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IceUtil/RWRecMutex.h ../../include/IceUtil/Thread.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/IcePatch/Util.h
FileLocator.o: FileLocator.cpp ../IcePatch/FileLocator.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ../../include/IceUtil/GCShared.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Stats.h ../../include/Ice/Communicator.h ../../include/Ice/StatsF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/OutgoingAsync.h ../../include/IceUtil/RecMutex.h ../../include/Ice/IncomingAsync.h ../../include/Ice/Process.h ../../include/Ice/Application.h ../../include/IcePatch/IcePatch.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/FactoryTable.h ../../include/Ice/FactoryTableDef.h ../../include/IceUtil/StaticMutex.h ../../include/Ice/UserExceptionFactoryF.h ../../include/IcePatch/Util.h ../IcePatch/IcePatchI.h ../../include/IceUtil/RWRecMutex.h ../../include/IceUtil/Thread.h
IcePatch.cpp: ../../slice/IcePatch/IcePatch.ice ../../slice/Ice/BuiltinSequences.ice
diff --git a/cpp/src/IcePatch/Calc.cpp b/cpp/src/IcePatch/Calc.cpp
new file mode 100644
index 00000000000..8eb8a98c3a6
--- /dev/null
+++ b/cpp/src/IcePatch/Calc.cpp
@@ -0,0 +1,435 @@
+// **********************************************************************
+//
+// Copyright (c) 2004
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IcePatch/Util.h>
+#include <set>
+
+using namespace std;
+using namespace Ice;
+using namespace IcePatch;
+
+class CalcApp : public Application
+{
+public:
+
+ void usage();
+ virtual int run(int, char*[]);
+
+private:
+
+ void update(const string&);
+ Long compare(const string&, const string&);
+
+ bool _totals;
+};
+
+void
+CalcApp::usage()
+{
+ cerr << "Usage: " << appName() << " [options] DIR [OLD_DIR OLD_DIR ...]\n";
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-t Show totals.\n"
+ ;
+}
+
+int
+CalcApp::run(int argc, char* argv[])
+{
+ string dataDir;
+ vector<string> oldDataDirs;
+ _totals = false;
+
+ int i;
+ for(i = 1; i < argc; ++i)
+ {
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ {
+ usage();
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[i], "-t") == 0)
+ {
+ _totals = true;
+ }
+ else if(argv[i][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ if(dataDir.empty())
+ {
+ dataDir = argv[i];
+ }
+ else
+ {
+ oldDataDirs.push_back(argv[i]);
+ }
+ }
+ }
+
+ if(dataDir.empty())
+ {
+ cerr << argv[0] << ": no data directory specified" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+
+ //
+ // Update the data directory (create .bz2 and .md5 files).
+ //
+ cout << "Updating data directory...";
+ if(_totals)
+ {
+ cout << endl;
+ }
+ else
+ {
+ cout << flush;
+ }
+
+ try
+ {
+ update(dataDir);
+ }
+ catch(const FileAccessException& ex)
+ {
+ cerr << endl << "exception during update:\n" << ex << ":\n" << ex.reason << endl;
+ return EXIT_FAILURE;
+ }
+ catch(const Exception& ex)
+ {
+ cerr << endl << "exception during update:\n" << ex << endl;
+ return EXIT_FAILURE;
+ }
+
+ if(!_totals)
+ {
+ cout << " done." << endl;
+ }
+
+ if(!oldDataDirs.empty())
+ {
+ for(vector<string>::iterator p = oldDataDirs.begin(); p != oldDataDirs.end(); ++p)
+ {
+ cout << "Comparing with " << *p << "...";
+ if(_totals)
+ {
+ cout << endl;
+ }
+ else
+ {
+ cout << flush;
+ }
+
+ try
+ {
+ compare(*p, dataDir);
+ }
+ catch(const FileAccessException& ex)
+ {
+ cerr << endl << "exception during comparison:\n" << ex << ":\n" << ex.reason << endl;
+ return EXIT_FAILURE;
+ }
+ catch(const Exception& ex)
+ {
+ cerr << endl << "exception during comparison:\n" << ex << endl;
+ return EXIT_FAILURE;
+ }
+
+ if(!_totals)
+ {
+ cout << " done." << endl;
+ }
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
+
+void
+CalcApp::update(const string& dir)
+{
+ StringSeq contents = readDirectory(dir);
+ StringSeq filteredContents;
+ StringSeq::const_iterator p;
+
+ for(p = contents.begin(); p != contents.end(); ++p)
+ {
+ FileInfo info = getFileInfo(*p, true);
+ if(info.type == FileTypeDirectory)
+ {
+ //
+ // Depth-first traversal.
+ //
+ update(*p);
+ filteredContents.push_back(*p);
+ }
+ else
+ {
+ if(ignoreSuffix(*p))
+ {
+ //
+ // Check for orphans (i.e., bz2 or md5 files for which the original file no longer exists).
+ //
+ string orphan = removeSuffix(*p);
+ FileInfo infoOrphan = getFileInfo(orphan, false);
+ if(infoOrphan.type == FileTypeNotExist)
+ {
+ removeRecursive(*p, 0);
+ }
+ }
+ else
+ {
+ //
+ // Create .bz2 file if necessary.
+ //
+ FileInfo infoBZ2 = getFileInfo(*p + ".bz2", false);
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ {
+ createBZ2(*p, 0);
+ }
+
+ //
+ // Create .md5 file if necessary.
+ //
+ FileInfo infoMD5 = getFileInfo(*p + ".md5", false);
+ if(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
+ {
+ createMD5(*p, 0);
+ }
+
+ filteredContents.push_back(*p);
+ }
+ }
+ }
+
+ //
+ // Create .md5 for directory if necessary.
+ //
+ FileInfo info = getFileInfo(dir, true);
+ FileInfo infoMD5 = getFileInfo(dir + ".md5", false);
+ if(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
+ {
+ createMD5(dir, 0);
+ }
+
+ //
+ // Compute totals if necessary.
+ //
+ FileInfo infoTot = getFileInfo(dir + ".tot", false);
+ if(infoTot.type != FileTypeRegular || infoTot.time <= info.time)
+ {
+ Long total = 0;
+ ByteSeq md5; // Empty
+ for(p = filteredContents.begin(); p != filteredContents.end(); ++p)
+ {
+ FileInfo info = getFileInfo(*p, true);
+ if(info.type == FileTypeDirectory)
+ {
+ TotalMap m = getTotalMap(communicator(), *p);
+ TotalMap::iterator q = m.find(md5);
+ assert(q != m.end());
+ total += q->second;
+ }
+ else
+ {
+ FileInfo infoBZ2 = getFileInfo(*p + ".bz2", true);
+ assert(infoBZ2.type == FileTypeRegular);
+ total += infoBZ2.size;
+ }
+ }
+
+ TotalMap totals = getTotalMap(communicator(), dir);
+ TotalMap::iterator q = totals.find(md5);
+ if(q != totals.end())
+ {
+ q->second = total;
+ }
+ else
+ {
+ totals.insert(TotalMap::value_type(md5, total));
+ }
+ if(_totals)
+ {
+ cout << " " << dir << " (" << total << " bytes)" << endl;
+ }
+ putTotalMap(communicator(), dir, totals);
+ }
+ else if(_totals)
+ {
+ TotalMap totals = getTotalMap(communicator(), dir);
+ ByteSeq md5; // Empty
+ TotalMap::iterator q = totals.find(md5);
+ assert(q != totals.end());
+ cout << " " << dir << " (" << q->second << " bytes)" << endl;
+ }
+}
+
+#ifdef _WIN32
+
+typedef set<string, CICompare> EntrySet;
+
+#else
+
+typedef set<string> EntrySet;
+
+#endif
+
+Long
+CalcApp::compare(const string& oldDir, const string& newDir)
+{
+ Long total = 0;
+
+ ByteSeq oldMD5 = getMD5(oldDir);
+ ByteSeq newMD5 = getMD5(newDir);
+ if(oldMD5 != newMD5)
+ {
+ StringSeq oldContents = readDirectory(oldDir, ".");
+ StringSeq newContents = readDirectory(newDir, ".");
+ StringSeq::const_iterator p;
+
+ EntrySet newEntries;
+ copy(newContents.begin(), newContents.end(), inserter(newEntries, newEntries.begin()));
+
+ for(p = oldContents.begin(); p != oldContents.end(); ++p)
+ {
+ if(ignoreSuffix(*p))
+ {
+ continue;
+ }
+
+ string oldEntry = oldDir + "/" + *p;
+ string newEntry = newDir + "/" + *p;
+ FileInfo oldInfo = getFileInfo(oldEntry, true);
+ FileInfo newInfo = getFileInfo(newEntry, false);
+
+ if(newInfo.type == FileTypeNotExist)
+ {
+ continue;
+ }
+
+ if(oldInfo.type == FileTypeDirectory)
+ {
+ if(newInfo.type == FileTypeDirectory)
+ {
+ total += compare(oldEntry, newEntry);
+ }
+ else
+ {
+ FileInfo infoBZ2 = getFileInfo(newEntry + ".bz2", true);
+ total += infoBZ2.size;
+ }
+ }
+ else
+ {
+ if(newInfo.type == FileTypeDirectory)
+ {
+ TotalMap totals = getTotalMap(communicator(), newEntry);
+ ByteSeq empty;
+ TotalMap::const_iterator q = totals.find(empty);
+ if(q != totals.end())
+ {
+ total += q->second;
+ }
+ }
+ else
+ {
+ ByteSeq oldEntryMD5 = getMD5(oldEntry);
+ ByteSeq newEntryMD5 = getMD5(newEntry);
+ if(oldEntryMD5 != newEntryMD5)
+ {
+ FileInfo newEntryBZ2 = getFileInfo(newEntry + ".bz2", true);
+ total += newEntryBZ2.size;
+ }
+ }
+ }
+
+ newEntries.erase(*p);
+ }
+
+ for(EntrySet::iterator q = newEntries.begin(); q != newEntries.end(); ++q)
+ {
+ if(ignoreSuffix(*q))
+ {
+ continue;
+ }
+
+ string entry = newDir + "/" + *q;
+ FileInfo info = getFileInfo(entry, true);
+ if(info.type == FileTypeDirectory)
+ {
+ TotalMap totals = getTotalMap(communicator(), entry);
+ ByteSeq empty;
+ TotalMap::const_iterator r = totals.find(empty);
+ if(r != totals.end())
+ {
+ total += r->second;
+ }
+ }
+ else
+ {
+ assert(info.type == FileTypeRegular);
+ FileInfo infoBZ2 = getFileInfo(entry + ".bz2", true);
+ total += infoBZ2.size;
+ }
+ }
+ }
+
+ //
+ // An MD5 full of zeros indicates an old directory that is empty.
+ // We ignore this case because the difference is simply the size of
+ // the current directory (i.e., an empty MD5).
+ //
+ ByteSeq zeroMD5(16, 0);
+ if(oldMD5 != zeroMD5)
+ {
+ TotalMap totals = getTotalMap(communicator(), newDir);
+ TotalMap::iterator q = totals.find(oldMD5);
+ if(q != totals.end())
+ {
+ q->second = total;
+ }
+ else
+ {
+ totals.insert(TotalMap::value_type(oldMD5, total));
+ }
+ putTotalMap(communicator(), newDir, totals);
+ }
+
+ if(_totals)
+ {
+ cout << " " << newDir << " (" << total << " bytes)" << endl;
+ }
+
+ return total;
+}
+
+int
+main(int argc, char* argv[])
+{
+ CalcApp app;
+ return app.main(argc, argv);
+}
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp
index 1b047ac9651..1393fde763a 100644
--- a/cpp/src/IcePatch/Client.cpp
+++ b/cpp/src/IcePatch/Client.cpp
@@ -41,13 +41,13 @@ public:
private:
- void patch(const DirectoryDescPtr&, const string&) const;
+ void patch(const DirectoryDescPtr&, const string&, Long&, Long) const;
bool _remove;
bool _thorough;
};
-};
+}
void
IcePatch::Client::usage()
@@ -91,7 +91,7 @@ IcePatch::Client::run(int argc, char* argv[])
++idx;
}
}
-
+
vector<string> subdirs;
if(argc > 1)
{
@@ -200,20 +200,21 @@ IcePatch::Client::run(int argc, char* argv[])
return EXIT_FAILURE;
}
}
-
+
+#ifdef _WIN32
+ char cwd[_MAX_PATH];
+ _getcwd(cwd, _MAX_PATH);
+#else
+ char cwd[PATH_MAX];
+ getcwd(cwd, PATH_MAX);
+#endif
+
//
// Check whether we want to remove orphaned files.
//
_remove = properties->getPropertyAsInt("IcePatch.RemoveOrphaned") > 0;
if(_remove)
{
-#ifdef _WIN32
- char cwd[_MAX_PATH];
- _getcwd(cwd, _MAX_PATH);
-#else
- char cwd[PATH_MAX];
- getcwd(cwd, PATH_MAX);
-#endif
cout << "WARNING: All orphaned files in `" << cwd << "' will be removed." << endl;
string answer;
do
@@ -230,12 +231,12 @@ IcePatch::Client::run(int argc, char* argv[])
}
//
- // Check whether we want to do a through check.
+ // Check whether we want to do a thorough check.
//
_thorough = properties->getPropertyAsInt("IcePatch.Thorough") > 0;
//
- // Create and install the node description factory.
+ // Create and install the node description factories.
//
ObjectFactoryPtr factory = new FileDescFactory;
communicator()->addObjectFactory(factory, "::IcePatch::DirectoryDesc");
@@ -290,8 +291,28 @@ IcePatch::Client::run(int argc, char* argv[])
}
cout << pathToName(*p) << endl;
-
- patch(topDesc, "");
+
+ string dir = *p;
+ if(dir == ".")
+ {
+ dir = cwd;
+ }
+
+ Long total = 0;
+ ByteSeq md5;
+ try
+ {
+ md5 = getMD5(dir);
+ }
+ catch(const FileAccessException&)
+ {
+ }
+ total = topDesc->dir->getTotal(md5);
+
+ Long runningTotal = 0;
+ patch(topDesc, "", runningTotal, total);
+
+ createMD5(dir);
}
}
catch(const FileAccessException& ex)
@@ -336,10 +357,16 @@ class MyProgressCB : public ProgressCB
{
public:
+ MyProgressCB(Long runningTotal, Long patchTotal) :
+ _runningTotal(runningTotal), _patchTotal(patchTotal)
+ {
+ }
+
virtual void startDownload(Int total, Int pos)
{
Ice::Int percent = pos * 100 / total;
cout << " download " << setw(3) << percent << "%" << flush;
+ _fileTotal = 0;
}
virtual void updateDownload(Int total, Int pos)
@@ -351,6 +378,7 @@ public:
virtual void finishedDownload(Int total)
{
updateDownload(total, total);
+ _fileTotal = total;
}
virtual void startUncompress(Int total, Int pos)
@@ -368,47 +396,28 @@ public:
virtual void finishedUncompress(Int total)
{
finishedDownload(total);
+ if(_patchTotal > 0)
+ {
+ Long l = _runningTotal + _fileTotal;
+ Ice::Int percent = (l * 100) / _patchTotal;
+ if(percent > 100)
+ {
+ percent = 100;
+ }
+ cout << " (" << percent << "% complete)";
+ }
cout << endl;
}
-};
-
-#ifdef _WIN32
-//
-// Function object to do case-insensitive string comparison.
-//
-class CICompare : public std::binary_function<std::string, std::string, bool>
-{
-public:
+private:
- bool operator()(const string& s1, const string& s2) const
- {
- string::const_iterator p1 = s1.begin();
- string::const_iterator p2 = s2.begin();
- while(p1 != s1.end() && p2 != s2.end() && ::tolower(*p1) == ::tolower(*p2))
- {
- ++p1;
- ++p2;
- }
- if(p1 == s1.end() && p2 == s2.end())
- {
- return false;
- }
- else if(p1 == s1.end())
- {
- return true;
- }
- else if(p2 == s2.end())
- {
- return false;
- }
- else
- {
- return ::tolower(*p1) < ::tolower(*p2);
- }
- }
+ Long _runningTotal;
+ Long _patchTotal;
+ Int _fileTotal;
};
+#ifdef _WIN32
+
typedef set<string, CICompare> OrphanedSet;
#else
@@ -418,7 +427,8 @@ typedef set<string> OrphanedSet;
#endif
void
-IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) const
+IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent, Long& runningTotal,
+ Long patchTotal) const
{
OrphanedSet orphaned;
@@ -514,7 +524,7 @@ IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) c
newIndent = indent + "| ";
}
- patch(subDirDesc, newIndent);
+ patch(subDirDesc, newIndent, runningTotal, patchTotal);
if(!subDirDesc->md5.empty())
{
@@ -526,7 +536,7 @@ IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) c
assert(regDesc);
cout << indent << "+-" << pathToName(path) << ":";
- MyProgressCB progressCB;
+ MyProgressCB progressCB(runningTotal, patchTotal);
bool update = false;
@@ -619,6 +629,7 @@ IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) c
if(regDesc->md5 == md5)
{
+ runningTotal += regDesc->reg->getBZ2Size();
break;
}
else if(retries < 3)
diff --git a/cpp/src/IcePatch/FileLocator.cpp b/cpp/src/IcePatch/FileLocator.cpp
index 5c36d962e00..93e5e1f6972 100644
--- a/cpp/src/IcePatch/FileLocator.cpp
+++ b/cpp/src/IcePatch/FileLocator.cpp
@@ -20,15 +20,16 @@ using namespace std;
using namespace Ice;
using namespace IcePatch;
-IcePatch::FileLocator::FileLocator(const Ice::ObjectAdapterPtr& adapter) :
- _directory(new DirectoryI(adapter)),
- _regular(new RegularI(adapter)),
+IcePatch::FileLocator::FileLocator(const Ice::ObjectAdapterPtr& adapter, const string& dir) :
+ _directory(new DirectoryI(adapter, dir)),
+ _regular(new RegularI(adapter, dir)),
_logger(adapter->getCommunicator()->getLogger()),
_fileTraceLogger(adapter->getCommunicator()->getProperties()->getPropertyAsInt("IcePatch.Trace.Files") > 0 ?
_logger : LoggerPtr()),
- _dir(adapter->getCommunicator()->getProperties()->getProperty("IcePatch.Directory"))
+ _dir(dir)
{
- if(!_dir.empty() && _dir[_dir.length() - 1] != '/')
+ assert(!_dir.empty());
+ if(_dir[_dir.length() - 1] != '/')
{
const_cast<string&>(_dir) += '/';
}
diff --git a/cpp/src/IcePatch/FileLocator.h b/cpp/src/IcePatch/FileLocator.h
index ce302cbc6cc..46cb5efaec4 100644
--- a/cpp/src/IcePatch/FileLocator.h
+++ b/cpp/src/IcePatch/FileLocator.h
@@ -25,7 +25,7 @@ class FileLocator: virtual public Ice::ServantLocator
{
public:
- FileLocator(const Ice::ObjectAdapterPtr&);
+ FileLocator(const Ice::ObjectAdapterPtr&, const std::string&);
virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&);
diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp
index dfa10dd77a5..0cda4d57ea3 100644
--- a/cpp/src/IcePatch/IcePatchI.cpp
+++ b/cpp/src/IcePatch/IcePatchI.cpp
@@ -14,6 +14,7 @@
#include <IcePatch/IcePatchI.h>
#include <IcePatch/Util.h>
+#include <fstream>
using namespace std;
using namespace Ice;
@@ -21,15 +22,16 @@ using namespace IcePatch;
static IceUtil::RWRecMutex globalMutex;
-IcePatch::FileI::FileI(const ObjectAdapterPtr& adapter) :
+IcePatch::FileI::FileI(const ObjectAdapterPtr& adapter, const string& dir) :
_adapter(adapter),
_fileTraceLogger(adapter->getCommunicator()->getProperties()->getPropertyAsInt("IcePatch.Trace.Files") > 0 ?
adapter->getCommunicator()->getLogger() : LoggerPtr()),
_busyTimeout(IceUtil::Time::seconds(adapter->getCommunicator()->getProperties()->
getPropertyAsIntWithDefault("IcePatch.BusyTimeout", 10))),
- _dir(adapter->getCommunicator()->getProperties()->getProperty("IcePatch.Directory"))
+ _dir(dir)
{
- if(!_dir.empty() && _dir[_dir.length() - 1] != '/')
+ assert(!_dir.empty());
+ if(_dir[_dir.length() - 1] != '/')
{
const_cast<string&>(_dir) += '/';
}
@@ -42,13 +44,14 @@ IcePatch::FileI::readMD5(const Current& current) const
if(path == ".")
{
- //
- // We do not create a MD5 file for the top-level directory.
- //
- return ByteSeq();
+ path = _dir.substr(0, _dir.size() - 1); // Remove trailing '/'.
+ }
+ else
+ {
+ path = _dir + path;
}
- path = _dir + path;
+ string pathMD5 = path + ".md5";
IceUtil::RWRecMutex::TryRLock sync(globalMutex, _busyTimeout);
if(!sync.acquired())
@@ -57,7 +60,7 @@ IcePatch::FileI::readMD5(const Current& current) const
}
FileInfo info = getFileInfo(path, true, _fileTraceLogger);
- FileInfo infoMD5 = getFileInfo(path + ".md5", false, _fileTraceLogger);
+ FileInfo infoMD5 = getFileInfo(pathMD5, false, _fileTraceLogger);
if(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
{
@@ -66,7 +69,7 @@ IcePatch::FileI::readMD5(const Current& current) const
throw BusyException();
}
- infoMD5 = getFileInfo(path + ".md5", false, _fileTraceLogger);
+ infoMD5 = getFileInfo(pathMD5, false, _fileTraceLogger);
while(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
{
//
@@ -79,16 +82,16 @@ IcePatch::FileI::readMD5(const Current& current) const
{
IceUtil::ThreadControl::sleep(diff);
}
-
+
createMD5(path, _fileTraceLogger);
-
+
//
// If the source file size has changed after we
// created the MD5 file, we try again.
//
FileInfo oldInfo = info;
info = getFileInfo(path, true, _fileTraceLogger);
- infoMD5 = getFileInfo(path + ".md5", true, _fileTraceLogger); // Must exist.
+ infoMD5 = getFileInfo(pathMD5, true, _fileTraceLogger); // Must exist.
if(info.size != oldInfo.size)
{
info.time = infoMD5.time;
@@ -99,8 +102,8 @@ IcePatch::FileI::readMD5(const Current& current) const
return getMD5(path);
}
-IcePatch::DirectoryI::DirectoryI(const ObjectAdapterPtr& adapter) :
- FileI(adapter)
+IcePatch::DirectoryI::DirectoryI(const ObjectAdapterPtr& adapter, const string& dir) :
+ FileI(adapter, dir)
{
}
@@ -192,8 +195,46 @@ IcePatch::DirectoryI::getContents(const Current& current) const
return result;
}
-IcePatch::RegularI::RegularI(const ObjectAdapterPtr& adapter) :
- FileI(adapter)
+Long
+IcePatch::DirectoryI::getTotal(const Ice::ByteSeq& md5, const Ice::Current& current) const
+{
+ string path = identityToPath(current.id);
+
+ if(path == ".")
+ {
+ path = _dir.substr(0, _dir.size() - 1); // Remove trailing '/'.
+ }
+ else
+ {
+ path = _dir + path;
+ }
+
+ IceUtil::RWRecMutex::TryRLock sync(globalMutex, _busyTimeout);
+ if(!sync.acquired())
+ {
+ throw BusyException();
+ }
+
+ TotalMap totals = getTotalMap(_adapter->getCommunicator(), path);
+ TotalMap::const_iterator p;
+ ByteSeq zeroMD5(16, 0);
+ if(md5.empty() || md5 == zeroMD5)
+ {
+ p = totals.find(ByteSeq());
+ }
+ else
+ {
+ p = totals.find(md5);
+ }
+ if(p != totals.end())
+ {
+ return p->second;
+ }
+ return -1;
+}
+
+IcePatch::RegularI::RegularI(const ObjectAdapterPtr& adapter, const string& dir) :
+ FileI(adapter, dir)
{
}
@@ -216,7 +257,6 @@ IcePatch::RegularI::describe(const Current& current) const
Int
IcePatch::RegularI::getBZ2Size(const Current& current) const
{
-
IceUtil::RWRecMutex::TryRLock sync(globalMutex, _busyTimeout);
if(!sync.acquired())
{
@@ -256,7 +296,6 @@ IcePatch::RegularI::getBZ2Size(const Current& current) const
}
return static_cast<Int>(infoBZ2.size);
-
}
ByteSeq
@@ -306,7 +345,6 @@ IcePatch::RegularI::getBZ2(Int pos, Int num, const Current& current) const
ByteSeq
IcePatch::RegularI::getBZ2MD5(Int size, const Current& current) const
{
-
IceUtil::RWRecMutex::TryRLock sync(globalMutex, _busyTimeout);
if(!sync.acquired())
{
@@ -345,5 +383,5 @@ IcePatch::RegularI::getBZ2MD5(Int size, const Current& current) const
}
}
- return IcePatch::calcPartialMD5(path + ".bz2", size, _fileTraceLogger);
+ return calcPartialMD5(path + ".bz2", size, _fileTraceLogger);
}
diff --git a/cpp/src/IcePatch/IcePatchI.h b/cpp/src/IcePatch/IcePatchI.h
index 0dc50a1445d..e2243b98dfc 100644
--- a/cpp/src/IcePatch/IcePatchI.h
+++ b/cpp/src/IcePatch/IcePatchI.h
@@ -26,7 +26,7 @@ class FileI : virtual public File
{
public:
- FileI(const Ice::ObjectAdapterPtr&);
+ FileI(const Ice::ObjectAdapterPtr&, const std::string&);
protected:
@@ -42,19 +42,20 @@ class DirectoryI : virtual public Directory,
virtual public FileI
{
public:
-
- DirectoryI(const Ice::ObjectAdapterPtr&);
+
+ DirectoryI(const Ice::ObjectAdapterPtr&, const std::string&);
virtual FileDescPtr describe(const Ice::Current&) const;
virtual FileDescSeq getContents(const Ice::Current&) const;
+ virtual Ice::Long getTotal(const Ice::ByteSeq&, const Ice::Current&) const;
};
class RegularI : virtual public Regular,
virtual public FileI
{
public:
-
- RegularI(const Ice::ObjectAdapterPtr&);
+
+ RegularI(const Ice::ObjectAdapterPtr&, const std::string&);
virtual FileDescPtr describe(const Ice::Current&) const;
virtual Ice::Int getBZ2Size(const Ice::Current&) const;
diff --git a/cpp/src/IcePatch/Makefile b/cpp/src/IcePatch/Makefile
index b3ba9add2b4..4cbb3c7a15b 100644
--- a/cpp/src/IcePatch/Makefile
+++ b/cpp/src/IcePatch/Makefile
@@ -19,25 +19,29 @@ SONAME = $(call mksoname,IcePatch,$(SOVERSION))
LIBNAME = $(call mklibname,IcePatch)
CLIENT = $(top_srcdir)/bin/icepatchclient
+CALC = $(top_srcdir)/bin/icepatchcalc
SERVER = $(top_srcdir)/bin/icepatchserver
TARGETS = $(libdir)/$(LIBFILENAME) $(libdir)/$(SONAME) $(libdir)/$(LIBNAME) \
- $(CLIENT) $(SERVER)
+ $(CLIENT) $(CALC) $(SERVER)
OBJS = IcePatch.o \
FileDescFactory.o \
Util.o \
ClientUtil.o
-COBJS = Client.o
+CLIENT_OBJS = Client.o
-SOBJS = Server.o \
+CALC_OBJS = Calc.o
+
+SERVER_OBJS = Server.o \
IcePatchI.o \
FileLocator.o
SRCS = $(OBJS:.o=.cpp) \
- $(COBJS:.o=.cpp) \
- $(SOBJS:.o=.cpp)
+ $(CLIENT_OBJS:.o=.cpp) \
+ $(CALC_OBJS:.o=.cpp) \
+ $(SERVER_OBJS:.o=.cpp)
SLICE_SRCS = $(SDIR)/IcePatch.ice
@@ -63,13 +67,17 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
rm -f $@
ln -s $(SONAME) $@
-$(CLIENT): $(COBJS) $(libdir)/$(LIBNAME)
+$(CLIENT): $(CLIENT_OBJS) $(libdir)/$(LIBNAME)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(CLIENT_OBJS) -lIcePatch -lGlacier -lIceSSL $(LIBS) $(OPENSSL_LIBS)
+
+$(CALC): $(CALC_OBJS) $(libdir)/$(LIBNAME)
rm -f $@
- $(CXX) $(LDFLAGS) -o $@ $(COBJS) -lIcePatch -lGlacier -lIceSSL $(LIBS) $(OPENSSL_LIBS)
+ $(CXX) $(LDFLAGS) -o $@ $(CALC_OBJS) -lIcePatch $(LIBS)
-$(SERVER): $(SOBJS) $(libdir)/$(LIBNAME)
+$(SERVER): $(SERVER_OBJS) $(libdir)/$(LIBNAME)
rm -f $@
- $(CXX) $(LDFLAGS) -o $@ $(SOBJS) -lIcePatch $(LIBS) $(OPENSSL_LIBS)
+ $(CXX) $(LDFLAGS) -o $@ $(SERVER_OBJS) -lIcePatch $(LIBS)
install:: all
$(INSTALL_LIBRARY) $(libdir)/$(LIBFILENAME) $(install_libdir)
@@ -78,6 +86,7 @@ install:: all
rm -f $(install_libdir)/$(LIBNAME)
ln -s $(SONAME) $(install_libdir)/$(LIBNAME)
$(INSTALL_PROGRAM) $(CLIENT) $(install_bindir)
+ $(INSTALL_PROGRAM) $(CALC) $(install_bindir)
$(INSTALL_PROGRAM) $(SERVER) $(install_bindir)
include .depend
diff --git a/cpp/src/IcePatch/Server.cpp b/cpp/src/IcePatch/Server.cpp
index ef4def210db..bfee1efefda 100644
--- a/cpp/src/IcePatch/Server.cpp
+++ b/cpp/src/IcePatch/Server.cpp
@@ -13,9 +13,10 @@
// **********************************************************************
#include <IceUtil/IceUtil.h>
-#include <Ice/Application.h>
+#include <Ice/Service.h>
#include <IcePatch/FileLocator.h>
#include <IcePatch/IcePatchI.h>
+#include <IcePatch/Util.h>
using namespace std;
using namespace Ice;
@@ -24,41 +25,57 @@ using namespace IcePatch;
namespace IcePatch
{
-class Server : public Application
+class IcePatchService : public Service
{
public:
- void usage();
- virtual int run(int, char*[]);
-};
+ IcePatchService();
-class Updater : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
+ void usage(const string&);
- Updater(const ObjectAdapterPtr&, const IceUtil::Time&);
+protected:
- virtual void run();
- void destroy();
+ virtual bool start(int, char*[]);
+ virtual bool stop();
-protected:
+private:
- const ObjectAdapterPtr _adapter;
- const LoggerPtr _logger;
- const IceUtil::Time _updatePeriod;
- bool _destroy;
+ void runUpdater();
+ void cleanup();
+ void cleanupRec(const FileDescSeq&);
- void cleanup(const FileDescSeq&);
-};
+ IceUtil::Monitor<IceUtil::Mutex> _monitor;
+ IceUtil::ThreadPtr _thread;
+ bool _shutdown;
+ ObjectAdapterPtr _adapter;
+ IceUtil::Time _updatePeriod;
+
+ class UpdaterThread : public IceUtil::Thread
+ {
+ public:
+
+ UpdaterThread(IcePatchService*);
-typedef IceUtil::Handle<Updater> UpdaterPtr;
+ virtual void run();
+ protected:
+
+ IcePatchService* _service;
+ };
+ friend class UpdaterThread;
};
+}
+
+IcePatch::IcePatchService::IcePatchService() :
+ _shutdown(false)
+{
+}
+
void
-IcePatch::Server::usage()
+IcePatch::IcePatchService::usage(const string& name)
{
- cerr << "Usage: " << appName() << " [options]\n";
+ cerr << "Usage: " << name << " [options]\n";
cerr <<
"Options:\n"
"-h, --help Show this message.\n"
@@ -66,115 +83,112 @@ IcePatch::Server::usage()
;
}
-int
-IcePatch::Server::run(int argc, char* argv[])
+bool
+IcePatch::IcePatchService::start(int argc, char* argv[])
{
for(int i = 1; i < argc; ++i)
{
if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
- usage();
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return false;
}
else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ trace(ICE_STRING_VERSION);
+ return false;
}
else
{
- cerr << appName() << ": unknown option `" << argv[i] << "'" << endl;
- usage();
- return EXIT_FAILURE;
+ error(string(argv[0]) + ": unknown option `" + string(argv[i]) + "'");
+ usage(argv[0]);
+ return false;
}
}
-
+
PropertiesPtr properties = communicator()->getProperties();
-
+
//
// Get the IcePatch endpoints.
//
const char* endpointsProperty = "IcePatch.Endpoints";
if(properties->getProperty(endpointsProperty).empty())
{
- cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ error(string(argv[0]) + ": property `" + endpointsProperty + "' is not set");
+ return false;
}
-
+
//
// Create and initialize the object adapter and the file locator.
//
- ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IcePatch");
- ServantLocatorPtr fileLocator = new FileLocator(adapter);
- adapter->addServantLocator(fileLocator, "IcePatch");
+ string dataDir = properties->getProperty("IcePatch.Directory");
+ if(dataDir.empty())
+ {
+#ifdef _WIN32
+ char cwd[_MAX_PATH];
+ _getcwd(cwd, _MAX_PATH);
+#else
+ char cwd[PATH_MAX];
+ getcwd(cwd, PATH_MAX);
+#endif
+ dataDir = cwd;
+ }
+ _adapter = communicator()->createObjectAdapter("IcePatch");
+ ServantLocatorPtr fileLocator = new FileLocator(_adapter, dataDir);
+ _adapter->addServantLocator(fileLocator, "IcePatch");
//
- // Start the updater if an update period is set.
+ // Start the updater thread if an update period is set.
//
- UpdaterPtr updater;
- IceUtil::Time updatePeriod = IceUtil::Time::seconds(
- properties->getPropertyAsIntWithDefault("IcePatch.UpdatePeriod", 60));
- if(updatePeriod != IceUtil::Time())
+ _updatePeriod = IceUtil::Time::seconds(properties->getPropertyAsIntWithDefault("IcePatch.UpdatePeriod", 60));
+ if(_updatePeriod != IceUtil::Time())
{
- if(updatePeriod < IceUtil::Time::seconds(1))
+ if(_updatePeriod < IceUtil::Time::seconds(1))
{
- updatePeriod = IceUtil::Time::seconds(1);
+ _updatePeriod = IceUtil::Time::seconds(1);
}
- updater = new Updater(adapter, updatePeriod);
- updater->start();
+ _thread = new UpdaterThread(this);
+ _thread->start();
}
//
// Everything ok, let's go.
//
- shutdownOnInterrupt();
- adapter->activate();
- communicator()->waitForShutdown();
- ignoreInterrupt();
+ _adapter->activate();
- //
- // Destroy and join with the updater, if there is one.
- //
- if(updater)
- {
- updater->destroy();
- updater->getThreadControl().join();
- }
-
- return EXIT_SUCCESS;
+ return true;
}
-IcePatch::Updater::Updater(const ObjectAdapterPtr& adapter, const IceUtil::Time& updatePeriod) :
- _adapter(adapter),
- _logger(_adapter->getCommunicator()->getLogger()),
- _updatePeriod(updatePeriod),
- _destroy(false)
+bool
+IcePatch::IcePatchService::stop()
{
+ if(_thread)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
+ _shutdown = true;
+ _monitor.notify();
+ _thread->getThreadControl().join();
+ _thread = 0;
+ }
+ return true;
}
void
-IcePatch::Updater::run()
+IcePatch::IcePatchService::runUpdater()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
- while(!_destroy && !Application::interrupted())
+ while(!_shutdown)
{
try
{
- Identity ident;
- ident.category = "IcePatch";
- ident.name = ".";
- ObjectPrx topObj = _adapter->createProxy(ident);
- FilePrx top = FilePrx::checkedCast(topObj);
- assert(top);
- DirectoryDescPtr topDesc = DirectoryDescPtr::dynamicCast(top->describe());
- assert(topDesc);
- cleanup(topDesc->dir->getContents());
+ cleanup();
}
catch(const FileAccessException& ex)
{
- Error out(_logger);
- out << "exception during update:\n" << ex << ":\n" << ex.reason;
+ ostringstream ostr;
+ ostr << "exception during update:\n" << ex << ":\n" << ex.reason;
+ error(ostr.str());
}
catch(const BusyException&)
{
@@ -185,39 +199,46 @@ IcePatch::Updater::run()
catch(const Exception& ex)
{
//
- // Log other exceptions only if we are not destroyed and
- // if we were not interrupted.
+ // Log other exceptions only if we are not destroyed.
//
- if(!_destroy && !Application::interrupted())
+ if(!_shutdown)
{
- Error out(_logger);
- out << "exception during update:\n" << ex;
+ ostringstream ostr;
+ ostr << "exception during update:\n" << ex;
+ error(ostr.str());
}
}
- if(_destroy || Application::interrupted())
+ if(_shutdown)
{
break;
}
- timedWait(_updatePeriod);
+ _monitor.timedWait(_updatePeriod);
}
}
void
-IcePatch::Updater::destroy()
+IcePatch::IcePatchService::cleanup()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _destroy = true;
- notify();
+ Identity ident;
+ ident.category = "IcePatch";
+ ident.name = ".";
+ ObjectPrx topObj = _adapter->createProxy(ident);
+ FilePrx top = FilePrx::checkedCast(topObj);
+ assert(top);
+ DirectoryDescPtr topDesc = DirectoryDescPtr::dynamicCast(top->describe());
+ assert(topDesc);
+ cleanupRec(topDesc->dir->getContents());
+ topDesc->dir->describe(); // Refresh the top-level MD5 file.
}
void
-IcePatch::Updater::cleanup(const FileDescSeq& fileDescSeq)
+IcePatch::IcePatchService::cleanupRec(const FileDescSeq& fileDescSeq)
{
for(FileDescSeq::const_iterator p = fileDescSeq.begin(); p != fileDescSeq.end(); ++p)
{
- if(_destroy)
+ if(_shutdown)
{
return;
}
@@ -229,7 +250,7 @@ IcePatch::Updater::cleanup(const FileDescSeq& fileDescSeq)
// Force MD5 files to be created and orphaned files to be
// removed. Then recurse into subdirectories.
//
- cleanup(directoryDesc->dir->getContents());
+ cleanupRec(directoryDesc->dir->getContents());
//
// Call describe(), because BZ2 and MD5 files in the
@@ -251,9 +272,20 @@ IcePatch::Updater::cleanup(const FileDescSeq& fileDescSeq)
}
}
+IcePatch::IcePatchService::UpdaterThread::UpdaterThread(IcePatchService* service) :
+ _service(service)
+{
+}
+
+void
+IcePatch::IcePatchService::UpdaterThread::run()
+{
+ _service->runUpdater();
+}
+
int
main(int argc, char* argv[])
{
- Server app;
- return app.main(argc, argv);
+ IcePatchService svc;
+ return svc.main(argc, argv);
}
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp
index 1ee749b8e0d..3efc452a0cc 100644
--- a/cpp/src/IcePatch/Util.cpp
+++ b/cpp/src/IcePatch/Util.cpp
@@ -189,7 +189,8 @@ bool
IcePatch::ignoreSuffix(const string& path)
{
string suffix = getSuffix(path);
- return suffix == "md5" || suffix == "md5temp" || suffix == "bz2" || suffix == "bz2temp";
+ return suffix == "md5" || suffix == "md5temp" || suffix == "bz2" || suffix == "bz2temp" ||
+ suffix == "tot" || suffix == "tottemp";
}
string
@@ -568,7 +569,8 @@ IcePatch::calcMD5(const string& path, const LoggerPtr& logger)
// We must take the filename into account, so that
// renaming a file will change the summary MD5.
//
- copy(plainPath.begin(), plainPath.end(), back_inserter(bytes));
+ string plainFile = plainPath.substr(plainPath.rfind('/') + 1);
+ copy(plainFile.begin(), plainFile.end(), back_inserter(bytes));
ByteSeq subBytesMD5 = getMD5(plainPath);
copy(subBytesMD5.begin(), subBytesMD5.end(), back_inserter(bytes));
@@ -716,7 +718,7 @@ IcePatch::getBZ2(const string& path, Int pos, Int num)
if(num > 1024 * 1024)
{
FileAccessException ex;
- ex.reason = "maxium data segment size exceeded";
+ ex.reason = "maximum data segment size exceeded";
throw ex;
}
@@ -871,3 +873,149 @@ IcePatch::createBZ2(const string& path, const Ice::LoggerPtr& logger)
out << "created BZ2 file for `" << path << "'";
}
}
+
+IcePatch::TotalMap
+IcePatch::getTotalMap(const CommunicatorPtr& communicator, const string& path)
+{
+ TotalMap result;
+
+ string pathTot = path + ".tot";
+
+ FileInfo infoTot = getFileInfo(pathTot, false);
+ if(infoTot.type == FileTypeNotExist)
+ {
+ return result;
+ }
+
+ ifstream fileTot(pathTot.c_str(), ios::binary);
+ if(!fileTot)
+ {
+ FileAccessException ex;
+ ex.reason = "cannot open `" + pathTot + "' for reading: " + strerror(errno);
+ throw ex;
+ }
+
+ IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
+ IceInternal::BasicStream is(instance.get());
+ is.b.resize(static_cast<ByteSeq::size_type>(infoTot.size));
+ fileTot.read(reinterpret_cast<char*>(&is.b[0]), is.b.size());
+
+ if(static_cast<vector<Byte>::size_type>(fileTot.gcount()) < is.b.size())
+ {
+ FileAccessException ex;
+ ex.reason = "could not read all bytes from `" + pathTot + "'";
+ throw ex;
+ }
+
+ fileTot.close();
+
+ is.i = is.b.begin();
+ try
+ {
+ Int i, sz;
+ is.readSize(sz);
+ for(i = 0; i < sz; ++i)
+ {
+ ByteSeq key;
+ Long value;
+ is.read(key);
+ is.read(value);
+ result.insert(TotalMap::value_type(key, value));
+ }
+ }
+ catch(const Ice::MarshalException&)
+ {
+ FileAccessException ex;
+ ex.reason = "could not unmarshal contents of `" + pathTot + "'";
+ throw ex;
+ }
+
+ return result;
+}
+
+void
+IcePatch::putTotalMap(const CommunicatorPtr& communicator, const string& path, const TotalMap& map)
+{
+ IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
+ IceInternal::BasicStream os(instance.get());
+
+ //
+ // Marshal the map.
+ //
+ os.writeSize(static_cast<Int>(map.size()));
+ for(TotalMap::const_iterator p = map.begin(); p != map.end(); ++p)
+ {
+ os.write(p->first);
+ os.write(p->second);
+ }
+
+ //
+ // Save the map to a temporary file.
+ //
+ string pathTotTemp = path + ".tottemp";
+ ofstream fileTot(pathTotTemp.c_str(), ios::binary);
+ if(!fileTot)
+ {
+ FileAccessException ex;
+ ex.reason = "cannot open `" + pathTotTemp + "' for writing: " + strerror(errno);
+ throw ex;
+ }
+
+ os.i = os.b.begin();
+ size_t sz = os.b.end() - os.i;
+ fileTot.write(reinterpret_cast<const char*>(&os.b[0]), sz);
+ if(!fileTot)
+ {
+ FileAccessException ex;
+ ex.reason = "cannot write `" + pathTotTemp + "': " + strerror(errno);
+ throw ex;
+ }
+
+ fileTot.close();
+
+ //
+ // Rename the temporary file to the final file. This is
+ // done so that there can be no partial files after an
+ // abortive application termination.
+ //
+ string pathTot = path + ".tot";
+ ::remove(pathTot.c_str());
+ if(::rename(pathTotTemp.c_str(), pathTot.c_str()) == -1)
+ {
+ FileAccessException ex;
+ ex.reason = "cannot rename `" + pathTotTemp + "' to `" + pathTot + "': " + strerror(errno);
+ throw ex;
+ }
+}
+
+#ifdef _WIN32
+
+bool
+IcePatch::CICompare::operator()(const string& s1, const string& s2) const
+{
+ string::const_iterator p1 = s1.begin();
+ string::const_iterator p2 = s2.begin();
+ while(p1 != s1.end() && p2 != s2.end() && ::tolower(*p1) == ::tolower(*p2))
+ {
+ ++p1;
+ ++p2;
+ }
+ if(p1 == s1.end() && p2 == s2.end())
+ {
+ return false;
+ }
+ else if(p1 == s1.end())
+ {
+ return true;
+ }
+ else if(p2 == s2.end())
+ {
+ return false;
+ }
+ else
+ {
+ return ::tolower(*p1) < ::tolower(*p2);
+ }
+}
+
+#endif
diff --git a/cpp/src/IcePatch/icepatchcalc.dsp b/cpp/src/IcePatch/icepatchcalc.dsp
new file mode 100644
index 00000000000..0004609e182
--- /dev/null
+++ b/cpp/src/IcePatch/icepatchcalc.dsp
@@ -0,0 +1,118 @@
+# Microsoft Developer Studio Project File - Name="IcePatchCalc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=IcePatchCalc - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "IcePatchCalc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "IcePatchCalc.mak" CFG="IcePatchCalc - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "IcePatchCalc - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "IcePatchCalc - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "IcePatchCalc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I ".." /I "../../include" /I "dummyinclude" /D "NDEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 setargv.obj /nologo /subsystem:console /machine:I386 /out:"Release/icepatchcalc.exe"
+# SUBTRACT LINK32 /debug /nodefaultlib
+# Begin Special Build Tool
+OutDir=.\Release
+TargetName=icepatchcalc
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy $(OutDir)\$(TargetName).exe ..\..\bin
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "IcePatchCalc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I ".." /I "../../include" /I "dummyinclude" /D "_DEBUG" /D "_CONSOLE" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"Debug/icepatchcalc.exe" /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+# Begin Special Build Tool
+OutDir=.\Debug
+TargetName=icepatchcalc
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy $(OutDir)\$(TargetName).exe ..\..\bin
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "IcePatchCalc - Win32 Release"
+# Name "IcePatchCalc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Calc.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project