summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-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
-rwxr-xr-xunix/configure272
-rw-r--r--unix/configure.in34
-rw-r--r--unix/tkConfig.h.in12
-rw-r--r--unix/tkUnixMenu.c10
17 files changed, 447 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index fffe924..b518c4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2007-10-15 Daniel Steffen <das@users.sourceforge.net>
+ * 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
+
* macosx/Wish-Common.xcconfig: add 'tktest-X11' target.
* macosx/Wish.xcode/project.pbxproj:
* macosx/Wish.xcode/default.pbxuser:
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(
diff --git a/unix/configure b/unix/configure
index 1c51c1c..876764c 100755
--- a/unix/configure
+++ b/unix/configure
@@ -8490,6 +8490,278 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking for intptr_t" >&5
+echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_intptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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 ((intptr_t *) 0)
+ return 0;
+if (sizeof (intptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_intptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_intptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
+if test $ac_cv_type_intptr_t = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+else
+
+ echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5
+echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6
+if test "${tcl_cv_intptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ for tcl_cv_intptr_t in "int" "long" "long long" none; do
+ if test "$tcl_cv_intptr_t" != none; 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 ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_ok=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_ok=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
+echo "${ECHO_T}$tcl_cv_intptr_t" >&6
+ if test "$tcl_cv_intptr_t" != none; then
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $tcl_cv_intptr_t
+_ACEOF
+
+ fi
+
+fi
+
+echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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 ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+if test $ac_cv_type_uintptr_t = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+else
+
+ echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5
+echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6
+if test "${tcl_cv_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ none; do
+ if test "$tcl_cv_uintptr_t" != none; 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 ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_ok=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_ok=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
+echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
+ if test "$tcl_cv_uintptr_t" != none; then
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $tcl_cv_uintptr_t
+_ACEOF
+
+ fi
+
+fi
+
+
#-------------------------------------------
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
diff --git a/unix/configure.in b/unix/configure.in
index 4b26a99..efdfbb7 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.141 2007/10/15 07:21:53 das Exp $
+# RCS: @(#) $Id: configure.in,v 1.142 2007/10/15 07:24:50 das Exp $
AC_INIT([tk],[8.5])
AC_PREREQ(2.59)
@@ -219,6 +219,38 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
+AC_CHECK_TYPE([intptr_t], [
+ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
+ for tcl_cv_intptr_t in "int" "long" "long long" none; do
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
+ type wide enough to hold a pointer.])
+ fi
+])
+AC_CHECK_TYPE([uintptr_t], [
+ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ none; do
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
+ type wide enough to hold a pointer.])
+ fi
+])
+
#-------------------------------------------
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
index 74c271f..819efff 100644
--- a/unix/tkConfig.h.in
+++ b/unix/tkConfig.h.in
@@ -13,6 +13,9 @@
/* Do we have access to Darwin CoreFoundation.framework? */
#undef HAVE_COREFOUNDATION
+/* Do we have the intptr_t type? */
+#undef HAVE_INTPTR_T
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -79,6 +82,9 @@
/* Is off64_t in <sys/types.h>? */
#undef HAVE_TYPE_OFF64_T
+/* Do we have the uintptr_t type? */
+#undef HAVE_UINTPTR_T
+
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -217,6 +223,9 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
+/* Signed integer type wide enough to hold a pointer. */
+#undef intptr_t
+
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
@@ -232,6 +241,9 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
+/* Unsigned integer type wide enough to hold a pointer. */
+#undef uintptr_t
+
/* Undef unused package specific autoheader defines so that we can
* include both tclConfig.h and tkConfig.h at the same time: */
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index c87d904..5239db5 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.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: tkUnixMenu.c,v 1.17 2007/09/07 00:34:58 dgp Exp $
+ * RCS: @(#) $Id: tkUnixMenu.c,v 1.18 2007/10/15 07:24:50 das Exp $
*/
#include "default.h"
@@ -338,19 +338,19 @@ GetMenuIndicatorGeometry(
*heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- ((65 * mePtr->height) / 100);
+ INT2PTR((65 * mePtr->height) / 100);
} else {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- ((75 * mePtr->height) / 100);
+ INT2PTR((75 * mePtr->height) / 100);
}
} else {
*widthPtr = *heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- ((80 * mePtr->height) / 100);
+ INT2PTR((80 * mePtr->height) / 100);
} else {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- mePtr->height;
+ INT2PTR(mePtr->height);
}
}
} else {