#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
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 ), \
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; \
} \
\
\
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 ); \
\
CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \
this, (_wxHashTable_NodeBase**)m_table, \
- (BucketFromNode)&GetBucketForNode,\
+ (BucketFromNode)GetBucketForNode,\
(ProcessNode)&DummyProcessNode ); \
free(srcTable); \
} \
CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\
(_wxHashTableBase2*)this, \
(_wxHashTable_NodeBase**)m_table, \
- (BucketFromNode)&GetBucketForNode, \
- (ProcessNode)&CopyNode ); \
+ (BucketFromNode)GetBucketForNode, \
+ (ProcessNode)CopyNode ); \
} \
};
// 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; }
};