]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/hashmap.h
Removed redundant wx<Control>NameStr declarations.
[wxWidgets.git] / include / wx / hashmap.h
index b17e283841289830f096e32dc0afd89a61f7bfc1..5bd69cea774c49a365a94b3459db7231f1e38557 100644 (file)
 
 #include "wx/string.h"
 
+#include <stddef.h>             // 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; }
 };