summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2015-02-06 19:46:45 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2015-07-07 16:52:44 +0100
commitaa83c61f510121da20b56e8f7de700193f7d16b5 (patch)
tree4891f0972cb8a4375f52bbaf8d1e316e37d1bda6
parent487f2595c9dd9a5c3c600168a108963e87602561 (diff)
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>
-rw-r--r--hw/xwin/glx/indirect.c12
-rw-r--r--hw/xwin/winclipboard/xevents.c6
-rw-r--r--hw/xwin/windialogs.c8
-rw-r--r--hw/xwin/winkeybd.c2
-rw-r--r--hw/xwin/winkeyhook.c2
-rw-r--r--hw/xwin/winmultiwindowwindow.c2
-rw-r--r--hw/xwin/winmultiwindowwndproc.c4
-rw-r--r--hw/xwin/winscrinit.c4
-rw-r--r--hw/xwin/winshadddnl.c15
-rw-r--r--hw/xwin/winshadgdi.c8
10 files changed, 33 insertions, 30 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 93cdb29d6..e4be64228 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -253,7 +253,7 @@ pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
ErrorF("PIXELFORMATDESCRIPTOR:\n");
ErrorF("nSize = %u\n", pfd->nSize);
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_STEREO);
DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
@@ -297,9 +297,9 @@ pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers);
ErrorF("iLayerType = %hhu\n", pfd->iLayerType);
ErrorF("bReserved = %hhu\n", pfd->bReserved);
- ErrorF("dwLayerMask = %lu\n", pfd->dwLayerMask);
- ErrorF("dwVisibleMask = %lu\n", pfd->dwVisibleMask);
- ErrorF("dwDamageMask = %lu\n", pfd->dwDamageMask);
+ ErrorF("dwLayerMask = %u\n", (unsigned int)pfd->dwLayerMask);
+ ErrorF("dwVisibleMask = %u\n", (unsigned int)pfd->dwVisibleMask);
+ ErrorF("dwDamageMask = %u\n", (unsigned int)pfd->dwDamageMask);
ErrorF("\n");
}
@@ -1862,8 +1862,8 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
GLWIN_DEBUG_MSG
- ("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i + 1,
- pfd.dwFlags);
+ ("pixelFormat %d has unsuitable flags 0x%08x, skipping", i + 1,
+ (unsigned int)pfd.dwFlags);
continue;
}
diff --git a/hw/xwin/winclipboard/xevents.c b/hw/xwin/winclipboard/xevents.c
index bf44ac959..aee6c86a2 100644
--- a/hw/xwin/winclipboard/xevents.c
+++ b/hw/xwin/winclipboard/xevents.c
@@ -309,7 +309,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Access the clipboard */
if (!OpenClipboard(hwnd)) {
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "OpenClipboard () failed: %08lx\n", GetLastError());
+ "OpenClipboard () failed: %08x\n", (unsigned int)GetLastError());
/* Abort */
fAbort = TRUE;
@@ -369,7 +369,7 @@ winClipboardFlushXEvents(HWND hwnd,
}
if (!hGlobal) {
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "GetClipboardData () failed: %08lx\n", GetLastError());
+ "GetClipboardData () failed: %08x\n", (unsigned int)GetLastError());
/* Abort */
fAbort = TRUE;
@@ -706,7 +706,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Check that global memory was allocated */
if (!hGlobal) {
ErrorF("winClipboardFlushXEvents - SelectionNotify "
- "GlobalAlloc failed, aborting: %ld\n", GetLastError());
+ "GlobalAlloc failed, aborting: %08x\n", (unsigned int)GetLastError());
/* Abort */
fAbort = TRUE;
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 6fe3fc442..c83b49bab 100644
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -443,9 +443,9 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
#endif
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
+ winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %u, "
"current bpp: %d\n",
- s_pScreenInfo->dwBPP,
+ (unsigned int)s_pScreenInfo->dwBPP,
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif
@@ -455,9 +455,9 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
case WM_DISPLAYCHANGE:
#if CYGDEBUG
- winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
+ winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %u, "
"new bpp: %d\n",
- s_pScreenInfo->dwBPP,
+ (unsigned int)s_pScreenInfo->dwBPP,
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
#endif
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index e7202a6cb..f0342259b 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -504,7 +504,7 @@ winSendKeyEvent(DWORD dwKey, Bool fDown)
QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease,
dwKey + MIN_KEYCODE);
- winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", dwKey, fDown);
+ winDebug("winSendKeyEvent: dwKey: %u, fDown: %u\n", (unsigned int)dwKey, fDown);
}
BOOL
diff --git a/hw/xwin/winkeyhook.c b/hw/xwin/winkeyhook.c
index fe77b2190..66d68f63d 100644
--- a/hw/xwin/winkeyhook.c
+++ b/hw/xwin/winkeyhook.c
@@ -84,7 +84,7 @@ winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
/* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION) {
winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n",
- p->vkCode, p->scanCode);
+ (unsigned int)p->vkCode, (unsigned int)p->scanCode);
switch (wParam) {
case WM_KEYDOWN:
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 4a208dd6c..91bd956f6 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -954,7 +954,7 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd)
dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
+ winDebug("\tWindowStyle: %08x %08x\n", (unsigned int)dwStyle, (unsigned int)dwExStyle);
#endif
AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index ab892f291..eb7b55e4d 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -1064,7 +1064,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
winDebug("winTopLevelWindowProc - WM_STYLECHANGING from %08x %08x\n",
- dwStyle, dwExStyle);
+ (unsigned int)dwStyle, (unsigned int)dwExStyle);
if (wParam == GWL_EXSTYLE)
dwExStyle = newStyle;
@@ -1073,7 +1073,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
dwStyle = newStyle;
winDebug("winTopLevelWindowProc - WM_STYLECHANGING to %08x %08x\n",
- dwStyle, dwExStyle);
+ (unsigned int)dwStyle, (unsigned int)dwExStyle);
/* Get client rect in screen coordinates */
wi.cbSize = sizeof(WINDOWINFO);
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index e68ee1227..735ce9325 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -89,8 +89,8 @@ winScreenInit(ScreenPtr pScreen, int argc, char **argv)
DWORD dwInitialBPP;
#if CYGDEBUG || YES
- winDebug("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight);
+ winDebug("winScreenInit - dwWidth: %u dwHeight: %u\n",
+ (unsigned int)pScreenInfo->dwWidth, (unsigned int)pScreenInfo->dwHeight);
#endif
/* Allocate privates for this screen */
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 48599b266..d4f940ec1 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -200,8 +200,10 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
DDPIXELFORMAT ddpfPrimary;
#if CYGDEBUG
- winDebug("winAllocateFBShadowDDNL - w %d h %d d %d\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
+ winDebug("winAllocateFBShadowDDNL - w %u h %u d %u\n",
+ (unsigned int)pScreenInfo->dwWidth,
+ (unsigned int)pScreenInfo->dwHeight,
+ (unsigned int)pScreenInfo->dwDepth);
#endif
/* Set the padded screen width */
@@ -400,10 +402,11 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
#if CYGDEBUG
winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
- "dwRGBBitCount: %d\n",
- ddpfPrimary.u2.dwRBitMask,
- ddpfPrimary.u3.dwGBitMask,
- ddpfPrimary.u4.dwBBitMask, ddpfPrimary.u1.dwRGBBitCount);
+ "dwRGBBitCount: %u\n",
+ (unsigned int)ddpfPrimary.u2.dwRBitMask,
+ (unsigned int)ddpfPrimary.u3.dwGBitMask,
+ (unsigned int)ddpfPrimary.u4.dwBBitMask,
+ (unsigned int)ddpfPrimary.u1.dwRGBBitCount);
#endif
/* Describe the shadow surface to be created */
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 3d222ad4b..7c31175f4 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -121,7 +121,7 @@ winQueryScreenDIBFormat(ScreenPtr pScreen, BITMAPINFOHEADER * pbmih)
pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
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
/* Get optimal color table, or the optimal bitfields */
@@ -197,12 +197,12 @@ winQueryRGBBitsAndMasks(ScreenPtr pScreen)
#if CYGDEBUG
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__,
pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount,
pbmih->biPlanes);
- winDebug("%s - Compression: %d %s\n", __FUNCTION__,
- pbmih->biCompression,
+ winDebug("%s - Compression: %u %s\n", __FUNCTION__,
+ (unsigned int)pbmih->biCompression,
(pbmih->biCompression ==
BI_RGB ? "(BI_RGB)" : (pbmih->biCompression ==
BI_RLE8 ? "(BI_RLE8)" : (pbmih->