summaryrefslogtreecommitdiffstats
path: root/generic
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
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')
-rw-r--r--generic/tkArgv.c6
-rw-r--r--generic/tkCanvUtil.c6
-rw-r--r--generic/tkCanvas.c11
-rw-r--r--generic/tkCursor.c5
-rw-r--r--generic/tkInt.h27
-rw-r--r--generic/tkListbox.c44
-rw-r--r--generic/tkObj.c6
-rw-r--r--generic/tkStyle.c8
-rw-r--r--generic/tkTextIndex.c6
-rw-r--r--generic/tkUtil.c16
-rw-r--r--generic/ttk/ttkTheme.h24
-rw-r--r--generic/ttk/ttkTreeview.c6
12 files changed, 107 insertions, 58 deletions
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 0cfa668..15f032a 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -10,10 +10,10 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkArgv.c,v 1.8 2007/09/07 00:34:51 dgp Exp $
+ * RCS: @(#) $Id: tkArgv.c,v 1.9 2007/10/15 07:24:48 das Exp $
*/
-#include "tkPort.h"
+#include "tkInt.h"
/*
* Default table of argument descriptors. These are normally available in
@@ -172,7 +172,7 @@ Tk_ParseArgv(
infoPtr = matchPtr;
switch (infoPtr->type) {
case TK_ARGV_CONSTANT:
- *((int *) infoPtr->dst) = (int) infoPtr->src;
+ *((int *) infoPtr->dst) = PTR2INT(infoPtr->src);
break;
case TK_ARGV_INT:
if (argc == 0) {
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index d92ef81..a875af5 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvUtil.c,v 1.16 2007/09/07 00:34:52 dgp Exp $
+ * RCS: @(#) $Id: tkCanvUtil.c,v 1.17 2007/10/15 07:24:48 das Exp $
*/
#include "tkInt.h"
@@ -1238,7 +1238,7 @@ Tk_ChangeOutlineGC(
ckfree(q);
} else if (dash->number>2 || (dash->number==2 &&
(dash->pattern.array[0]!=dash->pattern.array[1]))) {
- p = (char *) (dash->number > (int)sizeof(char *))
+ p = (dash->number > (int)sizeof(char *))
? dash->pattern.pt : dash->pattern.array;
XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
outline->offset, p, dash->number);
@@ -1445,7 +1445,7 @@ Tk_CanvasPsOutline(
str = (char *)ckalloc((unsigned int) (1 - 8*dash->number));
lptr = (char *)ckalloc((unsigned int) (1 - 2*dash->number));
}
- ptr = (char *) ((ABS(dash->number) > sizeof(char *)) ) ?
+ ptr = (ABS(dash->number) > sizeof(char *)) ?
dash->pattern.pt : dash->pattern.array;
if (dash->number > 0) {
char *ptr0 = ptr;
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 1fe03eb..f573bb2 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvas.c,v 1.44 2007/09/07 00:34:52 dgp Exp $
+ * RCS: @(#) $Id: tkCanvas.c,v 1.45 2007/10/15 07:24:48 das Exp $
*/
/* #define USE_OLD_TAG_SEARCH 1 */
@@ -685,7 +685,8 @@ CanvasWidgetCmd(
if (searchPtr->type == SEARCH_TYPE_ID) {
Tcl_HashEntry *entryPtr;
- entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char *) searchPtr->id);
+ entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
+ (char *) INT2PTR(searchPtr->id));
if (entryPtr != NULL) {
itemPtr = (Tk_Item *) Tcl_GetHashValue(entryPtr);
object = (ClientData) itemPtr;
@@ -990,7 +991,7 @@ CanvasWidgetCmd(
}
itemPtr->nextPtr = NULL;
entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable,
- (char *) itemPtr->id, &isNew);
+ (char *) INT2PTR(itemPtr->id), &isNew);
Tcl_SetHashValue(entryPtr, itemPtr);
itemPtr->prevPtr = canvasPtr->lastItemPtr;
canvasPtr->hotPtr = itemPtr;
@@ -1089,7 +1090,7 @@ CanvasWidgetCmd(
ckfree((char *) itemPtr->tagPtr);
}
entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
- (char *) itemPtr->id);
+ (char *) INT2PTR(itemPtr->id));
Tcl_DeleteHashEntry(entryPtr);
if (itemPtr->nextPtr != NULL) {
itemPtr->nextPtr->prevPtr = itemPtr->prevPtr;
@@ -3626,7 +3627,7 @@ TagSearchFirst(
if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id)
|| (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) {
entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable,
- (char *) searchPtr->id);
+ (char *) INT2PTR(searchPtr->id));
if (entryPtr != NULL) {
itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
lastPtr = itemPtr->prevPtr;
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 2b67017..0b4fe99 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -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: tkCursor.c,v 1.16 2007/09/07 00:34:52 dgp Exp $
+ * RCS: @(#) $Id: tkCursor.c,v 1.17 2007/10/15 07:24:48 das Exp $
*/
#include "tkInt.h"
@@ -421,8 +421,7 @@ Tk_NameOfCursor(
if (!dispPtr->cursorInit) {
printid:
- sprintf(dispPtr->cursorString, "cursor id 0x%x",
- (unsigned int) cursor);
+ sprintf(dispPtr->cursorString, "cursor id %p", cursor);
return dispPtr->cursorString;
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
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:
*/
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index a466d51..a653b86 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -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: tkListbox.c,v 1.42 2007/09/08 16:01:20 dkf Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.43 2007/10/15 07:24:49 das Exp $
*/
#include "default.h"
@@ -723,7 +723,7 @@ ListboxWidgetObjCmd(
*/
for (i = 0; i < listPtr->nElements; i++) {
- if (Tcl_FindHashEntry(listPtr->selection, (char *)i) != NULL) {
+ if (Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i))) {
sprintf(indexStringRep, "%d", i);
Tcl_AppendElement(interp, indexStringRep);
}
@@ -1204,7 +1204,7 @@ ListboxSelectionSubCmd(
}
Tcl_SetObjResult(interp,
Tcl_NewBooleanObj((Tcl_FindHashEntry(listPtr->selection,
- (char *)first) != NULL)));
+ (char *) INT2PTR(first)) != NULL)));
result = TCL_OK;
break;
case SELECTION_SET:
@@ -1388,7 +1388,8 @@ ListboxGetItemAttributes(
Tcl_HashEntry *entry;
ItemAttr *attrs;
- entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, (char *)index, &isNew);
+ entry = Tcl_CreateHashEntry(listPtr->itemAttrTable,
+ (char *) INT2PTR(index), &isNew);
if (isNew) {
attrs = (ItemAttr *) ckalloc(sizeof(ItemAttr));
attrs->border = NULL;
@@ -1916,7 +1917,7 @@ DisplayListbox(
* special foreground/background colors.
*/
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *) INT2PTR(i));
/*
* If the listbox is enabled, items may be drawn differently; they may
@@ -1925,7 +1926,7 @@ DisplayListbox(
*/
if (listPtr->state & STATE_NORMAL) {
- if (Tcl_FindHashEntry(listPtr->selection, (char *)i) != NULL) {
+ if (Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i))) {
/*
* Selected items are drawn differently.
*/
@@ -2008,7 +2009,7 @@ DisplayListbox(
/* Draw bottom bevel */
if (i + 1 == listPtr->nElements ||
Tcl_FindHashEntry(listPtr->selection,
- (char *)(i + 1)) == NULL ) {
+ (char *) INT2PTR(i + 1)) == NULL ) {
Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left,
y + listPtr->lineHeight - listPtr->selBorderWidth,
width+left+right, listPtr->selBorderWidth, 0, 0, 0,
@@ -2445,13 +2446,13 @@ ListboxDeleteSubCmd(
* Remove selection information.
*/
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
listPtr->numSelected--;
Tcl_DeleteHashEntry(entry);
}
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *) INT2PTR(i));
if (entry != NULL) {
ckfree((char *)Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
@@ -3031,7 +3032,7 @@ ListboxSelect(
*/
for (i = first; i <= last; i++) {
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
if (!select) {
Tcl_DeleteHashEntry(entry);
@@ -3042,8 +3043,8 @@ ListboxSelect(
}
} else {
if (select) {
- entry = Tcl_CreateHashEntry(listPtr->selection, (char *)i,
- &isNew);
+ entry = Tcl_CreateHashEntry(listPtr->selection,
+ (char *) INT2PTR(i), &isNew);
Tcl_SetHashValue(entry, (ClientData) NULL);
listPtr->numSelected++;
if (firstRedisplay < 0) {
@@ -3114,7 +3115,7 @@ ListboxFetchSelection(
needNewline = 0;
Tcl_DStringInit(&selection);
for (i = 0; i < listPtr->nElements; i++) {
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
if (needNewline) {
Tcl_DStringAppend(&selection, "\n", 1);
@@ -3430,7 +3431,7 @@ ListboxListVarProc(
* Clean up selection.
*/
- entry = Tcl_FindHashEntry(listPtr->selection, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i));
if (entry != NULL) {
listPtr->numSelected--;
Tcl_DeleteHashEntry(entry);
@@ -3440,7 +3441,8 @@ ListboxListVarProc(
* Clean up attributes.
*/
- entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *)i);
+ entry = Tcl_FindHashEntry(listPtr->itemAttrTable,
+ (char *) INT2PTR(i));
if (entry != NULL) {
ckfree((char *) Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
@@ -3514,23 +3516,23 @@ MigrateHashEntries(
if (offset > 0) {
for (i = last; i >= first; i--) {
- entry = Tcl_FindHashEntry(table, (char *)i);
+ entry = Tcl_FindHashEntry(table, (char *) INT2PTR(i));
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset),
- &isNew);
+ entry = Tcl_CreateHashEntry(table,
+ (char *) INT2PTR(i + offset), &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
} else {
for (i = first; i <= last; i++) {
- entry = Tcl_FindHashEntry(table, (char *)i);
+ entry = Tcl_FindHashEntry(table, (char *) INT2PTR(i));
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset),
- &isNew);
+ entry = Tcl_CreateHashEntry(table,
+ (char *) INT2PTR(i + offset), &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 7910c9f..7186d4d 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkObj.c,v 1.16 2007/01/03 04:10:55 nijtmans Exp $
+ * RCS: @(#) $Id: tkObj.c,v 1.17 2007/10/15 07:24:49 das Exp $
*/
#include "tkInt.h"
@@ -28,11 +28,11 @@ typedef struct PixelRep {
((objPtr)->internalRep.twoPtrValue.ptr2 == 0)
#define SET_SIMPLEPIXEL(objPtr, intval) \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (intval); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = INT2PTR(intval); \
(objPtr)->internalRep.twoPtrValue.ptr2 = 0
#define GET_SIMPLEPIXEL(objPtr) \
- ((int) (objPtr)->internalRep.twoPtrValue.ptr1)
+ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr1))
#define SET_COMPLEXPIXEL(objPtr, repPtr) \
(objPtr)->internalRep.twoPtrValue.ptr1 = 0; \
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index f3d9604..b8e70e5 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStyle.c,v 1.6 2007/01/03 05:06:26 nijtmans Exp $
+ * RCS: @(#) $Id: tkStyle.c,v 1.7 2007/10/15 07:24:49 das Exp $
*/
#include "tkInt.h"
@@ -624,7 +624,7 @@ CreateElement(
entryPtr = Tcl_CreateHashEntry(&tsdPtr->elementTable, name, &newEntry);
if (!newEntry) {
- elementId = (int) Tcl_GetHashValue(entryPtr);
+ elementId = PTR2INT(Tcl_GetHashValue(entryPtr));
if (create) {
tsdPtr->elements[elementId].created = 1;
}
@@ -642,7 +642,7 @@ CreateElement(
}
elementId = tsdPtr->nbElements++;
- Tcl_SetHashValue(entryPtr, (ClientData) elementId);
+ Tcl_SetHashValue(entryPtr, (ClientData) INT2PTR(elementId));
/*
* Reallocate element table.
@@ -705,7 +705,7 @@ Tk_GetElementId(
entryPtr = Tcl_FindHashEntry(&tsdPtr->elementTable, name);
if (entryPtr) {
- return (int) Tcl_GetHashValue(entryPtr);
+ return PTR2INT(Tcl_GetHashValue(entryPtr));
}
/*
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index d363128..ccb4ddb 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextIndex.c,v 1.26 2007/09/07 00:34:54 dgp Exp $
+ * RCS: @(#) $Id: tkTextIndex.c,v 1.27 2007/10/15 07:24:49 das Exp $
*/
#include "default.h"
@@ -61,11 +61,11 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_TEXTINDEX(objPtr) \
((TkTextIndex *) (objPtr)->internalRep.twoPtrValue.ptr1)
#define GET_INDEXEPOCH(objPtr) \
- ((int) (objPtr)->internalRep.twoPtrValue.ptr2)
+ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
((objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
- ((objPtr)->internalRep.twoPtrValue.ptr2 = (VOID *) (epoch))
+ ((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
/*
* Define the 'textindex' object type, which Tk uses to represent indices in
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index b41f4c3..162d7ad 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUtil.c,v 1.19 2007/09/08 16:01:20 dkf Exp $
+ * RCS: @(#) $Id: tkUtil.c,v 1.20 2007/10/15 07:24:49 das Exp $
*/
#include "tkInt.h"
@@ -56,7 +56,7 @@ TkStateParseProc(
int offset) /* Offset into item. */
{
int c;
- int flags = (int)clientData;
+ int flags = PTR2INT(clientData);
size_t length;
register Tk_State *statePtr = (Tk_State *) (widgRec + offset);
@@ -277,7 +277,7 @@ TkOffsetParseProc(
switch(value[0]) {
case '#':
- if (((int)clientData) & TK_OFFSET_RELATIVE) {
+ if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) {
tsoffset.flags = TK_OFFSET_RELATIVE;
p++;
break;
@@ -339,7 +339,7 @@ TkOffsetParseProc(
goto goodTSOffset;
}
if ((q = strchr(p,',')) == NULL) {
- if (((int)clientData) & TK_OFFSET_INDEX) {
+ if (PTR2INT(clientData) & TK_OFFSET_INDEX) {
if (Tcl_GetInt(interp, (char *) p, &tsoffset.flags) != TCL_OK) {
Tcl_ResetResult(interp);
goto badTSOffset;
@@ -373,10 +373,10 @@ TkOffsetParseProc(
badTSOffset:
Tcl_AppendResult(interp, "bad offset \"", value,
"\": expected \"x,y\"", NULL);
- if (((int) clientData) & TK_OFFSET_RELATIVE) {
+ if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) {
Tcl_AppendResult(interp, ", \"#x,y\"", NULL);
}
- if (((int) clientData) & TK_OFFSET_INDEX) {
+ if (PTR2INT(clientData) & TK_OFFSET_INDEX) {
Tcl_AppendResult(interp, ", <index>", NULL);
}
Tcl_AppendResult(interp, ", n, ne, e, se, s, sw, w, nw, or center", NULL);
@@ -938,7 +938,7 @@ TkFindStateNumObj(
if ((keyPtr->typePtr == &tkStateKeyObjType)
&& (keyPtr->internalRep.twoPtrValue.ptr1 == mapPtr)) {
- return (int) keyPtr->internalRep.twoPtrValue.ptr2;
+ return PTR2INT(keyPtr->internalRep.twoPtrValue.ptr2);
}
/*
@@ -953,7 +953,7 @@ TkFindStateNumObj(
(*typePtr->freeIntRepProc)(keyPtr);
}
keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr;
- keyPtr->internalRep.twoPtrValue.ptr2 = (void *) mPtr->numKey;
+ keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey);
keyPtr->typePtr = &tkStateKeyObjType;
return mPtr->numKey;
}
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index 12a471e..1f69a24 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -1,4 +1,4 @@
-/* $Id: ttkTheme.h,v 1.8 2006/12/14 19:51:04 jenglish Exp $
+/* $Id: ttkTheme.h,v 1.9 2007/10/15 07:24:49 das Exp $
* Copyright (c) 2003 Joe English. Freely redistributable.
*
* Declarations for Tk theme engine.
@@ -19,6 +19,28 @@ extern "C" {
# endif
#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#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
+
#define TTKAPI MODULE_SCOPE
/* Ttk syncs to the Tk version & patchlevel */
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 8d36c60..20ca890 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTreeview.c,v 1.16 2007/04/28 01:22:10 jenglish Exp $
+/* $Id: ttkTreeview.c,v 1.17 2007/10/15 07:24:49 das Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -518,7 +518,7 @@ static int ColumnIndex(Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj)
entryPtr = Tcl_FindHashEntry(
&tv->tree.columnNames, Tcl_GetString(columnIDObj));
if (entryPtr) {
- return (int)Tcl_GetHashValue(entryPtr);
+ return PTR2INT(Tcl_GetHashValue(entryPtr));
}
/* Check for number:
@@ -689,7 +689,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv)
Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
&tv->tree.columnNames, Tcl_GetString(columnName), &isNew);
- Tcl_SetHashValue(entryPtr, i);
+ Tcl_SetHashValue(entryPtr, INT2PTR(i));
InitColumn(tv->tree.columns + i);
Tk_InitOptions(