X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d86939c4c948c98d9f840e728c8c1ae2a99e1e4f..1338c59a025505bc066be220fe56e898a72b3ad3:/include/wx/hashmap.h?ds=inline diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index b17e283841..5bd69cea77 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -18,12 +18,18 @@ #include "wx/string.h" +#include // for ptrdiff_t + // private struct WXDLLEXPORT _wxHashTable_NodeBase { _wxHashTable_NodeBase() : m_nxt(0) {} _wxHashTable_NodeBase* m_nxt; + +// Cannot do this: +// DECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase) +// without rewriting the macros, which require a public copy constructor. }; // private @@ -175,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 ), \ @@ -248,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; \ } \ \ @@ -320,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 ); \ @@ -328,7 +334,7 @@ protected: \ \ CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \ this, (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)&GetBucketForNode,\ + (BucketFromNode)GetBucketForNode,\ (ProcessNode)&DummyProcessNode ); \ free(srcTable); \ } \ @@ -340,8 +346,8 @@ protected: \ CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\ (_wxHashTableBase2*)this, \ (_wxHashTable_NodeBase**)m_table, \ - (BucketFromNode)&GetBucketForNode, \ - (ProcessNode)&CopyNode ); \ + (BucketFromNode)GetBucketForNode, \ + (ProcessNode)CopyNode ); \ } \ }; @@ -437,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; } };