summaryrefslogtreecommitdiff
path: root/cpp/src/Ice
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice')
-rw-r--r--cpp/src/Ice/HashUtil.h7
-rw-r--r--cpp/src/Ice/Makefile.mak1
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.cpp3
-rw-r--r--cpp/src/Ice/Reference.cpp12
-rw-r--r--cpp/src/Ice/TcpEndpointI.cpp7
-rw-r--r--cpp/src/Ice/UdpEndpointI.cpp7
-rw-r--r--cpp/src/Ice/winrt/StreamEndpointI.cpp7
7 files changed, 33 insertions, 11 deletions
diff --git a/cpp/src/Ice/HashUtil.h b/cpp/src/Ice/HashUtil.h
index 7b6c7f6a27b..d23ee90ff0c 100644
--- a/cpp/src/Ice/HashUtil.h
+++ b/cpp/src/Ice/HashUtil.h
@@ -15,13 +15,13 @@ namespace IceInternal
inline void
hashAdd(Ice::Int& hashCode, Ice::Int value)
{
- hashCode = hashCode * 5 + value;
+ hashCode = ((hashCode << 5) + hashCode) ^ (2654435761u * value);
}
inline void
hashAdd(Ice::Int& hashCode, bool value)
{
- hashCode = hashCode * 5 + static_cast<Ice::Int>(value);
+ hashCode = ((hashCode << 5) + hashCode) ^ (value ? 1 : 0);
}
inline void
@@ -29,7 +29,7 @@ hashAdd(Ice::Int& hashCode, const std::string& value)
{
for(std::string::const_iterator p = value.begin(); p != value.end(); ++p)
{
- hashCode = 5 * hashCode + *p;
+ hashCode = ((hashCode << 5) + hashCode) ^ *p;
}
}
@@ -52,5 +52,4 @@ hashAdd(Ice::Int& hashCode, const std::map<K, V>& map)
}
}
-
}
diff --git a/cpp/src/Ice/Makefile.mak b/cpp/src/Ice/Makefile.mak
index 522da39075e..b5378cba7ef 100644
--- a/cpp/src/Ice/Makefile.mak
+++ b/cpp/src/Ice/Makefile.mak
@@ -124,7 +124,6 @@ CPPFLAGS = $(CPPFLAGS) -DCOMPSUFFIX=\"$(COMPSUFFIX)\"
SLICE2CPPFLAGS = --ice --include-dir Ice --dll-export ICE_API $(SLICE2CPPFLAGS)
LINKWITH = $(BASELIBS) $(BZIP2_LIBS) $(ICE_OS_LIBS) ws2_32.lib Iphlpapi.lib
-
PDBFLAGS = /pdb:$(DLLNAME:.dll=.pdb)
LD_DLLFLAGS = $(LD_DLLFLAGS) /entry:"ice_DLL_Main"
RES_FILE = Ice.res
diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp
index a3ed87efd85..80e3146a327 100644
--- a/cpp/src/Ice/OpaqueEndpointI.cpp
+++ b/cpp/src/Ice/OpaqueEndpointI.cpp
@@ -433,7 +433,8 @@ IceInternal::OpaqueEndpointI::operator<(const LocalObject& r) const
Ice::Int
IceInternal::OpaqueEndpointI::hashInit() const
{
- Ice::Int h = _type;
+ Ice::Int h = 5381;
+ hashAdd(h, _type);
hashAdd(h, _rawEncoding.major);
hashAdd(h, _rawEncoding.minor);
hashAdd(h, _rawBytes);
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 3ec8385c214..0b8a6eaff7b 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -483,12 +483,20 @@ IceInternal::Reference::Reference(const Reference& r) :
int
IceInternal::Reference::hashInit() const
{
- Int h = static_cast<Int>(_mode);
+ Int h = 5381;
+ hashAdd(h, static_cast<Int>(_mode));
+ hashAdd(h, _secure);
hashAdd(h, _identity.name);
hashAdd(h, _identity.category);
hashAdd(h, _context->getValue());
hashAdd(h, _facet);
- hashAdd(h, _secure);
+ hashAdd(h, _overrideCompress);
+ if(_overrideCompress)
+ {
+ hashAdd(h, _compress);
+ }
+ hashAdd(h, _encoding.major);
+ hashAdd(h, _encoding.minor);
return h;
}
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp
index e38885976fb..9c64b22057b 100644
--- a/cpp/src/Ice/TcpEndpointI.cpp
+++ b/cpp/src/Ice/TcpEndpointI.cpp
@@ -547,10 +547,15 @@ IceInternal::TcpEndpointI::operator<(const LocalObject& r) const
Ice::Int
IceInternal::TcpEndpointI::hashInit() const
{
- Ice::Int h = 0;
+ Ice::Int h = 5381;
+ hashAdd(h, TCPEndpointType);
hashAdd(h, _host);
hashAdd(h, _port);
hashAdd(h, _timeout);
+ hashAdd(h, _protocol.major);
+ hashAdd(h, _protocol.minor);
+ hashAdd(h, _encoding.major);
+ hashAdd(h, _encoding.minor);
hashAdd(h, _connectionId);
hashAdd(h, _compress);
return h;
diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp
index f8dacf01d7a..db5f1a495b7 100644
--- a/cpp/src/Ice/UdpEndpointI.cpp
+++ b/cpp/src/Ice/UdpEndpointI.cpp
@@ -632,12 +632,17 @@ IceInternal::UdpEndpointI::operator<(const LocalObject& r) const
Ice::Int
IceInternal::UdpEndpointI::hashInit() const
{
- Ice::Int h = 0;
+ Ice::Int h = 5381;
+ hashAdd(h, UDPEndpointType);
hashAdd(h, _host);
hashAdd(h, _port);
hashAdd(h, _mcastInterface);
hashAdd(h, _mcastTtl);
hashAdd(h, _connect);
+ hashAdd(h, _protocol.major);
+ hashAdd(h, _protocol.minor);
+ hashAdd(h, _encoding.major);
+ hashAdd(h, _encoding.minor);
hashAdd(h, _connectionId);
hashAdd(h, _compress);
return h;
diff --git a/cpp/src/Ice/winrt/StreamEndpointI.cpp b/cpp/src/Ice/winrt/StreamEndpointI.cpp
index 1f1c030f84e..d048945f0a0 100644
--- a/cpp/src/Ice/winrt/StreamEndpointI.cpp
+++ b/cpp/src/Ice/winrt/StreamEndpointI.cpp
@@ -587,10 +587,15 @@ IceInternal::StreamEndpointI::operator<(const LocalObject& r) const
Ice::Int
IceInternal::StreamEndpointI::hashInit() const
{
- Ice::Int h = 0;
+ Ice::Int h = 5381;
+ hashAdd(h, _type);
hashAdd(h, _host);
hashAdd(h, _port);
hashAdd(h, _timeout);
+ hashAdd(h, _protocol.major);
+ hashAdd(h, _protocol.minor);
+ hashAdd(h, _encoding.major);
+ hashAdd(h, _encoding.minor);
hashAdd(h, _connectionId);
hashAdd(h, _compress);
return h;