diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-05-04 19:27:48 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-05-04 19:27:48 +0000 |
commit | 356f03d7498128e46a1207c07ce3f339060e19b7 (patch) | |
tree | 5263ce4e5e5c72e12027c15182947d638068f5f3 /cpp/src/IcePatch/Client.cpp | |
parent | Fixed property for compression: doc said the name is "Compression", but it (diff) | |
download | ice-356f03d7498128e46a1207c07ce3f339060e19b7.tar.bz2 ice-356f03d7498128e46a1207c07ce3f339060e19b7.tar.xz ice-356f03d7498128e46a1207c07ce3f339060e19b7.zip |
merge with e3_2003
Diffstat (limited to 'cpp/src/IcePatch/Client.cpp')
-rw-r--r-- | cpp/src/IcePatch/Client.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp index 19fcb24763b..2c80fbdba5b 100644 --- a/cpp/src/IcePatch/Client.cpp +++ b/cpp/src/IcePatch/Client.cpp @@ -371,10 +371,56 @@ public: } }; +#ifdef _WIN32 + +// +// Function object to do case-insensitive string comparison. +// +class CICompare : public std::binary_function<std::string, std::string, bool> +{ +public: + + 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); + } + } +}; + +typedef set<string, CICompare> OrphanedSet; + +#else + +typedef set<string> OrphanedSet; + +#endif + void IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) const { - set<string> orphaned; + OrphanedSet orphaned; + if(_remove) { StringSeq fullDirectoryListing = readDirectory(identityToPath(dirDesc->dir->ice_getIdentity())); @@ -527,7 +573,7 @@ IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) c } } - for(set<string>::const_iterator p = orphaned.begin(); p != orphaned.end(); ++p) + for(OrphanedSet::const_iterator p = orphaned.begin(); p != orphaned.end(); ++p) { cout << indent << "+-" << pathToName(*p) << ": removing orphaned file" << endl; removeRecursive(*p); |