summaryrefslogtreecommitdiffstats
path: root/generic/tkInt.h
diff options
context:
space:
mode:
authordas <das>2007-10-15 07:24:47 (GMT)
committerdas <das>2007-10-15 07:24:47 (GMT)
commitefc99bc15db0e9e7a9b41476cff1119112348d7b (patch)
tree67915c083365997a60c6f2e4622f437540598f6d /generic/tkInt.h
parent95b981bcce4ffe3ed7b5b3bf8f48e366955ee383 (diff)
downloadtk-efc99bc15db0e9e7a9b41476cff1119112348d7b.zip
tk-efc99bc15db0e9e7a9b41476cff1119112348d7b.tar.gz
tk-efc99bc15db0e9e7a9b41476cff1119112348d7b.tar.bz2
* generic/tkArgv.c: Fix gcc warnings about 'cast to/from
* generic/tkCanvUtil.c: pointer from/to integer of different * generic/tkCanvas.c: size' on 64-bit platforms by casting * generic/tkCursor.c: to intermediate types * generic/tkInt.h: intptr_t/uintptr_t via new PTR2INT(), * generic/tkListbox.c: INT2PTR(), PTR2UINT() and UINT2PTR() * generic/tkObj.c: macros. * generic/tkStyle.c: * generic/tkTextIndex.c: * generic/tkUtil.c: * generic/ttk/ttkTheme.h: * generic/ttk/ttkTreeview.c: * unix/tkUnixMenu.c: * unix/configure.in: * unix/configure: autoconf-2.59 * unix/tkConfig.h.in: autoheader-2.59
Diffstat (limited to 'generic/tkInt.h')
-rw-r--r--generic/tkInt.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 80e5858..da5b746 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: $Id: tkInt.h,v 1.78 2007/06/24 16:07:34 dkf Exp $
+ * RCS: $Id: tkInt.h,v 1.79 2007/10/15 07:24:48 das Exp $
*/
#ifndef _TKINT
@@ -67,6 +67,31 @@
#endif
/*
+ * Macros used to cast between pointers and integers (e.g. when storing an int
+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
+ * to/from pointer from/to integer of different size".
+ */
+
+#if !defined(INT2PTR) && !defined(PTR2INT)
+# if defined(HAVE_INTPTR_T) || defined(intptr_t)
+# define INT2PTR(p) ((void*)(intptr_t)(p))
+# define PTR2INT(p) ((int)(intptr_t)(p))
+# else
+# define INT2PTR(p) ((void*)(p))
+# define PTR2INT(p) ((int)(p))
+# endif
+#endif
+#if !defined(UINT2PTR) && !defined(PTR2UINT)
+# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
+# define UINT2PTR(p) ((void*)(uintptr_t)(p))
+# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
+# else
+# define UINT2PTR(p) ((void*)(p))
+# define PTR2UINT(p) ((unsigned int)(p))
+# endif
+#endif
+
+/*
* Opaque type declarations:
*/