diff options
author | Marc Laukien <marc@zeroc.com> | 2004-11-30 19:04:40 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-11-30 19:04:40 +0000 |
commit | 1cb9811b59e09a7697899bba8271cc9d49e07d6f (patch) | |
tree | cc22a1d879cde527fdd7e14d9583f1cd151a924e /cpp/include/IcePatch2/Util.h | |
parent | Checked TODO item -- no change necessary. (diff) | |
download | ice-1cb9811b59e09a7697899bba8271cc9d49e07d6f.tar.bz2 ice-1cb9811b59e09a7697899bba8271cc9d49e07d6f.tar.xz ice-1cb9811b59e09a7697899bba8271cc9d49e07d6f.zip |
IcePatch2
Diffstat (limited to 'cpp/include/IcePatch2/Util.h')
-rw-r--r-- | cpp/include/IcePatch2/Util.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/cpp/include/IcePatch2/Util.h b/cpp/include/IcePatch2/Util.h index 6a2c0c5d4fb..3d0c500155a 100644 --- a/cpp/include/IcePatch2/Util.h +++ b/cpp/include/IcePatch2/Util.h @@ -44,12 +44,25 @@ struct FileInfoEqual: public std::binary_function<const FileInfo&, const FileInf bool operator()(const FileInfo& lhs, const FileInfo& rhs) { - return lhs.path == rhs.path && lhs.checksum < rhs.checksum; + if(lhs.path != rhs.path) + { + return false; + } // - // We don't take the size int account, as it might not be set - // if no compressed file is available. + // For the size portion of the comparison, we only distinquish + // between file (size >= 0) and directory (size == -1). We do + // not take the actual size into account, as it might be set + // to 0 if no compressed file is available. // + Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size; + Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size; + if(lsz != rsz) + { + return false; + } + + return lhs.checksum == rhs.checksum; } }; @@ -67,12 +80,24 @@ struct FileInfoLess: public std::binary_function<const FileInfo&, const FileInfo return false; } - return lhs.checksum < rhs.checksum; - // - // We don't take the size int account, as it might not be set - // if no compressed file is available. + // For the size portion of the comparison, we only distinquish + // between file (size >= 0) and directory (size == -1). We do + // not take the actual size into account, as it might be set + // to 0 if no compressed file is available. // + Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size; + Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size; + if(lsz < rsz) + { + return true; + } + else if(rsz < lsz) + { + return false; + } + + return lhs.checksum < rhs.checksum; } }; |