diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-02-06 19:46:45 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-07-07 16:52:44 +0100 |
commit | aa83c61f510121da20b56e8f7de700193f7d16b5 (patch) | |
tree | 4891f0972cb8a4375f52bbaf8d1e316e37d1bda6 /hw/xwin/winshadgdi.c | |
parent | 487f2595c9dd9a5c3c600168a108963e87602561 (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>
Diffstat (limited to 'hw/xwin/winshadgdi.c')
-rw-r--r-- | hw/xwin/winshadgdi.c | 8 |
1 files changed, 4 insertions, 4 deletions
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-> |