1Index: src/aui/framemanager.cpp 2=================================================================== 3--- src/aui/framemanager.cpp (revisione 63679) 4+++ src/aui/framemanager.cpp (copia locale) 5@@ -973,7 +973,7 @@ 6 if (pinfo.name.empty() || already_exists) 7 { 8 pinfo.name.Printf(wxT("%08lx%08x%08x%08lx"), 9- ((unsigned long)pinfo.window) & 0xffffffff, 10+ wxPtrToUInt(pinfo.window) & 0xffffffff, 11 (unsigned int)time(NULL), 12 #ifdef __WXWINCE__ 13 (unsigned int)GetTickCount(), 14Index: src/common/utilscmn.cpp 15=================================================================== 16--- src/common/utilscmn.cpp (revisione 63679) 17+++ src/common/utilscmn.cpp (copia locale) 18@@ -822,7 +822,7 @@ 19 //hInstApp member is only valid if the function fails, in which case it 20 //receives one of the following error values, which are less than or 21 //equal to 32. 22- const int nResult = (int) sei.hInstApp; 23+ const int nResult = (INT_PTR) sei.hInstApp; 24 25 // Firefox returns file not found for some reason, so make an exception 26 // for it 27Index: src/msw/dcprint.cpp 28=================================================================== 29--- src/msw/dcprint.cpp (revisione 63679) 30+++ src/msw/dcprint.cpp (copia locale) 31@@ -319,7 +319,7 @@ 32 } 33 34 35- HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode(); 36+ HGLOBAL hDevMode = (HGLOBAL) data->GetDevMode(); 37 38 DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)::GlobalLock(hDevMode) : NULL; 39 40Index: src/msw/window.cpp 41=================================================================== 42--- src/msw/window.cpp (revisione 63679) 43+++ src/msw/window.cpp (copia locale) 44@@ -2596,8 +2596,8 @@ 45 // trace all messages - useful for the debugging 46 #ifdef __WXDEBUG__ 47 wxLogTrace(wxTraceMessages, 48- wxT("Processing %s(hWnd=%08lx, wParam=%8lx, lParam=%8lx)"), 49- wxGetMessageName(message), (long)hWnd, (long)wParam, lParam); 50+ wxT("Processing %s(hWnd=%p, wParam=%8lx, lParam=%8lx)"), 51+ wxGetMessageName(message), hWnd, (long)wParam, lParam); 52 #endif // __WXDEBUG__ 53 54 wxWindowMSW *wnd = wxFindWinFromHandle((WXHWND) hWnd); 55@@ -3449,7 +3455,7 @@ 56 #ifdef __WXDEBUG__ 57 if ( oldWin && (oldWin != win) ) 58 { 59- wxLogDebug(wxT("HWND %X already associated with another window (%s)"), 60- (int) hWnd, win->GetClassInfo()->GetClassName()); 61+ wxLogDebug(wxT("HWND %p already associated with another window (%s)"), 62+ hWnd, win->GetClassInfo()->GetClassName()); 63 } 64 else 65Index: src/msw/toplevel.cpp 66=================================================================== 67--- src/msw/toplevel.cpp (revisione 63679) 68+++ src/msw/toplevel.cpp (copia locale) 69@@ -1122,7 +1122,7 @@ 70 { 71 // restore focus to the child which was last focused unless we already 72 // have it 73- wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), (int) m_hWnd); 74+ wxLogTrace(_T("focus"), _T("wxTLW %p activated."), m_hWnd); 75 76 wxWindow *winFocus = FindFocus(); 77 if ( !winFocus || wxGetTopLevelParent(winFocus) != this ) 78@@ -1157,10 +1157,10 @@ 79 } 80 81 wxLogTrace(_T("focus"), 82- _T("wxTLW %08x deactivated, last focused: %08x."), 83- (int) m_hWnd, 84- (int) (m_winLastFocused ? GetHwndOf(m_winLastFocused) 85- : NULL)); 86+ _T("wxTLW %p deactivated, last focused: %p."), 87+ m_hWnd, 88+ (m_winLastFocused ? GetHwndOf(m_winLastFocused) 89+ : NULL)); 90 91 event.Skip(); 92 } 93Index: src/msw/menuitem.cpp 94=================================================================== 95--- src/msw/menuitem.cpp (revisione 63679) 96+++ src/msw/menuitem.cpp (copia locale) 97@@ -188,7 +188,7 @@ 98 // return the id for calling Win32 API functions 99 int wxMenuItem::GetRealId() const 100 { 101- return m_subMenu ? (int)m_subMenu->GetHMenu() : GetId(); 102+ return m_subMenu ? wxPtrToUInt(m_subMenu->GetHMenu()) : GetId(); 103 } 104 105 // get item state 106Index: src/msw/mdi.cpp 107=================================================================== 108--- src/msw/mdi.cpp (revisione 63679) 109+++ src/msw/mdi.cpp (copia locale) 110@@ -763,7 +763,7 @@ 111 wxWindowCreationHook hook(this); 112 113 m_hWnd = (WXHWND)::SendMessage(GetWinHwnd(parent->GetClientWindow()), 114- WM_MDICREATE, 0, (LONG)(LPSTR)&mcs); 115+ WM_MDICREATE, 0, (LPARAM)&mcs); 116 117 if ( !m_hWnd ) 118 { 119@@ -1433,14 +1433,14 @@ 120 { 121 success = true; 122 ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, 123- (UINT)subMenu, _("&Window")); 124+ (UINT_PTR)subMenu, _("&Window")); 125 break; 126 } 127 } 128 129 if ( !success ) 130 { 131- ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window")); 132+ ::AppendMenu(hmenu, MF_POPUP, (UINT_PTR)subMenu, _("&Window")); 133 } 134 } 135 136Index: src/msw/tooltip.cpp 137=================================================================== 138--- src/msw/tooltip.cpp (revisione 63679) 139+++ src/msw/tooltip.cpp (copia locale) 140@@ -106,7 +106,7 @@ 141 uFlags |= TTF_TRANSPARENT; 142 } 143 144- uId = (UINT)hwndOwner; 145+ uId = (UINT_PTR)hwndOwner; 146 } 147 }; 148 149Index: src/msw/menu.cpp 150=================================================================== 151--- src/msw/menu.cpp (revisione 63679) 152+++ src/msw/menu.cpp (copia locale) 153@@ -370,14 +370,14 @@ 154 155 // id is the numeric id for normal menu items and HMENU for submenus as 156 // required by ::AppendMenu() API 157- UINT id; 158+ UINT_PTR id; 159 wxMenu *submenu = pItem->GetSubMenu(); 160 if ( submenu != NULL ) { 161 wxASSERT_MSG( submenu->GetHMenu(), wxT("invalid submenu") ); 162 163 submenu->SetParent(this); 164 165- id = (UINT)submenu->GetHMenu(); 166+ id = (UINT_PTR)submenu->GetHMenu(); 167 168 flags |= MF_POPUP; 169 } 170@@ -963,7 +963,7 @@ 171 for ( i = 0, it = m_menus.begin(); i < count; i++, it++ ) 172 { 173 if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING, 174- (UINT)(*it)->GetHMenu(), 175+ (UINT_PTR)(*it)->GetHMenu(), 176 m_titles[i]) ) 177 { 178 wxLogLastError(wxT("AppendMenu")); 179@@ -1035,7 +1035,7 @@ 180 181 int mswpos = MSWPositionForWxMenu(GetMenu(pos),pos); 182 183- UINT id; 184+ UINT_PTR id; 185 UINT flagsOld = ::GetMenuState((HMENU)m_hMenu, mswpos, MF_BYPOSITION); 186 if ( flagsOld == 0xFFFFFFFF ) 187 { 188@@ -1048,7 +1048,7 @@ 189 { 190 // HIBYTE contains the number of items in the submenu in this case 191 flagsOld &= 0xff; 192- id = (UINT)::GetSubMenu((HMENU)m_hMenu, mswpos); 193+ id = (UINT_PTR)::GetSubMenu((HMENU)m_hMenu, mswpos); 194 } 195 else 196 { 197@@ -1124,7 +1124,7 @@ 198 199 if ( !::InsertMenu(GetHmenu(), (UINT)mswpos, 200 MF_BYPOSITION | MF_POPUP | MF_STRING, 201- (UINT)GetHmenuOf(menu), title) ) 202+ (UINT_PTR)GetHmenuOf(menu), title) ) 203 { 204 wxLogLastError(wxT("InsertMenu")); 205 } 206@@ -1191,7 +1191,7 @@ 207 #else 208 if ( !::InsertMenu(GetHmenu(), mswpos, 209 MF_BYPOSITION | MF_POPUP | MF_STRING, 210- (UINT)GetHmenuOf(menu), title) ) 211+ (UINT_PTR)GetHmenuOf(menu), title) ) 212 { 213 wxLogLastError(wxT("InsertMenu")); 214 } 215@@ -1250,7 +1250,7 @@ 216 } 217 #else 218 if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, 219- (UINT)submenu, title) ) 220+ (UINT_PTR)submenu, title) ) 221 { 222 wxLogLastError(wxT("AppendMenu")); 223 } 224Index: src/msw/tbar95.cpp 225=================================================================== 226--- src/msw/tbar95.cpp (revisione 63679) 227+++ src/msw/tbar95.cpp (copia locale) 228@@ -802,8 +802,8 @@ 229 TBREPLACEBITMAP replaceBitmap; 230 replaceBitmap.hInstOld = NULL; 231 replaceBitmap.hInstNew = NULL; 232- replaceBitmap.nIDOld = (UINT) oldToolBarBitmap; 233- replaceBitmap.nIDNew = (UINT) hBitmap; 234+ replaceBitmap.nIDOld = (UINT_PTR) oldToolBarBitmap; 235+ replaceBitmap.nIDNew = (UINT_PTR) hBitmap; 236 replaceBitmap.nButtons = nButtons; 237 if ( !::SendMessage(GetHwnd(), TB_REPLACEBITMAP, 238 0, (LPARAM) &replaceBitmap) ) 239@@ -832,7 +832,7 @@ 240 { 241 TBADDBITMAP addBitmap; 242 addBitmap.hInst = 0; 243- addBitmap.nID = (UINT) hBitmap; 244+ addBitmap.nID = (UINT_PTR) hBitmap; 245 if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP, 246 (WPARAM) nButtons, (LPARAM)&addBitmap) == -1 ) 247 { 248@@ -912,7 +912,7 @@ 249 { 250 const wxString& label = tool->GetLabel(); 251 if ( !label.empty() ) 252- button.iString = (int)label.c_str(); 253+ button.iString = (INT_PTR)label.c_str(); 254 } 255 256 button.idCommand = tool->GetId(); 257Index: src/msw/thread.cpp 258=================================================================== 259--- src/msw/thread.cpp (revisione 63679) 260+++ src/msw/thread.cpp (copia locale) 261@@ -522,7 +522,7 @@ 262 return (THREAD_RETVAL)-1; 263 } 264 265- rc = (THREAD_RETVAL)thread->Entry(); 266+ rc = wxPtrToUInt(thread->Entry()); 267 } 268 wxCATCH_ALL( wxTheApp->OnUnhandledException(); ) 269 270@@ -684,7 +684,7 @@ 271 // from Wait()) or ask it to terminate (when called from Delete()) 272 bool shouldDelete = threadToDelete != NULL; 273 274- wxThread::ExitCode rc = 0; 275+ DWORD rc = 0; 276 277 // we might need to resume the thread if it's currently stopped 278 bool shouldResume = false; 279@@ -837,12 +837,12 @@ 280 { 281 wxLogLastError(wxT("GetExitCodeThread")); 282 283- rc = (wxThread::ExitCode)-1; 284+ rc = (THREAD_RETVAL)-1; 285 286 break; 287 } 288 289- if ( (DWORD)rc != STILL_ACTIVE ) 290+ if ( rc != STILL_ACTIVE ) 291 break; 292 293 // give the other thread some time to terminate, otherwise we may be 294@@ -851,14 +851,14 @@ 295 } 296 297 if ( pRc ) 298- *pRc = rc; 299+ *pRc = wxUIntToPtr(rc); 300 301 // we don't need the thread handle any more in any case 302 Free(); 303 304 305- return rc == (wxThread::ExitCode)-1 ? wxTHREAD_MISC_ERROR 306- : wxTHREAD_NO_ERROR; 307+ return rc == (THREAD_RETVAL)-1 ? wxTHREAD_MISC_ERROR 308+ : wxTHREAD_NO_ERROR; 309 } 310 311 bool wxThreadInternal::Suspend() 312@@ -1162,7 +1162,7 @@ 313 } 314 315 #ifdef wxUSE_BEGIN_THREAD 316- _endthreadex((unsigned)status); 317+ _endthreadex(wxPtrToUInt(status)); 318 #else // !VC++ 319 ::ExitThread((DWORD)status); 320 #endif // VC++/!VC++ 321Index: src/msw/frame.cpp 322=================================================================== 323--- src/msw/frame.cpp (revisione 63679) 324+++ src/msw/frame.cpp (copia locale) 325@@ -855,7 +855,8 @@ 326 HDC hdc = ::BeginPaint(GetHwnd(), &ps); 327 328 // Erase background before painting or we get white background 329- MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L); 330+ // Commented out: according to MSDN it's only needed on NT 3.51 331+ // MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L); 332 333 if ( hIcon ) 334 { 335@@ -1080,7 +1081,7 @@ 336 const wxIcon& icon = GetIcon(); 337 HICON hIcon = icon.Ok() ? GetHiconOf(icon) 338 : (HICON)GetDefaultIcon(); 339- rc = (long)hIcon; 340+ rc = (WXLRESULT)hIcon; 341 processed = rc != 0; 342 } 343 break; 344Index: src/msw/pen.cpp 345=================================================================== 346--- src/msw/pen.cpp (revisione 63679) 347+++ src/msw/pen.cpp (copia locale) 348@@ -172,7 +172,7 @@ 349 case wxSTIPPLE: 350 logb.lbStyle = BS_PATTERN ; 351 if (M_PENDATA->m_stipple.Ok()) 352- logb.lbHatch = (LONG)M_PENDATA->m_stipple.GetHBITMAP(); 353+ logb.lbHatch = wxPtrToUInt(M_PENDATA->m_stipple.GetHBITMAP()); 354 else 355 logb.lbHatch = (LONG)0; 356 break; 357Index: src/msw/helpwin.cpp 358=================================================================== 359--- src/msw/helpwin.cpp (revisione 63679) 360+++ src/msw/helpwin.cpp (copia locale) 361@@ -98,7 +98,7 @@ 362 363 wxString str = GetValidFilename(m_helpFile); 364 365- return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k) != 0); 366+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_PARTIALKEY, (ULONG_PTR)(const wxChar*) k) != 0); 367 } 368 369 // Can't close the help window explicitly in WinHelp 370Index: src/msw/printdlg.cpp 371=================================================================== 372--- src/msw/printdlg.cpp (revisione 63679) 373+++ src/msw/printdlg.cpp (copia locale) 374@@ -175,10 +175,10 @@ 375 376 wxWindowsPrintNativeData::~wxWindowsPrintNativeData() 377 { 378- HGLOBAL hDevMode = (HGLOBAL)(DWORD) m_devMode; 379+ HGLOBAL hDevMode = (HGLOBAL) m_devMode; 380 if ( hDevMode ) 381 GlobalFree(hDevMode); 382- HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; 383+ HGLOBAL hDevNames = (HGLOBAL) m_devNames; 384 if ( hDevNames ) 385 GlobalFree(hDevNames); 386 } 387@@ -190,8 +190,8 @@ 388 389 bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data ) 390 { 391- HGLOBAL hDevMode = (HGLOBAL)(DWORD) m_devMode; 392- HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; 393+ HGLOBAL hDevMode = (HGLOBAL) m_devMode; 394+ HGLOBAL hDevNames = (HGLOBAL) m_devNames; 395 396 if (!hDevMode) 397 { 398@@ -396,8 +396,8 @@ 399 400 bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) 401 { 402- HGLOBAL hDevMode = (HGLOBAL)(DWORD) m_devMode; 403- HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; 404+ HGLOBAL hDevMode = (HGLOBAL) m_devMode; 405+ HGLOBAL hDevNames = (HGLOBAL) m_devNames; 406 WinPrinter printer; 407 LPTSTR szPrinterName = (LPTSTR)data.GetPrinterName().wx_str(); 408 409@@ -452,18 +452,12 @@ 410 // Use PRINTDLG as a way of creating a DEVMODE object 411 PRINTDLG pd; 412 413- // GNU-WIN32 has the wrong size PRINTDLG - can't work out why. 414-#ifdef __GNUWIN32__ 415- memset(&pd, 0, 66); 416- pd.lStructSize = 66; 417-#else 418 memset(&pd, 0, sizeof(PRINTDLG)); 419 #ifdef __WXWINCE__ 420 pd.cbStruct = sizeof(PRINTDLG); 421 #else 422 pd.lStructSize = sizeof(PRINTDLG); 423 #endif 424-#endif 425 426 pd.hwndOwner = (HWND)NULL; 427 pd.hDevMode = NULL; // Will be created by PrintDlg 428@@ -493,7 +487,7 @@ 429 else 430 { 431 hDevMode = pd.hDevMode; 432- m_devMode = (void*)(long) hDevMode; 433+ m_devMode = (void*) hDevMode; 434 pd.hDevMode = NULL; 435 436 // We'll create a new DEVNAMEs structure below. 437@@ -688,7 +682,7 @@ 438 } 439 440 // TODO: I hope it's OK to pass some empty strings to DEVNAMES. 441- m_devNames = (void*) (long) wxCreateDevNames(wxEmptyString, data.GetPrinterName(), wxEmptyString); 442+ m_devNames = wxCreateDevNames(wxEmptyString, data.GetPrinterName(), wxEmptyString); 443 444 return true; 445 } 446@@ -797,12 +791,8 @@ 447 memset( pd, 0, sizeof(PRINTDLG) ); 448 m_printDlg = (void*) pd; 449 450- // GNU-WIN32 has the wrong size PRINTDLG - can't work out why. 451-#ifdef __GNUWIN32__ 452- pd->lStructSize = 66; 453-#else 454 pd->lStructSize = sizeof(PRINTDLG); 455-#endif 456+ 457 pd->hwndOwner = (HWND)NULL; 458 pd->hDevMode = NULL; // Will be created by PrintDlg 459 pd->hDevNames = NULL; // Ditto 460@@ -820,13 +810,13 @@ 461 if (pd->hDevNames) 462 GlobalFree(pd->hDevNames); 463 464- pd->hDevMode = (HGLOBAL)(DWORD) native_data->GetDevMode(); 465+ pd->hDevMode = (HGLOBAL) native_data->GetDevMode(); 466 native_data->SetDevMode( (void*) NULL); 467 468 // Shouldn't assert; we should be able to test Ok-ness at a higher level 469 //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); 470 471- pd->hDevNames = (HGLOBAL)(DWORD) native_data->GetDevNames(); 472+ pd->hDevNames = (HGLOBAL) native_data->GetDevNames(); 473 native_data->SetDevNames( (void*) NULL); 474 475 476@@ -839,11 +829,7 @@ 477 478 pd->Flags = PD_RETURNDC; 479 480-#ifdef __GNUWIN32__ 481- pd->lStructSize = 66; 482-#else 483 pd->lStructSize = sizeof( PRINTDLG ); 484-#endif 485 486 pd->hwndOwner=(HWND)NULL; 487 // pd->hDevNames=(HANDLE)NULL; 488@@ -897,9 +883,9 @@ 489 if (native_data->GetDevMode()) 490 { 491 // Make sure we don't leak memory 492- GlobalFree( (HGLOBAL)(DWORD) native_data->GetDevMode() ); 493+ GlobalFree( (HGLOBAL) native_data->GetDevMode() ); 494 } 495- native_data->SetDevMode( (void*)(long) pd->hDevMode ); 496+ native_data->SetDevMode( (void*) pd->hDevMode ); 497 pd->hDevMode = NULL; 498 } 499 500@@ -909,9 +895,9 @@ 501 if (native_data->GetDevNames()) 502 { 503 // Make sure we don't leak memory 504- GlobalFree((HGLOBAL)(DWORD) native_data->GetDevNames()); 505+ GlobalFree((HGLOBAL) native_data->GetDevNames()); 506 } 507- native_data->SetDevNames((void*)(long) pd->hDevNames); 508+ native_data->SetDevNames((void*) pd->hDevNames); 509 pd->hDevNames = NULL; 510 } 511 512Index: src/msw/textctrl.cpp 513=================================================================== 514--- src/msw/textctrl.cpp 2009-03-06 13:11:24.000000000 +0100 515+++ src/msw/textctrl.cpp 2010-03-13 22:50:54.000000000 +0100 516@@ -960,7 +960,7 @@ 517 // finally, stream it in the control 518 EDITSTREAM eds; 519 wxZeroMemory(eds); 520- eds.dwCookie = (DWORD)&wpc; 521+ eds.dwCookie = (DWORD_PTR)&wpc; 522 // the cast below is needed for broken (very) old mingw32 headers 523 eds.pfnCallback = (EDITSTREAMCALLBACK)wxRichEditStreamIn; 524 525Index: include/wx/defs.h 526--- include/wx/defs.h 2009-03-06 13:10:51.000000000 +0100 527+++ include/wx/defs.h 2010-03-20 14:17:40.000000000 +0100 528@@ -823,75 +823,6 @@ 529 530 typedef wxUint32 wxDword; 531 532-/* 533- Define an integral type big enough to contain all of long, size_t and void *. 534- */ 535-#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T 536- /* normal case */ 537- typedef unsigned long wxUIntPtr; 538- typedef long wxIntPtr; 539-#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P 540- /* Win64 case */ 541- typedef size_t wxUIntPtr; 542- #define wxIntPtr ssize_t 543-#else 544- /* 545- This should never happen for the current architectures but if you're 546- using one where it does, please contact wx-dev@lists.wxwidgets.org. 547- */ 548- #error "Pointers can't be stored inside integer types." 549-#endif 550- 551-#ifdef __cplusplus 552-/* And also define a couple of simple functions to cast pointer to/from it. */ 553-inline wxUIntPtr wxPtrToUInt(const void *p) 554-{ 555- /* 556- VC++ 7.1 gives warnings about casts such as below even when they're 557- explicit with /Wp64 option, suppress them as we really know what we're 558- doing here. Same thing with icc with -Wall. 559- */ 560-#ifdef __VISUALC__ 561- #if __VISUALC__ >= 1200 562- #pragma warning(push) 563- #endif 564- /* pointer truncation from '' to '' */ 565- #pragma warning(disable: 4311) 566-#elif defined(__INTELC__) 567- #pragma warning(push) 568- /* conversion from pointer to same-sized integral type */ 569- #pragma warning(disable: 1684) 570-#endif 571- 572- return wx_reinterpret_cast(wxUIntPtr, p); 573- 574-#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) 575- #pragma warning(pop) 576-#endif 577-} 578- 579-inline void *wxUIntToPtr(wxUIntPtr p) 580-{ 581-#ifdef __VISUALC__ 582- #if __VISUALC__ >= 1200 583- #pragma warning(push) 584- #endif 585- /* conversion to type of greater size */ 586- #pragma warning(disable: 4312) 587-#elif defined(__INTELC__) 588- #pragma warning(push) 589- /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ 590- #pragma warning(disable: 171) 591-#endif 592- 593- return wx_reinterpret_cast(void *, p); 594- 595-#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) 596- #pragma warning(pop) 597-#endif 598-} 599-#endif /*__cplusplus*/ 600- 601 602 /* 64 bit */ 603 604@@ -1021,6 +954,87 @@ 605 #endif 606 607 608+// we can't rely on Windows _W64 being defined as windows.h may not be included 609+// so define our own equivalent: this should be used with types like WXLPARAM 610+// or WXWPARAM which are 64 bit under Win64 to avoid warnings each time we cast 611+// it to a pointer or a handle (which results in hundreds of warnings as Win32 612+// API often passes pointers in them) 613+#if defined(__VISUALC__) && __VISUALC__ >= 1300 614+ #define wxW64 __w64 615+#else 616+ #define wxW64 617+#endif 618+ 619+/* 620+ Define an integral type big enough to contain all of long, size_t and void *. 621+ */ 622+#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T 623+ /* normal case */ 624+ typedef long wxIntPtr; 625+ typedef unsigned long wxUIntPtr; 626+#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P 627+ /* Win64 case */ 628+ typedef wxW64 ssize_t wxIntPtr; 629+ typedef size_t wxUIntPtr; 630+#else 631+ /* 632+ This should never happen for the current architectures but if you're 633+ using one where it does, please contact wx-dev@lists.wxwidgets.org. 634+ */ 635+ #error "Pointers can't be stored inside integer types." 636+#endif 637+ 638+#ifdef __cplusplus 639+/* And also define a couple of simple functions to cast pointer to/from it. */ 640+inline wxUIntPtr wxPtrToUInt(const void *p) 641+{ 642+ /* 643+ VC++ 7.1 gives warnings about casts such as below even when they're 644+ explicit with /Wp64 option, suppress them as we really know what we're 645+ doing here. Same thing with icc with -Wall. 646+ */ 647+#ifdef __VISUALC__ 648+ #if __VISUALC__ >= 1200 649+ #pragma warning(push) 650+ #endif 651+ /* pointer truncation from '' to '' */ 652+ #pragma warning(disable: 4311) 653+#elif defined(__INTELC__) 654+ #pragma warning(push) 655+ /* conversion from pointer to same-sized integral type */ 656+ #pragma warning(disable: 1684) 657+#endif 658+ 659+ return wx_reinterpret_cast(wxUIntPtr, p); 660+ 661+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) 662+ #pragma warning(pop) 663+#endif 664+} 665+ 666+inline void *wxUIntToPtr(wxUIntPtr p) 667+{ 668+#ifdef __VISUALC__ 669+ #if __VISUALC__ >= 1200 670+ #pragma warning(push) 671+ #endif 672+ /* conversion to type of greater size */ 673+ #pragma warning(disable: 4312) 674+#elif defined(__INTELC__) 675+ #pragma warning(push) 676+ /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ 677+ #pragma warning(disable: 171) 678+#endif 679+ 680+ return wx_reinterpret_cast(void *, p); 681+ 682+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) 683+ #pragma warning(pop) 684+#endif 685+} 686+#endif /*__cplusplus*/ 687+ 688+ 689 /* base floating point types */ 690 /* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */ 691 /* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */ 692