Opened 13 years ago
Last modified 13 years ago
#830 closed defect
Disposable::GetHashCode() throws overflow exception on Int64 — at Version 1
Reported by: | gregboone | Owned by: | gregboone |
---|---|---|---|
Priority: | major | Milestone: | 3.7.0 |
Component: | FDO API | Version: | 3.7.0 |
Severity: | 2 | Keywords: | GetHashCode |
Cc: | External ID: |
Description (last modified by )
Calling the managed interface function "Disposable::GetHashCode()" can result in an overflow exception if the internal pointer is larger than Int32.
svn diff Disposable.cpp
System::Int32 NAMESPACE_OSGEO_RUNTIME::Disposable::GetHashCode() { - return m_imp.ToInt32(); + // Solution for overflow issue taken from: + // http://msdn.microsoft.com/en-us/library/system.object.gethashcode(v=vs.71).aspx + // + System::Int64 i64 = m_imp.ToInt64(); + return ((System::Int32)(i64) ^ (System::Int32)(i64 >> 32)); }
Note:
See TracTickets
for help on using tickets.