comparison dw.h @ 1839:22225eb286e5

Fixes for building with MINGW64 (specifically http://tdm-gcc.tdragon.net/). Currently a few things are missing, themes and HTML rendering but it builds in both 32bit and 64bit mode. There are also warnings generated by gcc every time the source calls a Windows API macro. (unused result warning).
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Nov 2012 19:52:36 +0000
parents aedf5903db0a
children 3343a61f3262
comparison
equal deleted inserted replaced
1838:ca304f28de3b 1839:22225eb286e5
1 /* $Id$ */ 1 /* $Id: dw.h 1811 2012-09-27 05:09:10Z mhessling $ */
2 2
3 #ifndef _H_DW 3 #ifndef _H_DW
4 #define _H_DW 4 #define _H_DW
5 5
6 /* Dynamic Windows version numbers */ 6 /* Dynamic Windows version numbers */
1389 /* Macro for casting resource IDs to HICN */ 1389 /* Macro for casting resource IDs to HICN */
1390 #define DW_RESOURCE(a) (a < 65536 ? (HICN)a : (HICN)0) 1390 #define DW_RESOURCE(a) (a < 65536 ? (HICN)a : (HICN)0)
1391 1391
1392 #include <limits.h> 1392 #include <limits.h>
1393 /* Macros for converting from INT/UINT to and from POINTER without compiler warnings */ 1393 /* Macros for converting from INT/UINT to and from POINTER without compiler warnings */
1394 #if LONG_MAX > INT_MAX 1394 #if _MSC_VER > 1200 || (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30100 || defined(__has_extension)
1395 /* There has got to be a better way to check for the intptr_t type....
1396 * for now just include valid versions of Visual C and GCC plus clang.
1397 */
1398 #define DW_INT_TO_POINTER(a) ((void *)(intptr_t)a)
1399 #define DW_POINTER_TO_INT(a) ((int)(intptr_t)a)
1400 #define DW_UINT_TO_POINTER(a) ((void *)(uintptr_t)a)
1401 #define DW_POINTER_TO_UINT(a) ((unsigned int)(uintptr_t)a)
1402 #elif ULONG_MAX > UINT_MAX
1403 /* If no intptr_t... ULONG is often bigger than UINT */
1395 #define DW_INT_TO_POINTER(a) ((void *)(long)a) 1404 #define DW_INT_TO_POINTER(a) ((void *)(long)a)
1396 #define DW_POINTER_TO_INT(a) ((int)(long)a) 1405 #define DW_POINTER_TO_INT(a) ((int)(long)a)
1397 #define DW_UINT_TO_POINTER(a) ((void *)(unsigned long)a) 1406 #define DW_UINT_TO_POINTER(a) ((void *)(unsigned long)a)
1398 #define DW_POINTER_TO_UINT(a) ((unsigned int)(unsigned long)a) 1407 #define DW_POINTER_TO_UINT(a) ((unsigned int)(unsigned long)a)
1399 #else 1408 #else
1409 /* Otherwise just fall back to standard casts */
1400 #define DW_INT_TO_POINTER(a) ((void *)a) 1410 #define DW_INT_TO_POINTER(a) ((void *)a)
1401 #define DW_POINTER_TO_INT(a) ((int)a) 1411 #define DW_POINTER_TO_INT(a) ((int)a)
1402 #define DW_UINT_TO_POINTER(a) ((void *)a) 1412 #define DW_UINT_TO_POINTER(a) ((void *)a)
1403 #define DW_POINTER_TO_UINT(a) ((unsigned int)a) 1413 #define DW_POINTER_TO_UINT(a) ((unsigned int)a)
1404 #endif 1414 #endif