summaryrefslogtreecommitdiffstats
path: root/chrome/common/transport_dib.h
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 22:21:30 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 22:21:30 +0000
commit1731d2ee1d82c51f86078a5118948e66a857412d (patch)
treeab091e67e6b4c3b11666896df22575d378049360 /chrome/common/transport_dib.h
parent8fba5ee7c18595541d55d5af82c6670ce7ed6434 (diff)
downloadchromium_src-1731d2ee1d82c51f86078a5118948e66a857412d.zip
chromium_src-1731d2ee1d82c51f86078a5118948e66a857412d.tar.gz
chromium_src-1731d2ee1d82c51f86078a5118948e66a857412d.tar.bz2
For TransportDIB::HandleAndSequenceNumber, make operator<
be antisymmetric. The old implementation was flawed because both of the following comparisons were true: "{0, 1} < {1, 0}" and "{1, 0} < {0, 1}" On Windows, std::map<> doesn't like that, and complains -- rightly so. Review URL: http://codereview.chromium.org/93151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/transport_dib.h')
-rw-r--r--chrome/common/transport_dib.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/chrome/common/transport_dib.h b/chrome/common/transport_dib.h
index e20dd5c..33c0649 100644
--- a/chrome/common/transport_dib.h
+++ b/chrome/common/transport_dib.h
@@ -56,11 +56,10 @@ class TransportDIB {
}
bool operator< (const HandleAndSequenceNum& other) const {
- if (other.handle < handle)
- return true;
- if (other.sequence_num < sequence_num)
- return true;
- return false;
+ // Use the lexicographic order on the tuple <handle, sequence_num>.
+ if (other.handle != handle)
+ return other.handle < handle;
+ return other.sequence_num < sequence_num;
}
HANDLE handle;