[fdo-trac] #830: Disposable::GetHashCode() throws overflow
exception on Int64
FDO
trac_fdo at osgeo.org
Tue May 15 21:28:18 EDT 2012
#830: Disposable::GetHashCode() throws overflow exception on Int64
-------------------------+--------------------------------------------------
Reporter: gregboone | Owner: gregboone
Type: defect | Status: new
Priority: major | Milestone: 3.7.0
Component: FDO API | Version: 3.7.0
Severity: 2 | Keywords: GetHashCode
External_id: |
-------------------------+--------------------------------------------------
Description changed by gregboone:
Old description:
> Calling the managed interface function "Disposable::GetHashCode()" can
> result in an overflow exception if the internal pointer is larger than
> Int32.
>
> svn diff ...\Fdo\Managed\Src\OSGeo\Runtime\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));
> }
New description:
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));
}
}}}
--
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/830#comment:1>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list