Make wxListCtrl sort function take wxIntPtr, not long, arguments.
As the arguments to the sort function contain the client data associated with the items, they may be pointers and hence of greater size than long in Win64 builds. Use wxIntPtr instead of long everywhere to fix this. Notice that this doesn't break compatibility for 32 bit code where long can still be used as it is the same as wxIntPtr there after the previous commit. Closes #4309. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// type of compare function for wxListCtrl sort operation
|
// type of compare function for wxListCtrl sort operation
|
||||||
typedef
|
typedef
|
||||||
int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, wxIntPtr sortData);
|
int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxListCtrl constants
|
// wxListCtrl constants
|
||||||
|
@@ -953,7 +953,7 @@ public:
|
|||||||
using the specified @a fnSortCallBack function. This function must have the
|
using the specified @a fnSortCallBack function. This function must have the
|
||||||
following prototype:
|
following prototype:
|
||||||
@code
|
@code
|
||||||
int wxCALLBACK wxListCompareFunction(long item1, long item2, wxIntPtr sortData)
|
int wxCALLBACK wxListCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
It is called each time when the two items must be compared and should return 0
|
It is called each time when the two items must be compared and should return 0
|
||||||
|
@@ -70,7 +70,7 @@ const wxChar *SMALL_VIRTUAL_VIEW_ITEMS[][2] =
|
|||||||
static const int NUM_ICONS = 9;
|
static const int NUM_ICONS = 9;
|
||||||
|
|
||||||
int wxCALLBACK
|
int wxCALLBACK
|
||||||
MyCompareFunction(long item1, long item2, wxIntPtr WXUNUSED(sortData))
|
MyCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr WXUNUSED(sortData))
|
||||||
{
|
{
|
||||||
// inverse the order
|
// inverse the order
|
||||||
if (item1 < item2)
|
if (item1 < item2)
|
||||||
|
@@ -53,7 +53,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder)
|
int wxCALLBACK wxFileDataNameCompare( wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -71,7 +71,7 @@ int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder)
|
int wxCALLBACK wxFileDataSizeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -93,7 +93,7 @@ int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder)
|
int wxCALLBACK wxFileDataTypeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -115,7 +115,7 @@ int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxIntPtr sortOrder)
|
int wxCALLBACK wxFileDataTimeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
|
@@ -1821,8 +1821,8 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l
|
|||||||
wxMSWListItemData *data1 = (wxMSWListItemData *) lParam1;
|
wxMSWListItemData *data1 = (wxMSWListItemData *) lParam1;
|
||||||
wxMSWListItemData *data2 = (wxMSWListItemData *) lParam2;
|
wxMSWListItemData *data2 = (wxMSWListItemData *) lParam2;
|
||||||
|
|
||||||
long d1 = (data1 == NULL ? 0 : data1->lParam);
|
wxIntPtr d1 = (data1 == NULL ? 0 : data1->lParam);
|
||||||
long d2 = (data2 == NULL ? 0 : data2->lParam);
|
wxIntPtr d2 = (data2 == NULL ? 0 : data2->lParam);
|
||||||
|
|
||||||
return internalData->user_fn(d1, d2, internalData->data);
|
return internalData->user_fn(d1, d2, internalData->data);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user