Use INT2PTR(), PTR2INT(), and PTR2UINT() macros to avoid
int-to-pointer/pointer-to-int compiler warnings
Based on approach used by Tcl/Tk and other extensions (e.g. tdbc::postgres)
Note that configure.in is patched prior to configure to avoid
running autoconf.
Upstream-Status: Pending (Tktable is dormant)

Index: configure.in
==================================================================
--- configure.in
+++ configure.in
@@ -144,10 +144,17 @@
 # Set the default compiler switches based on the --enable-symbols 
 # option.
 #--------------------------------------------------------------------
 
 TEA_ENABLE_SYMBOLS
+
+#--------------------------------------------------------------------
+# Integer pointer types used by the (U)INT2PTR / PTR2(U)INT macros.
+#--------------------------------------------------------------------
+
+AC_TYPE_INTPTR_T
+AC_TYPE_UINTPTR_T
 
 #--------------------------------------------------------------------
 # Everyone should be linking against the Tcl stub library.  If you
 # can't for some reason, remove this definition.  If you aren't using
 # stubs, you also need to modify the SHLIB_LD_LIBS setting below to

Index: configure
==================================================================
--- configure
+++ configure
@@ -11399,10 +11399,330 @@
 	else
 	    { $as_echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
 $as_echo "enabled $tcl_ok debugging" >&6; }
 	fi
     fi
+
+
+#--------------------------------------------------------------------
+# Integer pointer types used by the (U)INT2PTR / PTR2(U)INT macros.
+#--------------------------------------------------------------------
+
+
+  { $as_echo "$as_me:$LINENO: checking for intptr_t" >&5
+$as_echo_n "checking for intptr_t... " >&6; }
+if test "${ac_cv_type_intptr_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_intptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (intptr_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((intptr_t)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_intptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
+$as_echo "$ac_cv_type_intptr_t" >&6; }
+if test "x$ac_cv_type_intptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+else
+  for ac_type in 'int' 'long int' 'long long int'; do
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $ac_type
+_ACEOF
+
+	  ac_type=
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
+
+
+  { $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5
+$as_echo_n "checking for uintptr_t... " >&6; }
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_uintptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintptr_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintptr_t)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_uintptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+$as_echo "$ac_cv_type_uintptr_t" >&6; }
+if test "x$ac_cv_type_uintptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+else
+  for ac_type in 'unsigned int' 'unsigned long int' \
+	'unsigned long long int'; do
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $ac_type
+_ACEOF
+
+	  ac_type=
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
 
 
 #--------------------------------------------------------------------
 # Everyone should be linking against the Tcl stub library.  If you
 # can't for some reason, remove this definition.  If you aren't using

Index: generic/tkTable.c
==================================================================
--- generic/tkTable.c
+++ generic/tkTable.c
@@ -1966,11 +1966,11 @@
 	    /*
 	     * Merge colPtr if it exists
 	     * let's see if we have the value cached already
 	     * if not, run the findColTag routine and cache the value
 	     */
-	    entryPtr = Tcl_CreateHashEntry(colTagsCache, (char *)ucol, &new);
+	    entryPtr = Tcl_CreateHashEntry(colTagsCache, INT2PTR(ucol), &new);
 	    if (new) {
 		colPtr = FindRowColTag(tablePtr, ucol, COL);
 		Tcl_SetHashValue(entryPtr, colPtr);
 	    } else {
 		colPtr = (TableTag *) Tcl_GetHashValue(entryPtr);
@@ -2657,11 +2657,11 @@
     int entries, count, row, col;
 
     entries = 0;
     for (entryPtr = Tcl_FirstHashEntry(tablePtr->flashCells, &search);
 	 entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
-	count = (int) Tcl_GetHashValue(entryPtr);
+	count = PTR2INT(Tcl_GetHashValue(entryPtr));
 	if (--count <= 0) {
 	    /* get the cell address and invalidate that region only */
 	    TableParseArrayIndex(&row, &col,
 		    Tcl_GetHashKey(tablePtr->flashCells, entryPtr));
 
@@ -2669,11 +2669,11 @@
 	    Tcl_DeleteHashEntry(entryPtr);
 
 	    TableRefresh(tablePtr, row-tablePtr->rowOffset,
 		    col-tablePtr->colOffset, CELL);
 	} else {
-	    Tcl_SetHashValue(entryPtr, (ClientData) count);
+	    Tcl_SetHashValue(entryPtr, INT2PTR(count));
 	    entries++;
 	}
     }
 
     /* do I need to restart the timer */
@@ -2714,11 +2714,11 @@
     /* create the array index in user coords */
     TableMakeArrayIndex(row+tablePtr->rowOffset, col+tablePtr->colOffset, buf);
 
     /* add the flash to the hash table */
     entryPtr = Tcl_CreateHashEntry(tablePtr->flashCells, buf, &dummy);
-    Tcl_SetHashValue(entryPtr, tablePtr->flashTime);
+    Tcl_SetHashValue(entryPtr, INT2PTR(tablePtr->flashTime));
 
     /* now set the timer if it's not already going and invalidate the area */
     if (tablePtr->flashTimer == NULL) {
 	tablePtr->flashTimer = Tcl_CreateTimerHandler(250, TableFlashEvent,
 		(ClientData) tablePtr);
@@ -3113,17 +3113,17 @@
      */
     lastUnpreset = 0;
     numPixels = 0;
     unpreset = 0;
     for (i = 0; i < tablePtr->cols; i++) {
-	entryPtr = Tcl_FindHashEntry(tablePtr->colWidths, (char *) i);
+	entryPtr = Tcl_FindHashEntry(tablePtr->colWidths, INT2PTR(i));
 	if (entryPtr == NULL) {
 	    tablePtr->colPixels[i] = -1;
 	    unpreset++;
 	    lastUnpreset = i;
 	} else {
-	    value = (int) Tcl_GetHashValue(entryPtr);
+	    value = PTR2INT(Tcl_GetHashValue(entryPtr));
 	    if (value > 0) {
 		tablePtr->colPixels[i] = value * tablePtr->charWidth + px;
 	    } else {
 		/*
 		 * When a value in pixels is specified, we take that exact
@@ -3207,17 +3207,17 @@
 	/* get all the preset rows and set their heights */
 	lastUnpreset	= 0;
 	numPixels	= 0;
 	unpreset	= 0;
 	for (i = 0; i < tablePtr->rows; i++) {
-	    entryPtr = Tcl_FindHashEntry(tablePtr->rowHeights, (char *) i);
+	    entryPtr = Tcl_FindHashEntry(tablePtr->rowHeights, INT2PTR(i));
 	    if (entryPtr == NULL) {
 		tablePtr->rowPixels[i] = -1;
 		unpreset++;
 		lastUnpreset = i;
 	    } else {
-		value = (int) Tcl_GetHashValue(entryPtr);
+		value = PTR2INT(Tcl_GetHashValue(entryPtr));
 		if (value > 0) {
 		    tablePtr->rowPixels[i] = value * tablePtr->charHeight + py;
 		} else {
 		    /*
 		     * When a value in pixels is specified, we take that exact
@@ -3790,11 +3790,11 @@
 TableRestrictProc(serial, eventPtr)
      ClientData serial;
      XEvent *eventPtr;
 {
     if ((eventPtr->type == KeyRelease || eventPtr->type == KeyPress) &&
-	((eventPtr->xany.serial-(unsigned int)serial) > 0)) {
+	((eventPtr->xany.serial-PTR2UINT(serial)) > 0)) {
 	return TK_DEFER_EVENT;
     } else {
 	return TK_PROCESS_EVENT;
     }
 }

Index: generic/tkTable.h
==================================================================
--- generic/tkTable.h
+++ generic/tkTable.h
@@ -16,10 +16,13 @@
 #define _TKTABLE_H_
 
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
 #include <tk.h>
 #ifdef MAC_TCL
 # include <Xatom.h>
 #else
 # include <X11/Xatom.h>
@@ -48,10 +51,35 @@
 # else
 #  define EXTERN extern
 # endif
 #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
+
 #ifdef TCL_STORAGE_CLASS
 # undef TCL_STORAGE_CLASS
 #endif
 #ifdef BUILD_Tktable
 # define TCL_STORAGE_CLASS DLLEXPORT

Index: generic/tkTableCmds.c
==================================================================
--- generic/tkTableCmds.c
+++ generic/tkTableCmds.c
@@ -181,12 +181,12 @@
 
     if (objc == 2) {
 	/* print out all the preset column widths or row heights */
 	entryPtr = Tcl_FirstHashEntry(hashTablePtr, &search);
 	while (entryPtr != NULL) {
-	    posn = ((int) Tcl_GetHashKey(hashTablePtr, entryPtr)) + offset;
-	    value = (int) Tcl_GetHashValue(entryPtr);
+	    posn = PTR2INT(Tcl_GetHashKey(hashTablePtr, entryPtr)) + offset;
+	    value = PTR2INT(Tcl_GetHashValue(entryPtr));
 	    sprintf(buf1, "%d %d", posn, value);
 	    /* OBJECTIFY */
 	    Tcl_AppendElement(interp, buf1);
 	    entryPtr = Tcl_NextHashEntry(&search);
 	}
@@ -195,14 +195,14 @@
 	if (Tcl_GetIntFromObj(interp, objv[2], &posn) != TCL_OK) {
 	    return TCL_ERROR;
 	}
 	/* no range check is done, why bother? */
 	posn -= offset;
-	entryPtr = Tcl_FindHashEntry(hashTablePtr, (char *) posn);
+	entryPtr = Tcl_FindHashEntry(hashTablePtr, INT2PTR(posn));
 	if (entryPtr != NULL) {
 	    Tcl_SetIntObj(Tcl_GetObjResult(interp),
-			  (int) Tcl_GetHashValue(entryPtr));
+			  PTR2INT(Tcl_GetHashValue(entryPtr)));
 	} else {
 	    Tcl_SetIntObj(Tcl_GetObjResult(interp), widthType ?
 			  tablePtr->defColWidth : tablePtr->defRowHeight);
 	}
     } else {
@@ -215,18 +215,18 @@
 		return TCL_ERROR;
 	    }
 	    posn -= offset;
 	    if (value == -999999) {
 		/* reset that field */
-		entryPtr = Tcl_FindHashEntry(hashTablePtr, (char *) posn);
+		entryPtr = Tcl_FindHashEntry(hashTablePtr, INT2PTR(posn));
 		if (entryPtr != NULL) {
 		    Tcl_DeleteHashEntry(entryPtr);
 		}
 	    } else {
 		entryPtr = Tcl_CreateHashEntry(hashTablePtr,
-					       (char *) posn, &dummy);
+					       INT2PTR(posn), &dummy);
-		Tcl_SetHashValue(entryPtr, (ClientData) value);
+		Tcl_SetHashValue(entryPtr, INT2PTR(value));
 	    }
 	}
 	TableAdjustParams(tablePtr);
 	/* rerequest geometry */
 	TableGeometryRequest(tablePtr);
@@ -411,14 +411,14 @@
 	    /* row border was active, move it */
 	    value = y-h;
 	    if (value < -1) value = -1;
 	    if (value != tablePtr->scanMarkY) {
 		entryPtr = Tcl_CreateHashEntry(tablePtr->rowHeights,
-					       (char *) row, &dummy);
+					       INT2PTR(row), &dummy);
 		/* -value means rowHeight will be interp'd as pixels, not
                    lines */
-		Tcl_SetHashValue(entryPtr, (ClientData) MIN(0,-value));
+		Tcl_SetHashValue(entryPtr, INT2PTR(MIN(0,-value)));
 		tablePtr->scanMarkY = value;
 		key++;
 	    }
 	}
 	if (col >= 0 && (tablePtr->resize & SEL_COL)) {
@@ -425,14 +425,14 @@
 	    /* col border was active, move it */
 	    value = x-w;
 	    if (value < -1) value = -1;
 	    if (value != tablePtr->scanMarkX) {
 		entryPtr = Tcl_CreateHashEntry(tablePtr->colWidths,
-					       (char *) col, &dummy);
+					       INT2PTR(col), &dummy);
 		/* -value means colWidth will be interp'd as pixels, not
                    chars */
-		Tcl_SetHashValue(entryPtr, (ClientData) MIN(0,-value));
+		Tcl_SetHashValue(entryPtr, INT2PTR(MIN(0,-value)));
 		tablePtr->scanMarkX = value;
 		key++;
 	    }
 	}
 	/* Only if something changed do we want to update */
@@ -547,18 +547,18 @@
 	for (row = r1; row <= r2; row++) {
 	    /* Note that *Styles entries are user based (no offset)
 	     * while size entries are 0-based (real) */
 	    if ((cmdIndex == CLEAR_TAGS || cmdIndex == CLEAR_ALL) &&
 		(entryPtr = Tcl_FindHashEntry(tablePtr->rowStyles,
-					      (char *) row))) {
+					      INT2PTR(row)))) {
 		Tcl_DeleteHashEntry(entryPtr);
 		redraw = 1;
 	    }
 
 	    if ((cmdIndex == CLEAR_SIZES || cmdIndex == CLEAR_ALL) &&
 		(entryPtr = Tcl_FindHashEntry(tablePtr->rowHeights,
-					      (char *) row-tablePtr->rowOffset))) {
+					      INT2PTR(row-tablePtr->rowOffset)))) {
 		Tcl_DeleteHashEntry(entryPtr);
 		redraw = 1;
 	    }
 
 	    for (col = c1; col <= c2; col++) {
@@ -565,11 +565,11 @@
 		TableMakeArrayIndex(row, col, buf);
 
 		if (cmdIndex == CLEAR_TAGS || cmdIndex == CLEAR_ALL) {
 		    if ((row == r1) &&
 			(entryPtr = Tcl_FindHashEntry(tablePtr->colStyles,
-						      (char *) col))) {
+						      INT2PTR(col)))) {
 			Tcl_DeleteHashEntry(entryPtr);
 			redraw = 1;
 		    }
 		    if ((entryPtr = Tcl_FindHashEntry(tablePtr->cellStyles,
 						      buf))) {
@@ -588,12 +588,12 @@
 		    }
 		}
 
 		if ((cmdIndex == CLEAR_SIZES || cmdIndex == CLEAR_ALL) &&
 		    row == r1 &&
-		    (entryPtr = Tcl_FindHashEntry(tablePtr->colWidths, (char *)
-						  col-tablePtr->colOffset))) {
+		    (entryPtr = Tcl_FindHashEntry(tablePtr->colWidths,
+						  INT2PTR(col-tablePtr->colOffset)))) {
 		    Tcl_DeleteHashEntry(entryPtr);
 		    redraw = 1;
 		}
 
 		if ((cmdIndex == CLEAR_CACHE || cmdIndex == CLEAR_ALL) &&

Index: generic/tkTableEdit.c
==================================================================
--- generic/tkTableEdit.c
+++ generic/tkTableEdit.c
@@ -603,28 +603,28 @@
      * If -holdtags is specified, we don't move the user-set widths/heights
      * of the absolute rows/columns, otherwise we enter here to move the
      * dimensions appropriately
      */
     if (!(flags & HOLD_TAGS)) {
-	entryPtr = Tcl_FindHashEntry(tagTblPtr, (char *)from);
+	entryPtr = Tcl_FindHashEntry(tagTblPtr, INT2PTR(from));
 	if (entryPtr != NULL) {
 	    Tcl_DeleteHashEntry(entryPtr);
 	}
-	entryPtr = Tcl_FindHashEntry(dimTblPtr, (char *)from-offset);
+	entryPtr = Tcl_FindHashEntry(dimTblPtr, INT2PTR(from-offset));
 	if (entryPtr != NULL) {
 	    Tcl_DeleteHashEntry(entryPtr);
 	}
 	if (!outOfBounds) {
-	    entryPtr = Tcl_FindHashEntry(tagTblPtr, (char *)to);
+	    entryPtr = Tcl_FindHashEntry(tagTblPtr, INT2PTR(to));
 	    if (entryPtr != NULL) {
-		newPtr = Tcl_CreateHashEntry(tagTblPtr, (char *)from, &new);
+		newPtr = Tcl_CreateHashEntry(tagTblPtr, INT2PTR(from), &new);
 		Tcl_SetHashValue(newPtr, Tcl_GetHashValue(entryPtr));
 		Tcl_DeleteHashEntry(entryPtr);
 	    }
-	    entryPtr = Tcl_FindHashEntry(dimTblPtr, (char *)to-offset);
+	    entryPtr = Tcl_FindHashEntry(dimTblPtr, INT2PTR(to-offset));
 	    if (entryPtr != NULL) {
-		newPtr = Tcl_CreateHashEntry(dimTblPtr, (char *)from-offset,
+		newPtr = Tcl_CreateHashEntry(dimTblPtr, INT2PTR(from-offset),
 			&new);
 		Tcl_SetHashValue(newPtr, Tcl_GetHashValue(entryPtr));
 		Tcl_DeleteHashEntry(entryPtr);
 	    }
 	}

Index: generic/tkTableTag.c
==================================================================
--- generic/tkTableTag.c
+++ generic/tkTableTag.c
@@ -573,11 +573,11 @@
 {
     Tcl_HashEntry *entryPtr;
     TableTag *tagPtr = NULL;
 
     entryPtr = Tcl_FindHashEntry((mode == ROW) ? tablePtr->rowStyles
-				 : tablePtr->colStyles, (char *) cell);
+				 : tablePtr->colStyles, INT2PTR(cell));
     if (entryPtr == NULL) {
 	char *cmd = (mode == ROW) ? tablePtr->rowTagCmd : tablePtr->colTagCmd;
 	if (cmd) {
 	    register Tcl_Interp *interp = tablePtr->interp;
 	    char buf[INDEX_BUFSIZE];
@@ -869,11 +869,11 @@
 			 scanPtr = Tcl_NextHashEntry(&search)) {
 			TableParseArrayIndex(&row, &col,
 				Tcl_GetHashKey(hashTblPtr, scanPtr));
 			value = forRows ? row : col;
 			entryPtr = Tcl_CreateHashEntry(cacheTblPtr,
-				(char *)value, &newEntry);
+				INT2PTR(value), &newEntry);
 			if (newEntry) {
 			    Tcl_ListObjAppendElement(NULL, resultPtr,
 				    Tcl_NewIntObj(value));
 			}
 		    }
@@ -902,11 +902,11 @@
 			 scanPtr != NULL;
 			 scanPtr = Tcl_NextHashEntry(&search)) {
 			/* is this the tag pointer on this row */
 			if ((TableTag *) Tcl_GetHashValue(scanPtr) == tagPtr) {
 			    objPtr = Tcl_NewIntObj(
-				(int) Tcl_GetHashKey(hashTblPtr, scanPtr));
+				PTR2INT(Tcl_GetHashKey(hashTblPtr, scanPtr)));
 			    Tcl_ListObjAppendElement(NULL, resultPtr, objPtr);
 			}
 		    }
 		}
 		return TCL_OK;
@@ -924,11 +924,11 @@
 		}
 		if (tagPtr == NULL) {
 		    /*
 		     * This is a deletion
 		     */
-		    entryPtr = Tcl_FindHashEntry(hashTblPtr, (char *)value);
+		    entryPtr = Tcl_FindHashEntry(hashTblPtr, INT2PTR(value));
 		    if (entryPtr != NULL) {
 			Tcl_DeleteHashEntry(entryPtr);
 			refresh = 1;
 		    }
 		} else {
@@ -935,11 +935,11 @@
 		    /*
 		     * Add a key to the hash table and set it to point to the
 		     * Tag structure if it wasn't the same as an existing one
 		     */
 		    entryPtr = Tcl_CreateHashEntry(hashTblPtr,
-			    (char *) value, &newEntry);
+			    INT2PTR(value), &newEntry);
 		    if (newEntry || (tagPtr !=
 			    (TableTag *) Tcl_GetHashValue(entryPtr))) {
 			Tcl_SetHashValue(entryPtr, (ClientData) tagPtr);
 			refresh = 1;
 		    }

Index: generic/tkTableUtil.c
==================================================================
--- generic/tkTableUtil.c
+++ generic/tkTableUtil.c
@@ -78,11 +78,11 @@
     char *widgRec;			/* Pointer to record for item. */
     int offset;				/* Offset into item. */
 {
     char **borderStr;
     int *bordersPtr, *bdPtr;
-    int type	= (int) clientData;
+    int type	= PTR2INT(clientData);
     int result	= TCL_OK;
     int argc;
     CONST84 char **argv;
 
     if ((type == BD_TABLE) && (value[0] == '\0')) {
@@ -177,11 +177,11 @@
     int offset;				/* Offset into item. */
     Tcl_FreeProc **freeProcPtr;		/* Pointer to variable to fill in with
 					 * information about how to reclaim
 					 * storage for return string. */
 {
-    register int type	= (int) clientData;
+    register int type	= PTR2INT(clientData);
 
     if (type == BD_TABLE) {
 	return ((TableTag *) (widgRec + offset))->borderStr;
     } else if (type == BD_TABLE_TAG) {
 	return ((TableTag *) widgRec)->borderStr;

