hw/xwin: printf format fixes for DWORD type
Some Win32 API types are different fundamental types in the 32-bit and 64-bit versions. This problem is then further compounded by the fact that whilst both 32-bit Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64 data model, but 64-bit Cygwin uses the LP64 data model. This makes it impossible to write printf format specifiers which are correct for all those targets In the Win32 API, DWORD is an unsigned, 32-bit type. It is defined in terms of an unsigned long, except in the LP64 data model, where it is an unsigned int. It should always be safe to cast it to unsigned int and use %u or %x. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
487f2595c9
commit
aa83c61f51
|
@ -253,7 +253,7 @@ pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
|
||||||
ErrorF("PIXELFORMATDESCRIPTOR:\n");
|
ErrorF("PIXELFORMATDESCRIPTOR:\n");
|
||||||
ErrorF("nSize = %u\n", pfd->nSize);
|
ErrorF("nSize = %u\n", pfd->nSize);
|
||||||
ErrorF("nVersion = %u\n", pfd->nVersion);
|
ErrorF("nVersion = %u\n", pfd->nVersion);
|
||||||
ErrorF("dwFlags = %lu = {", pfd->dwFlags);
|
ErrorF("dwFlags = %u = {", (unsigned int)pfd->dwFlags);
|
||||||
DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
|
DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
|
||||||
DUMP_PFD_FLAG(PFD_STEREO);
|
DUMP_PFD_FLAG(PFD_STEREO);
|
||||||
DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
|
DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
|
||||||
|
@ -297,9 +297,9 @@ pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
|
||||||
ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers);
|
ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers);
|
||||||
ErrorF("iLayerType = %hhu\n", pfd->iLayerType);
|
ErrorF("iLayerType = %hhu\n", pfd->iLayerType);
|
||||||
ErrorF("bReserved = %hhu\n", pfd->bReserved);
|
ErrorF("bReserved = %hhu\n", pfd->bReserved);
|
||||||
ErrorF("dwLayerMask = %lu\n", pfd->dwLayerMask);
|
ErrorF("dwLayerMask = %u\n", (unsigned int)pfd->dwLayerMask);
|
||||||
ErrorF("dwVisibleMask = %lu\n", pfd->dwVisibleMask);
|
ErrorF("dwVisibleMask = %u\n", (unsigned int)pfd->dwVisibleMask);
|
||||||
ErrorF("dwDamageMask = %lu\n", pfd->dwDamageMask);
|
ErrorF("dwDamageMask = %u\n", (unsigned int)pfd->dwDamageMask);
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1862,8 +1862,8 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
|
||||||
if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
|
if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
|
||||||
!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
|
!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
|
||||||
GLWIN_DEBUG_MSG
|
GLWIN_DEBUG_MSG
|
||||||
("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i + 1,
|
("pixelFormat %d has unsuitable flags 0x%08x, skipping", i + 1,
|
||||||
pfd.dwFlags);
|
(unsigned int)pfd.dwFlags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
/* Access the clipboard */
|
/* Access the clipboard */
|
||||||
if (!OpenClipboard(hwnd)) {
|
if (!OpenClipboard(hwnd)) {
|
||||||
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
||||||
"OpenClipboard () failed: %08lx\n", GetLastError());
|
"OpenClipboard () failed: %08x\n", (unsigned int)GetLastError());
|
||||||
|
|
||||||
/* Abort */
|
/* Abort */
|
||||||
fAbort = TRUE;
|
fAbort = TRUE;
|
||||||
|
@ -369,7 +369,7 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
}
|
}
|
||||||
if (!hGlobal) {
|
if (!hGlobal) {
|
||||||
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
|
||||||
"GetClipboardData () failed: %08lx\n", GetLastError());
|
"GetClipboardData () failed: %08x\n", (unsigned int)GetLastError());
|
||||||
|
|
||||||
/* Abort */
|
/* Abort */
|
||||||
fAbort = TRUE;
|
fAbort = TRUE;
|
||||||
|
@ -706,7 +706,7 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
/* Check that global memory was allocated */
|
/* Check that global memory was allocated */
|
||||||
if (!hGlobal) {
|
if (!hGlobal) {
|
||||||
ErrorF("winClipboardFlushXEvents - SelectionNotify "
|
ErrorF("winClipboardFlushXEvents - SelectionNotify "
|
||||||
"GlobalAlloc failed, aborting: %ld\n", GetLastError());
|
"GlobalAlloc failed, aborting: %08x\n", (unsigned int)GetLastError());
|
||||||
|
|
||||||
/* Abort */
|
/* Abort */
|
||||||
fAbort = TRUE;
|
fAbort = TRUE;
|
||||||
|
|
|
@ -443,9 +443,9 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
|
winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %u, "
|
||||||
"current bpp: %d\n",
|
"current bpp: %d\n",
|
||||||
s_pScreenInfo->dwBPP,
|
(unsigned int)s_pScreenInfo->dwBPP,
|
||||||
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -455,9 +455,9 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
|
winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %u, "
|
||||||
"new bpp: %d\n",
|
"new bpp: %d\n",
|
||||||
s_pScreenInfo->dwBPP,
|
(unsigned int)s_pScreenInfo->dwBPP,
|
||||||
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,7 @@ winSendKeyEvent(DWORD dwKey, Bool fDown)
|
||||||
QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease,
|
QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease,
|
||||||
dwKey + MIN_KEYCODE);
|
dwKey + MIN_KEYCODE);
|
||||||
|
|
||||||
winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", dwKey, fDown);
|
winDebug("winSendKeyEvent: dwKey: %u, fDown: %u\n", (unsigned int)dwKey, fDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -84,7 +84,7 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
|
||||||
/* Pass keystrokes on to our main message loop */
|
/* Pass keystrokes on to our main message loop */
|
||||||
if (iCode == HC_ACTION) {
|
if (iCode == HC_ACTION) {
|
||||||
winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n",
|
winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n",
|
||||||
p->vkCode, p->scanCode);
|
(unsigned int)p->vkCode, (unsigned int)p->scanCode);
|
||||||
|
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
|
|
|
@ -954,7 +954,7 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd)
|
||||||
dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
||||||
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
|
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
#ifdef CYGMULTIWINDOW_DEBUG
|
#ifdef CYGMULTIWINDOW_DEBUG
|
||||||
winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
|
winDebug("\tWindowStyle: %08x %08x\n", (unsigned int)dwStyle, (unsigned int)dwExStyle);
|
||||||
#endif
|
#endif
|
||||||
AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
|
AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
|
||||||
|
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
|
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
|
|
||||||
winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n",
|
winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n",
|
||||||
dwStyle, dwExStyle);
|
(unsigned int)dwStyle, (unsigned int)dwExStyle);
|
||||||
|
|
||||||
if (wParam == GWL_EXSTYLE)
|
if (wParam == GWL_EXSTYLE)
|
||||||
dwExStyle = newStyle;
|
dwExStyle = newStyle;
|
||||||
|
@ -1073,7 +1073,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
dwStyle = newStyle;
|
dwStyle = newStyle;
|
||||||
|
|
||||||
winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n",
|
winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n",
|
||||||
dwStyle, dwExStyle);
|
(unsigned int)dwStyle, (unsigned int)dwExStyle);
|
||||||
|
|
||||||
/* Get client rect in screen coordinates */
|
/* Get client rect in screen coordinates */
|
||||||
wi.cbSize = sizeof(WINDOWINFO);
|
wi.cbSize = sizeof(WINDOWINFO);
|
||||||
|
|
|
@ -89,8 +89,8 @@ winScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||||
DWORD dwInitialBPP;
|
DWORD dwInitialBPP;
|
||||||
|
|
||||||
#if CYGDEBUG || YES
|
#if CYGDEBUG || YES
|
||||||
winDebug("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
|
winDebug("winScreenInit - dwWidth: %u dwHeight: %u\n",
|
||||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight);
|
(unsigned int)pScreenInfo->dwWidth, (unsigned int)pScreenInfo->dwHeight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate privates for this screen */
|
/* Allocate privates for this screen */
|
||||||
|
|
|
@ -200,8 +200,10 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
|
||||||
DDPIXELFORMAT ddpfPrimary;
|
DDPIXELFORMAT ddpfPrimary;
|
||||||
|
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug("winAllocateFBShadowDDNL - w %d h %d d %d\n",
|
winDebug("winAllocateFBShadowDDNL - w %u h %u d %u\n",
|
||||||
pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
|
(unsigned int)pScreenInfo->dwWidth,
|
||||||
|
(unsigned int)pScreenInfo->dwHeight,
|
||||||
|
(unsigned int)pScreenInfo->dwDepth);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set the padded screen width */
|
/* Set the padded screen width */
|
||||||
|
@ -400,10 +402,11 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
|
||||||
|
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
|
winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
|
||||||
"dwRGBBitCount: %d\n",
|
"dwRGBBitCount: %u\n",
|
||||||
ddpfPrimary.u2.dwRBitMask,
|
(unsigned int)ddpfPrimary.u2.dwRBitMask,
|
||||||
ddpfPrimary.u3.dwGBitMask,
|
(unsigned int)ddpfPrimary.u3.dwGBitMask,
|
||||||
ddpfPrimary.u4.dwBBitMask, ddpfPrimary.u1.dwRGBBitCount);
|
(unsigned int)ddpfPrimary.u4.dwBBitMask,
|
||||||
|
(unsigned int)ddpfPrimary.u1.dwRGBBitCount);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Describe the shadow surface to be created */
|
/* Describe the shadow surface to be created */
|
||||||
|
|
|
@ -121,7 +121,7 @@ winQueryScreenDIBFormat(ScreenPtr pScreen, BITMAPINFOHEADER * pbmih)
|
||||||
pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
|
pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
|
||||||
|
|
||||||
winDebug("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
|
winDebug("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
|
||||||
pdw[0], pdw[1], pdw[2]);
|
(unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get optimal color table, or the optimal bitfields */
|
/* Get optimal color table, or the optimal bitfields */
|
||||||
|
@ -197,12 +197,12 @@ winQueryRGBBitsAndMasks(ScreenPtr pScreen)
|
||||||
|
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
|
winDebug("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
|
||||||
pdw[0], pdw[1], pdw[2]);
|
(unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]);
|
||||||
winDebug("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
|
winDebug("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
|
||||||
pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount,
|
pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount,
|
||||||
pbmih->biPlanes);
|
pbmih->biPlanes);
|
||||||
winDebug("%s - Compression: %d %s\n", __FUNCTION__,
|
winDebug("%s - Compression: %u %s\n", __FUNCTION__,
|
||||||
pbmih->biCompression,
|
(unsigned int)pbmih->biCompression,
|
||||||
(pbmih->biCompression ==
|
(pbmih->biCompression ==
|
||||||
BI_RGB ? "(BI_RGB)" : (pbmih->biCompression ==
|
BI_RGB ? "(BI_RGB)" : (pbmih->biCompression ==
|
||||||
BI_RLE8 ? "(BI_RLE8)" : (pbmih->
|
BI_RLE8 ? "(BI_RLE8)" : (pbmih->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user