X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c1572053a4138106baee37f60c124fca256fa36..eee3624b111881520d7d58fe174ef563c62d8375:/include/wx/hashmap.h diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index 6142c84e84..5bd69cea77 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -18,6 +18,8 @@ #include "wx/string.h" +#include // for ptrdiff_t + // private struct WXDLLEXPORT _wxHashTable_NodeBase { @@ -179,7 +181,7 @@ public: \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ const key_equal& k_eq = key_equal(), \ const key_extractor& k_ex = key_extractor() ) \ - : m_tableBuckets( GetNextPrime( sz ) ), \ + : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ m_items( 0 ), \ m_hasher( hfun ), \ m_equals( k_eq ), \ @@ -252,7 +254,7 @@ public: \ delete *node; \ (*node) = temp; \ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ - ResizeTable( GetPreviousPrime( m_tableBuckets ) - 1 ); \ + ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ return 1; \ } \ \ @@ -324,7 +326,7 @@ protected: \ \ void ResizeTable( size_t newSize ) \ { \ - newSize = GetNextPrime( newSize ); \ + newSize = GetNextPrime( (unsigned long)newSize ); \ Node** srcTable = m_table; \ size_t srcBuckets = m_tableBuckets; \ m_table = (Node**)AllocTable( newSize ); \ @@ -441,7 +443,7 @@ public: // TODO: this might not work well on architectures with 64 bit pointers but // 32 bit longs, we should use % ULONG_MAX there - unsigned long operator()( const void* k ) const { return (unsigned long)k; } + unsigned long operator()( const void* k ) const { return (unsigned long)wxPtrToULong(k); } wxPointerHash& operator=(const wxPointerHash&) { return *this; } };