summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-24 20:47:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-10-24 20:47:43 (GMT)
commit58c218ca973bfc0c773e821d360002d93ab85f02 (patch)
treefe664adc8ffceb3d0f3e63390de8f2c1bb37d7d4
parentc7a7046bd0dbb6f570e1d5a5076bb654f1946a23 (diff)
downloadtk-58c218ca973bfc0c773e821d360002d93ab85f02.zip
tk-58c218ca973bfc0c773e821d360002d93ab85f02.tar.gz
tk-58c218ca973bfc0c773e821d360002d93ab85f02.tar.bz2
Some more internal use of TkSizeT (improvement of older code). No longer test for TCL_TYPE_I, since it's not in an accepted TIP yet.
-rw-r--r--generic/tkInt.h14
-rw-r--r--generic/tkMenu.h14
-rw-r--r--generic/tkScale.h6
-rw-r--r--generic/tkUtil.c4
4 files changed, 8 insertions, 30 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 7be0e73..767bbbb 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -500,7 +500,7 @@ typedef struct TkDisplay {
#endif /* TK_USE_INPUT_METHODS */
Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
- size_t refCount; /* Reference count of how many Tk applications
+ TkSizeT refCount; /* Reference count of how many Tk applications
* are using this display. Used to clean up
* the display when we no longer have any Tk
* applications using it. */
@@ -604,7 +604,7 @@ typedef struct TkEventHandler {
*/
typedef struct TkMainInfo {
- size_t refCount; /* Number of windows whose "mainPtr" fields
+ TkSizeT refCount; /* Number of windows whose "mainPtr" fields
* point here. When this becomes zero, can
* free up the structure (the reference count
* is zero because windows can get deleted in
@@ -855,7 +855,7 @@ typedef struct {
* adding), or NULL if that has not been
* computed yet. If non-NULL, this string was
* allocated with ckalloc(). */
- size_t charValueLen; /* Length of string in charValuePtr when that
+ TkSizeT charValueLen; /* Length of string in charValuePtr when that
* is non-NULL. */
KeySym keysym; /* Key symbol computed after input methods
* have been invoked */
@@ -1279,20 +1279,12 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
MODULE_SCOPE size_t TkUniCharToUtf(int, char *);
#endif
-#ifdef TCL_TYPE_I
-/* With TIP #481 available, we don't need to do anything special here */
-#define TkGetStringFromObj(objPtr, lenPtr) \
- Tcl_GetStringFromObj(objPtr, lenPtr)
-#define TkGetByteArrayFromObj(objPtr, lenPtr) \
- Tcl_GetByteArrayFromObj(objPtr, lenPtr)
-#else
#define TkGetStringFromObj(objPtr, lenPtr) \
(((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \
*(lenPtr) = (objPtr)->length, (objPtr)->bytes)
MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr,
size_t *lengthPtr);
-#endif
/*
* Unsupported commands.
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 6e3c3f4..1c02d4b 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -68,11 +68,7 @@ typedef struct TkMenuEntry {
Tk_OptionTable optionTable; /* Option table for this menu entry. */
Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if
* no label). */
-#if TK_MAJOR_VERSION > 8
- size_t labelLength; /* Number of non-NULL characters in label. */
-#else
- unsigned int labelLength; /* Number of non-NULL characters in label. */
-#endif
+ TkSizeT labelLength; /* Number of non-NULL characters in label. */
int state; /* State of button for display purposes:
* normal, active, or disabled. */
int underline; /* Value of -underline option: specifies index
@@ -93,11 +89,7 @@ typedef struct TkMenuEntry {
Tcl_Obj *accelPtr; /* Accelerator string displayed at right of
* menu entry. NULL means no such accelerator.
* Malloc'ed. */
-#if TK_MAJOR_VERSION > 8
- size_t accelLength; /* Number of non-NULL characters in
- * accelerator. */
-#else
- unsigned int accelLength; /* Number of non-NULL characters in
+ TkSizeT accelLength; /* Number of non-NULL characters in
* accelerator. */
#endif
int indicatorOn; /* True means draw indicator, false means
@@ -297,7 +289,6 @@ typedef struct TkMenu {
Tcl_Obj *activeBorderWidthPtr;
/* Width of border around active element. */
Tcl_Obj *reliefPtr; /* 3-d effect: TK_RELIEF_RAISED, etc. */
- Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */
Tcl_Obj *fontPtr; /* Text font for menu entries. */
Tcl_Obj *fgPtr; /* Foreground color for entries. */
Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL means
@@ -392,6 +383,7 @@ typedef struct TkMenu {
/* We actually have to allocate these because
* multiple menus get changed during one
* ConfigureMenu call. */
+ Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */
} TkMenu;
/*
diff --git a/generic/tkScale.h b/generic/tkScale.h
index 043d23c..d0be190 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -85,11 +85,7 @@ typedef struct TkScale {
int repeatInterval; /* Interval between autorepeats (in ms). */
char *label; /* Label to display above or to right of
* scale; NULL means don't display a label. */
-#if TK_MAJOR_VERSION > 8
- size_t labelLength; /* Number of non-NULL chars. in label. */
-#else
- unsigned int labelLength; /* Number of non-NULL chars. in label. */
-#endif
+ TkSizeT labelLength; /* Number of non-NULL chars. in label. */
enum state state; /* Values are active, normal, or disabled.
* Value of scale cannot be changed when
* disabled. */
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 56d80bc..6850f47 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1272,7 +1272,6 @@ size_t TkUniCharToUtf(int ch, char *buf)
#endif
-#ifndef TCL_TYPE_I
unsigned char *
TkGetByteArrayFromObj(
Tcl_Obj *objPtr,
@@ -1281,7 +1280,7 @@ TkGetByteArrayFromObj(
int length;
unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, &length);
-#if TK_MAJOR_VERSION > 8
+#if TCL_MAJOR_VERSION > 8
if (sizeof(TCL_HASH_TYPE) > sizeof(int)) {
/* 64-bit and TIP #494 situation: */
*lengthPtr = *(TCL_HASH_TYPE *) objPtr->internalRep.twoPtrValue.ptr1;
@@ -1291,7 +1290,6 @@ TkGetByteArrayFromObj(
*lengthPtr = (size_t) (unsigned) length;
return result;
}
-#endif /* !TCL_TYPE_I */
/*
* Local Variables: