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