diff options
Diffstat (limited to 'generic')
59 files changed, 475 insertions, 475 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index 2cd7136..16de241 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -105,7 +105,7 @@ declare 18 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 19 { - CONST86 char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, + const char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 20 { @@ -404,7 +404,7 @@ declare 97 { } declare 98 { ClientData Tk_GetImageMasterData(Tcl_Interp *interp, - const char *name, CONST86 Tk_ImageType **typePtrPtr) + const char *name, const Tk_ImageType **typePtrPtr) } declare 99 { Tk_ItemType *Tk_GetItemTypes(void) @@ -744,7 +744,7 @@ declare 194 { void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 195 { - void Tk_FreeConfigOptions(char *recordPtr, Tk_OptionTable optionToken, + void Tk_FreeConfigOptions(void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } declare 196 { @@ -774,11 +774,11 @@ declare 203 { } declare 204 { Tcl_Obj *Tk_GetOptionInfo(Tcl_Interp *interp, - char *recordPtr, Tk_OptionTable optionTable, + void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin) } declare 205 { - Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, char *recordPtr, + Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin) } declare 206 { @@ -802,7 +802,7 @@ declare 210 { int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) } declare 211 { - int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr, + int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } declare 212 { @@ -813,7 +813,7 @@ declare 213 { void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr) } declare 214 { - int Tk_SetOptions(Tcl_Interp *interp, char *recordPtr, + int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr) @@ -1001,22 +1001,22 @@ declare 260 { } declare 261 { void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, - char *recordPtr, Tk_Window tkwin, int width, int height, + void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr) } declare 262 { void Tk_GetElementBox(Tk_Style style, Tk_StyledElement element, - char *recordPtr, Tk_Window tkwin, int x, int y, int width, + void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) } declare 263 { int Tk_GetElementBorderWidth(Tk_Style style, Tk_StyledElement element, - char *recordPtr, Tk_Window tkwin) + void *recordPtr, Tk_Window tkwin) } declare 264 { void Tk_DrawElement(Tk_Style style, Tk_StyledElement element, - char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, + void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state) } diff --git a/generic/tk.h b/generic/tk.h index 412c561..6f1c98a 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -21,9 +21,6 @@ # error Tk 8.7 must be compiled with tcl.h from Tcl 8.6 or better #endif -#ifndef CONST86 -# define CONST86 const -#endif #ifndef EXTERN # define EXTERN extern TCL_STORAGE_CLASS #endif @@ -190,13 +187,14 @@ typedef struct Tk_OptionSpec { const char *defValue; /* Default value for option if not specified * in command line, the option database, or * the system. */ - int objOffset; /* Where in record to store a Tcl_Obj * that +#if TCL_MAJOR_VERSION > 8 + size_t objOffset; /* Where in record to store a Tcl_Obj * that * holds the value of this option, specified * as an offset in bytes from the start of the * record. Use the Tk_Offset macro to generate * values for this. -1 means don't store the * Tcl_Obj in the record. */ - int internalOffset; /* Where in record to store the internal + size_t internalOffset; /* Where in record to store the internal * representation of the value of this option, * such as an int or XColor *. This field is * specified as an offset in bytes from the @@ -204,6 +202,10 @@ typedef struct Tk_OptionSpec { * macro to generate values for it. -1 means * don't store the internal representation in * the record. */ +#else + int objOffset; + int internalOffset; +#endif int flags; /* Any combination of the values defined * below. */ const void *clientData; /* An alternate place to put option-specific @@ -290,7 +292,7 @@ typedef struct Tk_SavedOption { double internalForm; /* The old value of the option, in some * internal representation such as an int or * (XColor *). Valid only if the field - * optionPtr->specPtr->objOffset is < 0. The + * optionPtr->specPtr->objOffset is -1. The * space must be large enough to accommodate a * double, a long, or a pointer; right now it * looks like a double (i.e., 8 bytes) is big @@ -306,11 +308,15 @@ typedef struct Tk_SavedOption { #endif typedef struct Tk_SavedOptions { - char *recordPtr; /* The data structure in which to restore + void *recordPtr; /* The data structure in which to restore * configuration options. */ Tk_Window tkwin; /* Window associated with recordPtr; needed to * restore certain options. */ - int numItems; /* The number of valid items in items field. */ +#if TCL_MAJOR_VERSION > 8 + size_t numItems; /* The number of valid items in items field. */ +#else + int numItems; +#endif Tk_SavedOption items[TK_NUM_SAVED_OPTIONS]; /* Items used to hold old values. */ struct Tk_SavedOptions *nextPtr; @@ -336,7 +342,7 @@ typedef struct Tk_SavedOptions { typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); -typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData, +typedef const char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); typedef struct Tk_CustomOption { @@ -362,19 +368,23 @@ typedef struct Tk_ConfigSpec { int type; /* Type of option, such as TK_CONFIG_COLOR; * see definitions below. Last option in table * must have type TK_CONFIG_END. */ - CONST86 char *argvName; /* Switch used to specify option in argv. NULL + const char *argvName; /* Switch used to specify option in argv. NULL * means this spec is part of a group. */ Tk_Uid dbName; /* Name for option in option database. */ Tk_Uid dbClass; /* Class for option in database. */ Tk_Uid defValue; /* Default value for option if not specified * in command line or database. */ - int offset; /* Where in widget record to store value; use +#if TCL_MAJOR_VERSION > 8 + size_t offset; /* Where in widget record to store value; use * Tk_Offset macro to generate values for * this. */ +#else + int offset; +#endif int specFlags; /* Any combination of the values defined * below; other bits are used internally by * tkConfig.c. */ - CONST86 Tk_CustomOption *customPtr; + const Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a * pointer to info about how to parse and * print the option. Otherwise it is @@ -425,14 +435,14 @@ typedef enum { */ typedef struct { - CONST86 char *key; /* The key string that flags the option in the + const char *key; /* The key string that flags the option in the * argv array. */ int type; /* Indicates option type; see below. */ char *src; /* Value to be used in setting dst; usage * depends on type. */ char *dst; /* Address of value to be modified; usage * depends on type. */ - CONST86 char *help; /* Documentation message describing this + const char *help; /* Documentation message describing this * option. */ } Tk_ArgvInfo; @@ -678,7 +688,7 @@ typedef struct { * request. */ Display *display; /* Display the event was read from. */ Window event; /* Window on which event was requested. */ - Window root; /* Root window that the event occured on. */ + Window root; /* Root window that the event occurred on. */ Window subwindow; /* Child window. */ Time time; /* Milliseconds. */ int x, y; /* Pointer x, y coordinates in event @@ -921,7 +931,7 @@ typedef enum { } Tk_State; typedef struct Tk_SmoothMethod { - CONST86 char *name; + const char *name; int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas, @@ -1049,14 +1059,18 @@ typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr, #ifndef __NO_OLD_CONFIG typedef struct Tk_ItemType { - CONST86 char *name; /* The name of this type of item, such as + const char *name; /* The name of this type of item, such as * "line". */ - int itemSize; /* Total amount of space needed for item's +#if TCL_MAJOR_VERSION > 8 + size_t itemSize; /* Total amount of space needed for item's * record. */ +#else + int itemSize; +#endif Tk_ItemCreateProc *createProc; /* Procedure to create a new item of this * type. */ - CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for + const Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for * this type. Used for returning configuration * info. */ Tk_ItemConfigureProc *configProc; @@ -1177,7 +1191,7 @@ typedef struct Tk_TSOffset { } Tk_TSOffset; /* - * Bit fields in Tk_Offset->flags: + * Bit fields in Tk_TSOffset->flags: */ #define TK_OFFSET_INDEX 1 @@ -1226,8 +1240,8 @@ typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr); #else -typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc, - Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master, +typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, int objc, + Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr); #endif /* USE_OLD_IMAGE */ typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData); @@ -1251,7 +1265,7 @@ typedef int (Tk_ImagePostscriptProc) (ClientData clientData, */ struct Tk_ImageType { - CONST86 char *name; /* Name of image type. */ + const char *name; /* Name of image type. */ Tk_ImageCreateProc *createProc; /* Procedure to call to create a new image of * this type. */ @@ -1363,7 +1377,7 @@ typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, */ struct Tk_PhotoImageFormat { - CONST86 char *name; /* Name of image file format */ + const char *name; /* Name of image file format */ Tk_ImageFileMatchProc *fileMatchProc; /* Procedure to call to determine whether an * image file matches this format. */ @@ -1534,7 +1548,7 @@ typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp, - CONST86 char *portion); + const char *portion); typedef void (Tk_LostSelProc) (ClientData clientData); typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData, XEvent *eventPtr); diff --git a/generic/tk3d.h b/generic/tk3d.h index 891e927..f574de7 100644 --- a/generic/tk3d.h +++ b/generic/tk3d.h @@ -28,7 +28,7 @@ typedef struct TkBorder { * the border will be used. */ Colormap colormap; /* Colormap out of which pixels are * allocated. */ - int resourceRefCount; /* Number of active uses of this color (each + TkSizeT resourceRefCount; /* Number of active uses of this color (each * active use corresponds to a call to * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder). * If this count is 0, then this structure is @@ -37,7 +37,7 @@ typedef struct TkBorder { * because there are objects referring to it. * The structure is freed when objRefCount and * resourceRefCount are both 0. */ - int objRefCount; /* The number of Tcl objects that reference + TkSizeT objRefCount; /* The number of Tcl objects that reference * this structure. */ XColor *bgColorPtr; /* Background color (intensity between * lightColorPtr and darkColorPtr). */ diff --git a/generic/tkAtom.c b/generic/tkAtom.c index 2491fb2..ddfa97f 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -156,7 +156,7 @@ Tk_GetAtomName( } name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); - Tcl_SetHashValue(hPtr, name); + Tcl_SetHashValue(hPtr, (char *)name); } return Tcl_GetHashValue(hPtr); } @@ -202,7 +202,7 @@ AtomInit( Tcl_SetHashValue(hPtr, INT2PTR(atom)); name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); - Tcl_SetHashValue(hPtr, name); + Tcl_SetHashValue(hPtr, (char *)name); } } diff --git a/generic/tkBind.c b/generic/tkBind.c index 05966d1..a1511a6 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -687,11 +687,11 @@ TkBindInit( Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->name != NULL; kPtr++) { hPtr = Tcl_CreateHashEntry(&keySymTable, kPtr->name, &newEntry); - Tcl_SetHashValue(hPtr, kPtr->value); - hPtr = Tcl_CreateHashEntry(&nameTable, (char *) kPtr->value, + Tcl_SetHashValue(hPtr, INT2PTR(kPtr->value)); + hPtr = Tcl_CreateHashEntry(&nameTable, INT2PTR(kPtr->value), &newEntry); if (newEntry) { - Tcl_SetHashValue(hPtr, kPtr->name); + Tcl_SetHashValue(hPtr, (char *) kPtr->name); } } #endif /* REDO_KEYSYM_LOOKUP */ @@ -699,13 +699,13 @@ TkBindInit( Tcl_InitHashTable(&modTable, TCL_STRING_KEYS); for (modPtr = modArray; modPtr->name != NULL; modPtr++) { hPtr = Tcl_CreateHashEntry(&modTable, modPtr->name, &newEntry); - Tcl_SetHashValue(hPtr, modPtr); + Tcl_SetHashValue(hPtr, (ModInfo *) modPtr); } Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS); for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) { hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &newEntry); - Tcl_SetHashValue(hPtr, eiPtr); + Tcl_SetHashValue(hPtr, (EventInfo *) eiPtr); } initialized = 1; } @@ -2505,7 +2505,7 @@ DeleteVirtualEventTable( * already defined, the new definition augments those that already exist. * * Results: - * The return value is TCL_ERROR if an error occured while creating the + * The return value is TCL_ERROR if an error occurred while creating the * virtual binding. In this case, an error message will be left in the * interp's result. If all went well then the return value is TCL_OK. * diff --git a/generic/tkBusy.c b/generic/tkBusy.c index aabf7a4..8b8db66 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -571,7 +571,7 @@ CreateBusy( busyPtr->cursor = None; Tk_SetClass(tkBusy, "Busy"); busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs); - if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable, + if (Tk_InitOptions(interp, busyPtr, busyPtr->optionTable, tkBusy) != TCL_OK) { Tk_DestroyWindow(tkBusy); return NULL; @@ -638,7 +638,7 @@ ConfigureBusy( { Tk_Cursor oldCursor = busyPtr->cursor; - if (Tk_SetOptions(interp, (char *) busyPtr, busyPtr->optionTable, objc, + if (Tk_SetOptions(interp, busyPtr, busyPtr->optionTable, objc, objv, busyPtr->tkBusy, NULL, NULL) != TCL_OK) { return TCL_ERROR; } @@ -850,7 +850,7 @@ Tk_BusyObjCmd( return TCL_ERROR; } Tcl_Preserve(busyPtr); - objPtr = Tk_GetOptionValue(interp, (char *) busyPtr, + objPtr = Tk_GetOptionValue(interp, busyPtr, busyPtr->optionTable, objv[3], busyPtr->tkBusy); if (objPtr == NULL) { result = TCL_ERROR; @@ -871,7 +871,7 @@ Tk_BusyObjCmd( } Tcl_Preserve(busyPtr); if (objc <= 4) { - objPtr = Tk_GetOptionInfo(interp, (char *) busyPtr, + objPtr = Tk_GetOptionInfo(interp, busyPtr, busyPtr->optionTable, (objc == 4) ? objv[3] : NULL, busyPtr->tkBusy); if (objPtr == NULL) { diff --git a/generic/tkButton.c b/generic/tkButton.c index fc2c7ec..ddc267d 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -749,7 +749,7 @@ ButtonCreate( ExposureMask|StructureNotifyMask|FocusChangeMask, ButtonEventProc, butPtr); - if (Tk_InitOptions(interp, (char *) butPtr, optionTable, tkwin) + if (Tk_InitOptions(interp, butPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(butPtr->tkwin); return TCL_ERROR; @@ -810,7 +810,7 @@ ButtonWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } - objPtr = Tk_GetOptionValue(interp, (char *) butPtr, + objPtr = Tk_GetOptionValue(interp, butPtr, butPtr->optionTable, objv[2], butPtr->tkwin); if (objPtr == NULL) { goto error; @@ -820,7 +820,7 @@ ButtonWidgetObjCmd( case COMMAND_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) butPtr, + objPtr = Tk_GetOptionInfo(interp, butPtr, butPtr->optionTable, (objc == 3) ? objv[2] : NULL, butPtr->tkwin); if (objPtr == NULL) { @@ -1068,7 +1068,7 @@ ConfigureButton( * First pass: set options to new values. */ - if (Tk_SetOptions(interp, (char *) butPtr, + if (Tk_SetOptions(interp, butPtr, butPtr->optionTable, objc, objv, butPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; diff --git a/generic/tkColor.c b/generic/tkColor.c index 9abb448..9d5e157 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -480,8 +480,7 @@ Tk_FreeColor( Tcl_Panic("Tk_FreeColor called with bogus color"); } - tkColPtr->resourceRefCount--; - if (tkColPtr->resourceRefCount > 0) { + if (tkColPtr->resourceRefCount-- > 1) { return; } @@ -587,8 +586,7 @@ FreeColorObj( TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { - tkColPtr->objRefCount--; - if ((tkColPtr->objRefCount == 0) + if ((tkColPtr->objRefCount-- <= 1) && (tkColPtr->resourceRefCount == 0)) { ckfree(tkColPtr); } @@ -820,9 +818,9 @@ TkDebugColor( Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(tkColPtr->resourceRefCount)); + Tcl_NewWideIntObj(tkColPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(tkColPtr->objRefCount)); + Tcl_NewWideIntObj(tkColPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkColor.h b/generic/tkColor.h index 05ef295..d5bde9d 100644 --- a/generic/tkColor.h +++ b/generic/tkColor.h @@ -38,7 +38,7 @@ typedef struct TkColor { Colormap colormap; /* Colormap from which this entry was * allocated. */ Visual *visual; /* Visual associated with colormap. */ - int resourceRefCount; /* Number of active uses of this color (each + TkSizeT resourceRefCount; /* Number of active uses of this color (each * active use corresponds to a call to * Tk_AllocColorFromObj or Tk_GetColor). If * this count is 0, then this TkColor @@ -48,7 +48,7 @@ typedef struct TkColor { * referring to it. The structure is freed * when resourceRefCount and objRefCount are * both 0. */ - int objRefCount; /* The number of Tcl objects that reference + TkSizeT objRefCount; /* The number of Tcl objects that reference * this structure. */ int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */ Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 4e90fab..46300d3 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -115,14 +115,14 @@ typedef struct OptionTable { * Forward declarations for functions defined later in this file: */ -static int DoObjConfig(Tcl_Interp *interp, char *recordPtr, +static int DoObjConfig(Tcl_Interp *interp, void *recordPtr, Option *optionPtr, Tcl_Obj *valuePtr, Tk_Window tkwin, Tk_SavedOption *savePtr); static void FreeResources(Option *optionPtr, Tcl_Obj *objPtr, - char *internalPtr, Tk_Window tkwin); -static Tcl_Obj * GetConfigList(char *recordPtr, + void *internalPtr, Tk_Window tkwin); +static Tcl_Obj * GetConfigList(void *recordPtr, Option *optionPtr, Tk_Window tkwin); -static Tcl_Obj * GetObjectForOption(char *recordPtr, +static Tcl_Obj * GetObjectForOption(void *recordPtr, Option *optionPtr, Tk_Window tkwin); static Option * GetOption(const char *name, OptionTable *tablePtr); static Option * GetOptionFromObj(Tcl_Interp *interp, @@ -279,7 +279,7 @@ Tk_CreateOptionTable( } } if (((specPtr->type == TK_OPTION_STRING) - && (specPtr->internalOffset >= 0)) + && (specPtr->internalOffset != TCL_AUTO_LENGTH)) || (specPtr->type == TK_OPTION_COLOR) || (specPtr->type == TK_OPTION_FONT) || (specPtr->type == TK_OPTION_BITMAP) @@ -381,7 +381,7 @@ int Tk_InitOptions( Tcl_Interp *interp, /* Interpreter for error reporting. NULL means * don't leave an error message. */ - char *recordPtr, /* Pointer to the record to configure. Note: + void *recordPtr, /* Pointer to the record to configure. Note: * the caller should have properly initialized * the record with NULL pointers for each * option value. */ @@ -552,7 +552,7 @@ DoObjConfig( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no message is left if an error * occurs. */ - char *recordPtr, /* The record to modify to hold the new option + void *recordPtr, /* The record to modify to hold the new option * value. */ Option *optionPtr, /* Pointer to information about the option. */ Tcl_Obj *valuePtr, /* New value for option. */ @@ -568,10 +568,10 @@ DoObjConfig( * free the old value). */ { Tcl_Obj **slotPtrPtr, *oldPtr; - char *internalPtr; /* Points to location in record where internal + void *internalPtr; /* Points to location in record where internal * representation of value should be stored, * or NULL. */ - char *oldInternalPtr; /* Points to location in which to save old + void *oldInternalPtr; /* Points to location in which to save old * internal representation of value. */ Tk_SavedOption internal; /* Used to save the old internal * representation of the value if @@ -584,8 +584,8 @@ DoObjConfig( */ specPtr = optionPtr->specPtr; - if (specPtr->objOffset >= 0) { - slotPtrPtr = (Tcl_Obj **) (recordPtr + specPtr->objOffset); + if (specPtr->objOffset != TCL_AUTO_LENGTH) { + slotPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset); oldPtr = *slotPtrPtr; } else { slotPtrPtr = NULL; @@ -597,8 +597,8 @@ DoObjConfig( * object and internal forms, if they exist. */ - if (specPtr->internalOffset >= 0) { - internalPtr = recordPtr + specPtr->internalOffset; + if (specPtr->internalOffset != TCL_AUTO_LENGTH) { + internalPtr = (char *)recordPtr + specPtr->internalOffset; } else { internalPtr = NULL; } @@ -1222,7 +1222,7 @@ int Tk_SetOptions( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is returned.*/ - char *recordPtr, /* The record to configure. */ + void *recordPtr, /* The record to configure. */ Tk_OptionTable optionTable, /* Describes valid options. */ int objc, /* The number of elements in objv. */ Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */ @@ -1340,12 +1340,12 @@ Tk_RestoreSavedOptions( Tk_SavedOptions *savePtr) /* Holds saved option information; must have * been passed to Tk_SetOptions. */ { - int i; + size_t i; Option *optionPtr; Tcl_Obj *newPtr; /* New object value of option, which we * replace with old value and free. Taken from * record. */ - char *internalPtr; /* Points to internal value of option in + void *internalPtr; /* Points to internal value of option in * record. */ const Tk_OptionSpec *specPtr; @@ -1360,7 +1360,7 @@ Tk_RestoreSavedOptions( ckfree(savePtr->nextPtr); savePtr->nextPtr = NULL; } - for (i = savePtr->numItems - 1; i >= 0; i--) { + for (i = savePtr->numItems - 1; i != (size_t)-1; i--) { optionPtr = savePtr->items[i].optionPtr; specPtr = optionPtr->specPtr; @@ -1369,13 +1369,13 @@ Tk_RestoreSavedOptions( * record. */ - if (specPtr->objOffset >= 0) { - newPtr = *((Tcl_Obj **) (savePtr->recordPtr + specPtr->objOffset)); + if (specPtr->objOffset != TCL_AUTO_LENGTH) { + newPtr = *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset)); } else { newPtr = NULL; } - if (specPtr->internalOffset >= 0) { - internalPtr = savePtr->recordPtr + specPtr->internalOffset; + if (specPtr->internalOffset != TCL_AUTO_LENGTH) { + internalPtr = (char *)savePtr->recordPtr + specPtr->internalOffset; } else { internalPtr = NULL; } @@ -1390,11 +1390,11 @@ Tk_RestoreSavedOptions( * Now restore the old value of the option. */ - if (specPtr->objOffset >= 0) { - *((Tcl_Obj **) (savePtr->recordPtr + specPtr->objOffset)) + if (specPtr->objOffset != TCL_AUTO_LENGTH) { + *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset)) = savePtr->items[i].valuePtr; } - if (specPtr->internalOffset >= 0) { + if (specPtr->internalOffset != TCL_AUTO_LENGTH) { register char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); @@ -1487,7 +1487,7 @@ Tk_FreeSavedOptions( Tk_SavedOptions *savePtr) /* Contains options saved in a previous call * to Tk_SetOptions. */ { - int count; + size_t count; Tk_SavedOption *savedOptionPtr; if (savePtr->nextPtr != NULL) { @@ -1527,7 +1527,7 @@ Tk_FreeSavedOptions( /* ARGSUSED */ void Tk_FreeConfigOptions( - char *recordPtr, /* Record whose fields contain current values + void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes legal options. */ Tk_Window tkwin) /* Window associated with recordPtr; needed @@ -1537,7 +1537,7 @@ Tk_FreeConfigOptions( Option *optionPtr; size_t count; Tcl_Obj **oldPtrPtr, *oldPtr; - char *oldInternalPtr; + void *oldInternalPtr; const Tk_OptionSpec *specPtr; for (tablePtr = (OptionTable *) optionTable; tablePtr != NULL; @@ -1548,15 +1548,15 @@ Tk_FreeConfigOptions( if (specPtr->type == TK_OPTION_SYNONYM) { continue; } - if (specPtr->objOffset >= 0) { - oldPtrPtr = (Tcl_Obj **) (recordPtr + specPtr->objOffset); + if (specPtr->objOffset != TCL_AUTO_LENGTH) { + oldPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset); oldPtr = *oldPtrPtr; *oldPtrPtr = NULL; } else { oldPtr = NULL; } - if (specPtr->internalOffset >= 0) { - oldInternalPtr = recordPtr + specPtr->internalOffset; + if (specPtr->internalOffset != TCL_AUTO_LENGTH) { + oldInternalPtr = (char *)recordPtr + specPtr->internalOffset; } else { oldInternalPtr = NULL; } @@ -1593,10 +1593,10 @@ FreeResources( Option *optionPtr, /* Description of the configuration option. */ Tcl_Obj *objPtr, /* The current value of the option, specified * as an object. */ - char *internalPtr, /* A pointer to an internal representation for + void *internalPtr, /* A pointer to an internal representation for * the option's value, such as an int or * (XColor *). Only valid if - * optionPtr->specPtr->internalOffset >= 0. */ + * optionPtr->specPtr->internalOffset != -1. */ Tk_Window tkwin) /* The window in which this option is used. */ { int internalFormExists; @@ -1607,7 +1607,7 @@ FreeResources( * form, then use the object form. */ - internalFormExists = optionPtr->specPtr->internalOffset >= 0; + internalFormExists = optionPtr->specPtr->internalOffset != TCL_AUTO_LENGTH; switch (optionPtr->specPtr->type) { case TK_OPTION_STRING: if (internalFormExists) { @@ -1713,7 +1713,7 @@ Tcl_Obj * Tk_GetOptionInfo( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is created. */ - char *recordPtr, /* Record whose fields contain current values + void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes all the legal options. */ Tcl_Obj *namePtr, /* If non-NULL, the string value selects a @@ -1781,7 +1781,7 @@ Tk_GetOptionInfo( static Tcl_Obj * GetConfigList( - char *recordPtr, /* Pointer to record holding current values of + void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing a * particular option. */ @@ -1824,8 +1824,8 @@ GetConfigList( } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); - if (optionPtr->specPtr->objOffset >= 0) { - elementPtr = *((Tcl_Obj **) (recordPtr + if (optionPtr->specPtr->objOffset != TCL_AUTO_LENGTH) { + elementPtr = *((Tcl_Obj **) ((char *)recordPtr + optionPtr->specPtr->objOffset)); if (elementPtr == NULL) { elementPtr = Tcl_NewObj(); @@ -1859,7 +1859,7 @@ GetConfigList( static Tcl_Obj * GetObjectForOption( - char *recordPtr, /* Pointer to record holding current values of + void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing an option * whose internal value is stored in @@ -1867,10 +1867,10 @@ GetObjectForOption( Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *objPtr; - char *internalPtr; /* Points to internal value of option in + void *internalPtr; /* Points to internal value of option in * record. */ - internalPtr = recordPtr + optionPtr->specPtr->internalOffset; + internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset; objPtr = NULL; switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: @@ -2001,7 +2001,7 @@ Tk_GetOptionValue( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL * then no messages are provided for * errors. */ - char *recordPtr, /* Record whose fields contain current values + void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes legal options. */ Tcl_Obj *namePtr, /* Gives the command-line name for the option @@ -2019,8 +2019,8 @@ Tk_GetOptionValue( if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) { optionPtr = optionPtr->extra.synonymPtr; } - if (optionPtr->specPtr->objOffset >= 0) { - resultPtr = *((Tcl_Obj **) (recordPtr+optionPtr->specPtr->objOffset)); + if (optionPtr->specPtr->objOffset != TCL_AUTO_LENGTH) { + resultPtr = *((Tcl_Obj **) ((char *)recordPtr+optionPtr->specPtr->objOffset)); if (resultPtr == NULL) { /* * This option has a null value and is represented by a null diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 6b2d5f4..e337b37 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -463,8 +463,7 @@ FreeCursor( { TkCursor *prevPtr; - cursorPtr->resourceRefCount--; - if (cursorPtr->resourceRefCount > 0) { + if (cursorPtr->resourceRefCount-- > 1) { return; } @@ -590,8 +589,7 @@ FreeCursorObj( TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { - cursorPtr->objRefCount--; - if ((cursorPtr->objRefCount == 0) + if ((cursorPtr->objRefCount-- <= 1) && (cursorPtr->resourceRefCount == 0)) { ckfree(cursorPtr); } @@ -864,9 +862,9 @@ TkDebugCursor( for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(cursorPtr->resourceRefCount)); + Tcl_NewWideIntObj(cursorPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(cursorPtr->objRefCount)); + Tcl_NewWideIntObj(cursorPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 3b4677e..eb3af95 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -103,7 +103,7 @@ EXTERN int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 19 */ -EXTERN CONST86 char * Tk_CanvasTagsPrintProc(ClientData clientData, +EXTERN const char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 20 */ @@ -357,7 +357,7 @@ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, /* 98 */ EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp, const char *name, - CONST86 Tk_ImageType **typePtrPtr); + const Tk_ImageType **typePtrPtr); /* 99 */ EXTERN Tk_ItemType * Tk_GetItemTypes(void); /* 100 */ @@ -632,7 +632,7 @@ EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin, /* 194 */ EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 195 */ -EXTERN void Tk_FreeConfigOptions(char *recordPtr, +EXTERN void Tk_FreeConfigOptions(void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 196 */ EXTERN void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr); @@ -654,12 +654,12 @@ EXTERN XColor * Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 204 */ -EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, char *recordPtr, +EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ EXTERN Tcl_Obj * Tk_GetOptionValue(Tcl_Interp *interp, - char *recordPtr, Tk_OptionTable optionTable, + void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 206 */ EXTERN int Tk_GetJustifyFromObj(Tcl_Interp *interp, @@ -679,7 +679,7 @@ EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 211 */ -EXTERN int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr, +EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 212 */ EXTERN void Tk_MainEx(int argc, char **argv, @@ -688,7 +688,7 @@ EXTERN void Tk_MainEx(int argc, char **argv, /* 213 */ EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr); /* 214 */ -EXTERN int Tk_SetOptions(Tcl_Interp *interp, char *recordPtr, +EXTERN int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); @@ -832,22 +832,22 @@ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 261 */ EXTERN void Tk_GetElementSize(Tk_Style style, - Tk_StyledElement element, char *recordPtr, + Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 262 */ EXTERN void Tk_GetElementBox(Tk_Style style, - Tk_StyledElement element, char *recordPtr, + Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 263 */ EXTERN int Tk_GetElementBorderWidth(Tk_Style style, - Tk_StyledElement element, char *recordPtr, + Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 264 */ EXTERN void Tk_DrawElement(Tk_Style style, - Tk_StyledElement element, char *recordPtr, + Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 265 */ @@ -909,7 +909,7 @@ typedef struct TkStubs { double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */ void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */ int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 18 */ - CONST86 char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */ + const char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */ Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */ @@ -988,7 +988,7 @@ typedef struct TkStubs { void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */ GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */ Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */ - ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, CONST86 Tk_ImageType **typePtrPtr); /* 98 */ + ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */ Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */ int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */ int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */ @@ -1085,7 +1085,7 @@ typedef struct TkStubs { void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 192 */ void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 193 */ void (*tk_FreeColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */ - void (*tk_FreeConfigOptions) (char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */ + void (*tk_FreeConfigOptions) (void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */ void (*tk_FreeSavedOptions) (Tk_SavedOptions *savePtr); /* 196 */ void (*tk_FreeCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 197 */ void (*tk_FreeFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 198 */ @@ -1094,17 +1094,17 @@ typedef struct TkStubs { Pixmap (*tk_GetBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 201 */ XColor * (*tk_GetColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */ Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ - Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */ - Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ + Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */ + Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */ int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ - int (*tk_InitOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ + int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ void (*tk_MainEx) (int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */ void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */ - int (*tk_SetOptions) (Tcl_Interp *interp, char *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */ + int (*tk_SetOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */ void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */ int (*tk_CreateConsoleWindow) (Tcl_Interp *interp); /* 216 */ void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, const Tk_SmoothMethod *method); /* 217 */ @@ -1151,10 +1151,10 @@ typedef struct TkStubs { Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj *objPtr); /* 258 */ void (*tk_FreeStyleFromObj) (Tcl_Obj *objPtr); /* 259 */ Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 260 */ - void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */ - void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */ - int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin); /* 263 */ - void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, char *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */ + void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */ + void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */ + int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 263 */ + void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */ int (*tk_PhotoExpand) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 265 */ int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */ int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index cf15974..8a69010 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -566,7 +566,7 @@ Tk_EntryObjCmd( Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); - if ((Tk_InitOptions(interp, (char *) entryPtr, optionTable, tkwin) + if ((Tk_InitOptions(interp, entryPtr, optionTable, tkwin) != TCL_OK) || (ConfigureEntry(interp, entryPtr, objc-2, objv+2) != TCL_OK)) { Tk_DestroyWindow(entryPtr->tkwin); @@ -654,7 +654,7 @@ EntryWidgetObjCmd( goto error; } - objPtr = Tk_GetOptionValue(interp, (char *) entryPtr, + objPtr = Tk_GetOptionValue(interp, entryPtr, entryPtr->optionTable, objv[2], entryPtr->tkwin); if (objPtr == NULL) { goto error; @@ -664,7 +664,7 @@ EntryWidgetObjCmd( case COMMAND_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr, + objPtr = Tk_GetOptionInfo(interp, entryPtr, entryPtr->optionTable, (objc == 3) ? objv[2] : NULL, entryPtr->tkwin); @@ -1151,7 +1151,7 @@ ConfigureEntry( * First pass: set options to new values. */ - if (Tk_SetOptions(interp, (char *) entryPtr, + if (Tk_SetOptions(interp, entryPtr, entryPtr->optionTable, objc, objv, entryPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; @@ -2132,9 +2132,7 @@ InsertChars( const char *value) /* New characters to add (NULL-terminated * string). */ { - ptrdiff_t byteIndex; - size_t byteCount, newByteCount; - int oldChars, charsAdded; + size_t byteIndex, byteCount, newByteCount, oldChars, charsAdded; const char *string; char *newStr; @@ -3350,7 +3348,7 @@ EntryValidate( * * Results: * TCL_OK if the validatecommand accepts the new string, TCL_ERROR if any - * problems occured with validatecommand. + * problems occurred with validatecommand. * * Side effects: * The insertion/deletion may be aborted, and the validatecommand might @@ -3407,7 +3405,7 @@ EntryValidateChange( /* * If e->validate has become VALIDATE_NONE during the validation, or we * now have VALIDATE_VAR set (from EntrySetValue) and didn't before, it - * means that a loop condition almost occured. Do not allow this + * means that a loop condition almost occurred. Do not allow this * validation result to finish. */ @@ -3761,7 +3759,7 @@ Tk_SpinboxObjCmd( Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); - if (Tk_InitOptions(interp, (char *) sbPtr, optionTable, tkwin) + if (Tk_InitOptions(interp, sbPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(entryPtr->tkwin); return TCL_ERROR; @@ -3856,7 +3854,7 @@ SpinboxWidgetObjCmd( goto error; } - objPtr = Tk_GetOptionValue(interp, (char *) entryPtr, + objPtr = Tk_GetOptionValue(interp, entryPtr, entryPtr->optionTable, objv[2], entryPtr->tkwin); if (objPtr == NULL) { goto error; @@ -3866,7 +3864,7 @@ SpinboxWidgetObjCmd( case SB_CMD_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr, + objPtr = Tk_GetOptionInfo(interp, entryPtr, entryPtr->optionTable, (objc == 3) ? objv[2] : NULL, entryPtr->tkwin); if (objPtr == NULL) { diff --git a/generic/tkError.c b/generic/tkError.c index 277d7f0..5aa6d88 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -164,11 +164,10 @@ Tk_DeleteErrorHandler( * there are many handlers that stay around forever). */ - dispPtr->deleteCount += 1; - if (dispPtr->deleteCount >= 10) { + if (dispPtr->deleteCount++ >= 9) { TkErrorHandler *prevPtr; TkErrorHandler *nextPtr; - int lastSerial = LastKnownRequestProcessed(dispPtr->display); + unsigned long lastSerial = LastKnownRequestProcessed(dispPtr->display); /* * Last chance to catch errors for this handler: if no event/error @@ -176,7 +175,7 @@ Tk_DeleteErrorHandler( * we need a round trip with the X server now. */ - if (errorPtr->lastRequest > (unsigned long) lastSerial) { + if (errorPtr->lastRequest > lastSerial) { XSync(dispPtr->display, False); } dispPtr->deleteCount = 0; @@ -184,7 +183,7 @@ Tk_DeleteErrorHandler( for (prevPtr = NULL; errorPtr != NULL; errorPtr = nextPtr) { nextPtr = errorPtr->nextPtr; if ((errorPtr->lastRequest != (unsigned long) -1) - && (errorPtr->lastRequest <= (unsigned long) lastSerial)) { + && (errorPtr->lastRequest <= lastSerial)) { if (prevPtr == NULL) { dispPtr->errorPtr = nextPtr; } else { diff --git a/generic/tkFont.c b/generic/tkFont.c index 9f2fa11..c0ff7d0 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1424,8 +1424,7 @@ Tk_FreeFont( if (fontPtr == NULL) { return; } - fontPtr->resourceRefCount--; - if (fontPtr->resourceRefCount > 0) { + if (fontPtr->resourceRefCount-- > 1) { return; } if (fontPtr->namedHashPtr != NULL) { @@ -1522,8 +1521,7 @@ FreeFontObj( TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { - fontPtr->objRefCount--; - if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) { + if ((fontPtr->objRefCount-- <= 1) && (fontPtr->resourceRefCount == 0)) { ckfree(fontPtr); } objPtr->internalRep.twoPtrValue.ptr1 = NULL; @@ -4206,9 +4204,9 @@ TkDebugFont( for ( ; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(fontPtr->resourceRefCount)); + Tcl_NewWideIntObj(fontPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(fontPtr->objRefCount)); + Tcl_NewWideIntObj(fontPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkFont.h b/generic/tkFont.h index de479bf..50f79d2 100644 --- a/generic/tkFont.h +++ b/generic/tkFont.h @@ -85,7 +85,7 @@ typedef struct TkFont { * Fields used and maintained exclusively by generic code. */ - int resourceRefCount; /* Number of active uses of this font (each + TkSizeT resourceRefCount; /* Number of active uses of this font (each * active use corresponds to a call to * Tk_AllocFontFromTable or Tk_GetFont). If * this count is 0, then this TkFont structure @@ -95,7 +95,7 @@ typedef struct TkFont { * The structure is freed when * resourceRefCount and objRefCount are both * 0. */ - int objRefCount; /* The number of Tcl objects that reference + TkSizeT objRefCount; /* The number of Tcl objects that reference * this structure. */ Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure, * used when deleting it. */ diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 1ed3268..53c019c 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -683,7 +683,7 @@ CreateFrame( mask |= ActivateMask; } Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr); - if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin) + if ((Tk_InitOptions(interp, framePtr, optionTable, newWin) != TCL_OK) || (ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) { goto error; @@ -764,7 +764,7 @@ FrameWidgetObjCmd( result = TCL_ERROR; goto done; } - objPtr = Tk_GetOptionValue(interp, (char *) framePtr, + objPtr = Tk_GetOptionValue(interp, framePtr, framePtr->optionTable, objv[2], framePtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; @@ -774,7 +774,7 @@ FrameWidgetObjCmd( break; case FRAME_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) framePtr, + objPtr = Tk_GetOptionInfo(interp, framePtr, framePtr->optionTable, (objc == 3) ? objv[2] : NULL, framePtr->tkwin); if (objPtr == NULL) { @@ -962,7 +962,7 @@ ConfigureFrame( if (framePtr->type == TYPE_LABELFRAME) { oldWindow = labelframePtr->labelWin; } - if (Tk_SetOptions(interp, (char *) framePtr, + if (Tk_SetOptions(interp, framePtr, framePtr->optionTable, objc, objv, framePtr->tkwin, &savedOptions, NULL) != TCL_OK) { if (oldMenuName != NULL) { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index ad36b62..04eecf6 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -99,7 +99,7 @@ declare 21 { const TkStateMap *mapPtr, const char *strKey) } declare 22 { - CONST86 char *TkFindStateString(const TkStateMap *mapPtr, int numKey) + const char *TkFindStateString(const TkStateMap *mapPtr, int numKey) } declare 23 { void TkFocusDeadWindow(TkWindow *winPtr) @@ -182,7 +182,7 @@ declare 45 { void TkInstallFrameMenu(Tk_Window tkwin) } declare 46 { - CONST86 char *TkKeysymToString(KeySym keysym) + const char *TkKeysymToString(KeySym keysym) } declare 47 { int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[]) @@ -389,7 +389,7 @@ declare 108 { Tcl_Obj *objPtr, Tk_Window *windowPtr) } declare 109 { - CONST86 char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) + const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) } declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) @@ -570,7 +570,7 @@ declare 169 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 170 { - CONST86 char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 171 { @@ -578,7 +578,7 @@ declare 171 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 172 { - CONST86 char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 173 { @@ -586,7 +586,7 @@ declare 173 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 174 { - CONST86 char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 175 { @@ -594,7 +594,7 @@ declare 175 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 176 { - CONST86 char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 177 { @@ -602,7 +602,7 @@ declare 177 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 178 { - CONST86 char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 179 { @@ -610,7 +610,7 @@ declare 179 { Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 180 { - CONST86 char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, + const char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } @@ -990,9 +990,9 @@ declare 38 aqua { declare 39 aqua { void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid) } -declare 40 aqua { - void TkSuspendClipboard(void) -} +# +# Slot 40 unused (WAS: TkSuspendClipboard) +# declare 41 aqua { int TkMacOSXZoomToplevel(void *whichWindow, short zoomPart) } diff --git a/generic/tkInt.h b/generic/tkInt.h index 29c69c9..767bbbb 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -58,6 +58,14 @@ # endif #endif +#ifndef TkSizeT +# if TCL_MAJOR_VERSION > 8 +# define TkSizeT size_t +# else +# define TkSizeT int +# 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 @@ -67,22 +75,36 @@ #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)) +# define PTR2INT(p) ((intptr_t)(p)) # else # define INT2PTR(p) ((void*)(p)) -# define PTR2INT(p) ((int)(p)) +# define PTR2INT(p) ((long)(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)) +# define PTR2UINT(p) ((uintptr_t)(p)) # else # define UINT2PTR(p) ((void*)(p)) -# define PTR2UINT(p) ((unsigned int)(p)) +# define PTR2UINT(p) ((unsigned long)(p)) # endif #endif +#ifndef TCL_AUTO_LENGTH +# define TCL_AUTO_LENGTH (-1) +#endif + +#ifndef TCL_Z_MODIFIER +# if defined(_WIN64) +# define TCL_Z_MODIFIER "I" +# elif defined(__GNUC__) && !defined(_WIN32) +# define TCL_Z_MODIFIER "z" +# else +# define TCL_Z_MODIFIER "" +# endif +#endif /* !TCL_Z_MODIFIER */ + /* * Opaque type declarations: */ @@ -106,7 +128,7 @@ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ - int resourceRefCount; /* Number of active uses of this cursor (each + TkSizeT resourceRefCount; /* Number of active uses of this cursor (each * active use corresponds to a call to * Tk_AllocPreserveFromObj or Tk_Preserve). If * this count is 0, then this structure is no @@ -115,7 +137,7 @@ typedef struct TkCursor { * there are objects referring to it. The * structure is freed when resourceRefCount * and objRefCount are both 0. */ - int objRefCount; /* Number of Tcl objects that reference this + TkSizeT objRefCount; /* Number of Tcl objects that reference this * structure.. */ Tcl_HashTable *otherTable; /* Second table (other than idTable) used to * index this entry. */ @@ -265,7 +287,7 @@ typedef struct TkDisplay { /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ - int deleteCount; /* Counts # of handlers deleted since last + TkSizeT deleteCount; /* Counts # of handlers deleted since last * time inactive handlers were garbage- * collected. When this number gets big, * handlers get cleaned up. */ @@ -478,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. */ @@ -582,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 @@ -593,7 +615,11 @@ typedef struct TkMainInfo { Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow * structs for all windows related to this * main window. Managed by tkWindow.c. */ - long deletionEpoch; /* Incremented by window deletions. */ +#if TCL_MAJOR_VERSION > 8 + size_t deletionEpoch; /* Incremented by window deletions. */ +#else + long deletionEpoch; +#endif Tk_BindingTable bindingTable; /* Used in conjunction with "bind" command to * bind events to Tcl commands. */ @@ -829,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 */ @@ -1253,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/tkIntDecls.h b/generic/tkIntDecls.h index 0ffe157..a646779 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -104,7 +104,7 @@ EXTERN int TkFindStateNum(Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 22 */ -EXTERN CONST86 char * TkFindStateString(const TkStateMap *mapPtr, +EXTERN const char * TkFindStateString(const TkStateMap *mapPtr, int numKey); /* 23 */ EXTERN void TkFocusDeadWindow(TkWindow *winPtr); @@ -167,7 +167,7 @@ EXTERN void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr, /* 45 */ EXTERN void TkInstallFrameMenu(Tk_Window tkwin); /* 46 */ -EXTERN CONST86 char * TkKeysymToString(KeySym keysym); +EXTERN const char * TkKeysymToString(KeySym keysym); /* 47 */ EXTERN int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[]); @@ -324,7 +324,7 @@ EXTERN int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 109 */ -EXTERN CONST86 char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, +EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 110 */ EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont); @@ -488,7 +488,7 @@ EXTERN int TkStateParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 170 */ -EXTERN CONST86 char * TkStatePrintProc(ClientData clientData, +EXTERN const char * TkStatePrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 171 */ @@ -496,7 +496,7 @@ EXTERN int TkCanvasDashParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 172 */ -EXTERN CONST86 char * TkCanvasDashPrintProc(ClientData clientData, +EXTERN const char * TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 173 */ @@ -504,7 +504,7 @@ EXTERN int TkOffsetParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 174 */ -EXTERN CONST86 char * TkOffsetPrintProc(ClientData clientData, +EXTERN const char * TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 175 */ @@ -512,7 +512,7 @@ EXTERN int TkPixelParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 176 */ -EXTERN CONST86 char * TkPixelPrintProc(ClientData clientData, +EXTERN const char * TkPixelPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 177 */ @@ -520,7 +520,7 @@ EXTERN int TkOrientParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 178 */ -EXTERN CONST86 char * TkOrientPrintProc(ClientData clientData, +EXTERN const char * TkOrientPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 179 */ @@ -528,7 +528,7 @@ EXTERN int TkSmoothParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 180 */ -EXTERN CONST86 char * TkSmoothPrintProc(ClientData clientData, +EXTERN const char * TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 181 */ @@ -581,7 +581,7 @@ typedef struct TkIntStubs { void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */ void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */ int (*tkFindStateNum) (Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 21 */ - CONST86 char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */ + const char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */ void (*tkFocusDeadWindow) (TkWindow *winPtr); /* 23 */ int (*tkFocusFilterEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 24 */ TkWindow * (*tkFocusKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 25 */ @@ -605,7 +605,7 @@ typedef struct TkIntStubs { void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */ void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */ void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */ - CONST86 char * (*tkKeysymToString) (KeySym keysym); /* 46 */ + const char * (*tkKeysymToString) (KeySym keysym); /* 46 */ int (*tkLineToArea) (double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 47 */ double (*tkLineToPoint) (double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 48 */ int (*tkMakeBezierCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 49 */ @@ -668,7 +668,7 @@ typedef struct TkIntStubs { TkDisplay * (*tkGetDisplayList) (void); /* 106 */ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ - CONST86 char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ + const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */ Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */ void (*tkpMenuThreadInit) (void); /* 112 */ @@ -756,17 +756,17 @@ typedef struct TkIntStubs { int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */ void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */ int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 169 */ - CONST86 char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */ + const char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */ int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 171 */ - CONST86 char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */ + const char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */ int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 173 */ - CONST86 char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */ + const char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */ int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 175 */ - CONST86 char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */ + const char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */ int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 177 */ - CONST86 char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */ + const char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 179 */ - CONST86 char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */ + const char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */ void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index e80b3e4..9bc76c0 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -224,8 +224,7 @@ EXTERN void TkMacOSXWindowOffset(void *wRef, int *xOffset, EXTERN int TkSetMacColor(unsigned long pixel, void *macColor); /* 39 */ EXTERN void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid); -/* 40 */ -EXTERN void TkSuspendClipboard(void); +/* Slot 40 is reserved */ /* 41 */ EXTERN int TkMacOSXZoomToplevel(void *whichWindow, short zoomPart); @@ -384,7 +383,7 @@ typedef struct TkIntPlatStubs { void (*tkMacOSXWindowOffset) (void *wRef, int *xOffset, int *yOffset); /* 37 */ int (*tkSetMacColor) (unsigned long pixel, void *macColor); /* 38 */ void (*tkSetWMName) (TkWindow *winPtr, Tk_Uid titleUid); /* 39 */ - void (*tkSuspendClipboard) (void); /* 40 */ + void (*reserved40)(void); int (*tkMacOSXZoomToplevel) (void *whichWindow, short zoomPart); /* 41 */ Tk_Window (*tk_TopCoordsToWindow) (Tk_Window tkwin, int rootX, int rootY, int *newX, int *newY); /* 42 */ MacDrawable * (*tkMacOSXContainerId) (TkWindow *winPtr); /* 43 */ @@ -599,8 +598,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkSetMacColor) /* 38 */ #define TkSetWMName \ (tkIntPlatStubsPtr->tkSetWMName) /* 39 */ -#define TkSuspendClipboard \ - (tkIntPlatStubsPtr->tkSuspendClipboard) /* 40 */ +/* Slot 40 is reserved */ #define TkMacOSXZoomToplevel \ (tkIntPlatStubsPtr->tkMacOSXZoomToplevel) /* 41 */ #define Tk_TopCoordsToWindow \ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6cbf224..b3b8ce7 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -567,7 +567,7 @@ Tk_ListboxObjCmd( ListboxEventProc, listPtr); Tk_CreateSelHandler(listPtr->tkwin, XA_PRIMARY, XA_STRING, ListboxFetchSelection, listPtr, XA_STRING); - if (Tk_InitOptions(interp, (char *)listPtr, + if (Tk_InitOptions(interp, listPtr, optionTables->listboxOptionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(listPtr->tkwin); return TCL_ERROR; @@ -682,7 +682,7 @@ ListboxWidgetObjCmd( break; } - objPtr = Tk_GetOptionValue(interp, (char *) listPtr, + objPtr = Tk_GetOptionValue(interp, listPtr, listPtr->optionTable, objv[2], listPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; @@ -694,7 +694,7 @@ ListboxWidgetObjCmd( case COMMAND_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) listPtr, + objPtr = Tk_GetOptionInfo(interp, listPtr, listPtr->optionTable, (objc == 3) ? objv[2] : NULL, listPtr->tkwin); if (objPtr == NULL) { @@ -926,7 +926,7 @@ ListboxWidgetObjCmd( attrPtr = ListboxGetItemAttributes(interp, listPtr, index); if (objc <= 4) { - objPtr = Tk_GetOptionInfo(interp, (char *) attrPtr, + objPtr = Tk_GetOptionInfo(interp, attrPtr, listPtr->itemAttrOptionTable, (objc == 4) ? objv[3] : NULL, listPtr->tkwin); if (objPtr == NULL) { @@ -1416,7 +1416,7 @@ ListboxGetItemAttributes( attrs->selBorder = NULL; attrs->fgColor = NULL; attrs->selFgColor = NULL; - Tk_InitOptions(interp, (char *)attrs, listPtr->itemAttrOptionTable, + Tk_InitOptions(interp, attrs, listPtr->itemAttrOptionTable, listPtr->tkwin); Tcl_SetHashValue(entry, attrs); } else { @@ -1579,7 +1579,7 @@ ConfigureListbox( * First pass: set options to new values. */ - if (Tk_SetOptions(interp, (char *) listPtr, + if (Tk_SetOptions(interp, listPtr, listPtr->optionTable, objc, objv, listPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; @@ -1725,7 +1725,7 @@ ConfigureListboxItem( { Tk_SavedOptions savedOptions; - if (Tk_SetOptions(interp, (char *)attrs, + if (Tk_SetOptions(interp, attrs, listPtr->itemAttrOptionTable, objc, objv, listPtr->tkwin, &savedOptions, NULL) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); @@ -3166,14 +3166,14 @@ ListboxFetchSelection( * Copy the requested portion of the selection to the buffer. */ - count = length - offset; - if (count <= 0) { + if (length <= (size_t)offset) { count = 0; } else { + count = length - offset; if (count > maxBytes) { count = maxBytes; } - memcpy(buffer, Tcl_DStringValue(&selection) + offset, (size_t) count); + memcpy(buffer, Tcl_DStringValue(&selection) + offset, count); } buffer[count] = '\0'; Tcl_DStringFree(&selection); diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 7441ca2..14d89cd 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -259,6 +259,9 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = { "Background", DEF_MENU_ACTIVE_FG_COLOR, Tk_Offset(TkMenu, activeFgPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_FG_MONO, 0}, + {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", + DEF_MENU_ACTIVE_RELIEF, Tk_Offset(TkMenu, activeReliefPtr), + -1, 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENU_BG_COLOR, Tk_Offset(TkMenu, borderPtr), -1, 0, (ClientData) DEF_MENU_BG_MONO, 0}, @@ -465,7 +468,7 @@ Tk_MenuObjCmd( Tk_CreateEventHandler(newWin, ExposureMask|StructureNotifyMask|ActivateMask, TkMenuEventProc, menuPtr); - if (Tk_InitOptions(interp, (char *) menuPtr, + if (Tk_InitOptions(interp, menuPtr, tsdPtr->menuOptionTable, menuPtr->tkwin) != TCL_OK) { Tk_DestroyWindow(menuPtr->tkwin); @@ -672,7 +675,7 @@ MenuWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } - resultPtr = Tk_GetOptionValue(interp, (char *) menuPtr, + resultPtr = Tk_GetOptionValue(interp, menuPtr, tsdPtr->menuOptionTable, objv[2], menuPtr->tkwin); if (resultPtr == NULL) { @@ -692,7 +695,7 @@ MenuWidgetObjCmd( Tcl_Obj *resultPtr; if (objc == 2) { - resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr, + resultPtr = Tk_GetOptionInfo(interp, menuPtr, tsdPtr->menuOptionTable, NULL, menuPtr->tkwin); if (resultPtr == NULL) { @@ -702,7 +705,7 @@ MenuWidgetObjCmd( Tcl_SetObjResult(interp, resultPtr); } } else if (objc == 3) { - resultPtr = Tk_GetOptionInfo(interp, (char *) menuPtr, + resultPtr = Tk_GetOptionInfo(interp, menuPtr, tsdPtr->menuOptionTable, objv[2], menuPtr->tkwin); if (resultPtr == NULL) { @@ -776,7 +779,7 @@ MenuWidgetObjCmd( } mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); - resultPtr = Tk_GetOptionValue(interp, (char *) mePtr, + resultPtr = Tk_GetOptionValue(interp, mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); Tcl_Release(mePtr); if (resultPtr == NULL) { @@ -802,7 +805,7 @@ MenuWidgetObjCmd( mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); if (objc == 3) { - resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr, + resultPtr = Tk_GetOptionInfo(interp, mePtr, mePtr->optionTable, NULL, menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; @@ -811,7 +814,7 @@ MenuWidgetObjCmd( Tcl_SetObjResult(interp, resultPtr); } } else if (objc == 4) { - resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr, + resultPtr = Tk_GetOptionInfo(interp, mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; @@ -1528,7 +1531,7 @@ ConfigureMenu( for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions)); - result = Tk_SetOptions(interp, (char *) menuListPtr, + result = Tk_SetOptions(interp, menuListPtr, tsdPtr->menuOptionTable, objc, objv, menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL); if (result != TCL_OK) { @@ -1924,7 +1927,7 @@ ConfigureMenuEntry( result = TCL_OK; if (menuPtr->tkwin != NULL) { - if (Tk_SetOptions(menuPtr->interp, (char *) mePtr, + if (Tk_SetOptions(menuPtr->interp, mePtr, mePtr->optionTable, objc, objv, menuPtr->tkwin, &errorStruct, NULL) != TCL_OK) { return TCL_ERROR; @@ -2298,7 +2301,7 @@ MenuNewEntry( mePtr->entryFlags = 0; mePtr->index = index; mePtr->nextCascadePtr = NULL; - if (Tk_InitOptions(menuPtr->interp, (char *) mePtr, + if (Tk_InitOptions(menuPtr->interp, mePtr, mePtr->optionTable, menuPtr->tkwin) != TCL_OK) { ckfree(mePtr); return NULL; diff --git a/generic/tkMenu.h b/generic/tkMenu.h index b4269a5..6d51a72 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,13 +89,8 @@ 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 * don't draw it. This field is ignored unless * the entry is a radio or check button. */ @@ -391,6 +382,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/tkMenuDraw.c b/generic/tkMenuDraw.c index 1abe1c4..3f492db 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -624,7 +624,6 @@ DisplayMenu( int width; int borderWidth; Tk_3DBorder border; - int activeBorderWidth; int relief; @@ -636,8 +635,6 @@ DisplayMenu( Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, - menuPtr->activeBorderWidthPtr, &activeBorderWidth); if (menuPtr->menuType == MENUBAR) { Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, borderWidth, @@ -668,28 +665,16 @@ DisplayMenu( } mePtr->entryFlags &= ~ENTRY_NEEDS_REDISPLAY; - if (menuPtr->menuType == MENUBAR) { - width = mePtr->width; - } else { - if (mePtr->entryFlags & ENTRY_LAST_COLUMN) { - width = Tk_Width(menuPtr->tkwin) - mePtr->x - - activeBorderWidth; - } else { - width = mePtr->width + borderWidth; - } - } TkpDrawMenuEntry(mePtr, Tk_WindowId(menuPtr->tkwin), tkfont, - &menuMetrics, mePtr->x, mePtr->y, width, + &menuMetrics, mePtr->x, mePtr->y, mePtr->width, mePtr->height, strictMotif, 1); if ((index > 0) && (menuPtr->menuType != MENUBAR) && mePtr->columnBreak) { mePtr = menuPtr->entries[index - 1]; Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, - mePtr->x, mePtr->y + mePtr->height, - mePtr->width, - Tk_Height(tkwin) - mePtr->y - mePtr->height - - activeBorderWidth, 0, - TK_RELIEF_FLAT); + mePtr->x, mePtr->y + mePtr->height, mePtr->width, + Tk_Height(tkwin) - mePtr->y - mePtr->height - borderWidth, + 0, TK_RELIEF_FLAT); } } @@ -698,19 +683,18 @@ DisplayMenu( if (menuPtr->numEntries == 0) { x = y = borderWidth; - width = Tk_Width(tkwin) - 2 * activeBorderWidth; - height = Tk_Height(tkwin) - 2 * activeBorderWidth; + width = Tk_Width(tkwin) - 2 * borderWidth; + height = Tk_Height(tkwin) - 2 * borderWidth; } else { mePtr = menuPtr->entries[menuPtr->numEntries - 1]; Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, mePtr->x, mePtr->y + mePtr->height, mePtr->width, - Tk_Height(tkwin) - mePtr->y - mePtr->height - - activeBorderWidth, 0, - TK_RELIEF_FLAT); + Tk_Height(tkwin) - mePtr->y - mePtr->height - borderWidth, + 0, TK_RELIEF_FLAT); x = mePtr->x + mePtr->width; y = mePtr->y + mePtr->height; - width = Tk_Width(tkwin) - x - activeBorderWidth; - height = Tk_Height(tkwin) - y - activeBorderWidth; + width = Tk_Width(tkwin) - x - borderWidth; + height = Tk_Height(tkwin) - y - borderWidth; } Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y, width, height, 0, TK_RELIEF_FLAT); diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 2c1676c..125fe72 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -308,7 +308,7 @@ Tk_MenubuttonObjCmd( ExposureMask|StructureNotifyMask|FocusChangeMask, MenuButtonEventProc, mbPtr); - if (Tk_InitOptions(interp, (char *) mbPtr, optionTable, tkwin) != TCL_OK) { + if (Tk_InitOptions(interp, mbPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(mbPtr->tkwin); return TCL_ERROR; } @@ -369,7 +369,7 @@ MenuButtonWidgetObjCmd( goto error; } - objPtr = Tk_GetOptionValue(interp, (char *) mbPtr, + objPtr = Tk_GetOptionValue(interp, mbPtr, mbPtr->optionTable, objv[2], mbPtr->tkwin); if (objPtr == NULL) { goto error; @@ -379,7 +379,7 @@ MenuButtonWidgetObjCmd( case COMMAND_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) mbPtr, + objPtr = Tk_GetOptionInfo(interp, mbPtr, mbPtr->optionTable, (objc == 3) ? objv[2] : NULL, mbPtr->tkwin); if (objPtr == NULL) { @@ -524,7 +524,7 @@ ConfigureMenuButton( * First pass: set options to new values. */ - if (Tk_SetOptions(interp, (char *) mbPtr, + if (Tk_SetOptions(interp, mbPtr, mbPtr->optionTable, objc, objv, mbPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 74b62b1..c009fe7 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -242,7 +242,7 @@ Tk_MessageObjCmd( optionTable = Tk_CreateOptionTable(interp, optionSpecs); msgPtr = ckalloc(sizeof(Message)); - memset(msgPtr, 0, (size_t) sizeof(Message)); + memset(msgPtr, 0, sizeof(Message)); /* * Set values for those fields that don't take a 0 or NULL value. @@ -267,7 +267,7 @@ Tk_MessageObjCmd( Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MessageEventProc, msgPtr); - if (Tk_InitOptions(interp, (char *)msgPtr, optionTable, tkwin) != TCL_OK) { + if (Tk_InitOptions(interp, msgPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(msgPtr->tkwin); return TCL_ERROR; } @@ -331,7 +331,7 @@ MessageWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; } else { - objPtr = Tk_GetOptionValue(interp, (char *) msgPtr, + objPtr = Tk_GetOptionValue(interp, msgPtr, msgPtr->optionTable, objv[2], msgPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; @@ -343,7 +343,7 @@ MessageWidgetObjCmd( break; case MESSAGE_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) msgPtr, + objPtr = Tk_GetOptionInfo(interp, msgPtr, msgPtr->optionTable, (objc == 3) ? objv[2] : NULL, msgPtr->tkwin); if (objPtr == NULL) { @@ -455,7 +455,7 @@ ConfigureMessage( MessageTextVarProc, msgPtr); } - if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv, + if (Tk_SetOptions(interp, msgPtr, msgPtr->optionTable, objc, objv, msgPtr->tkwin, &savedOptions, NULL) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; diff --git a/generic/tkObj.c b/generic/tkObj.c index 1355aad..b857d98 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -73,8 +73,12 @@ typedef struct MMRep { typedef struct WindowRep { Tk_Window tkwin; /* Cached window; NULL if not found. */ TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */ - long epoch; /* Value of mainPtr->deletionEpoch at last +#if TCL_MAJOR_VERSION > 8 + size_t epoch; /* Value of mainPtr->deletionEpoch at last * successful lookup. */ +#else + long epoch; +#endif } WindowRep; /* diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index f8f5d1c..4473a3e 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -35,14 +35,14 @@ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, Tk_Uid value, - int valueIsUid, char *widgRec); + int valueIsUid, void *widgRec); static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, Tk_ConfigSpec *specs, const char *argvName, int needFlags, int hateFlags); static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, - const Tk_ConfigSpec *specPtr, char *widgRec); + const Tk_ConfigSpec *specPtr, void *widgRec); static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, - const Tk_ConfigSpec *specPtr, char *widgRec, + const Tk_ConfigSpec *specPtr, void *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, const Tk_ConfigSpec *staticSpecs); @@ -344,10 +344,10 @@ DoConfig( Tk_Uid value, /* Value to use to fill in widgRec. */ int valueIsUid, /* Non-zero means value is a Tk_Uid; zero * means it's an ordinary string. */ - char *widgRec) /* Record whose fields are to be modified. + void *widgRec) /* Record whose fields are to be modified. * Values must be properly initialized. */ { - char *ptr; + void *ptr; Tk_Uid uid; int nullValue; @@ -357,7 +357,7 @@ DoConfig( } do { - ptr = widgRec + specPtr->offset; + ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) { @@ -693,7 +693,7 @@ FormatConfigInfo( register const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ - char *widgRec) /* Pointer to record holding current values of + void *widgRec) /* Pointer to record holding current values of * info for widget. */ { const char *argv[6]; @@ -759,7 +759,7 @@ FormatConfigValue( Tk_Window tkwin, /* Window corresponding to widget. */ const Tk_ConfigSpec *specPtr, /* Pointer to information describing option. * Must not point to a synonym option. */ - char *widgRec, /* Pointer to record holding current values of + void *widgRec, /* Pointer to record holding current values of * info for widget. */ char *buffer, /* Static buffer to use for small values. * Must have at least 200 bytes of storage. */ @@ -767,10 +767,11 @@ FormatConfigValue( * function to free the result, or NULL if * result is static. */ { - const char *ptr, *result; + void *ptr; + const char *result; *freeProcPtr = NULL; - ptr = widgRec + specPtr->offset; + ptr = (char *)widgRec + specPtr->offset; result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: diff --git a/generic/tkOption.c b/generic/tkOption.c index 6c09150..cebb86a 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -260,7 +260,7 @@ Tk_AddOption( register const char *p; const char *field; int count, firstField; - ptrdiff_t length; + size_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; ThreadSpecificData *tsdPtr = @@ -311,7 +311,7 @@ Tk_AddOption( if (length > TMP_SIZE) { length = TMP_SIZE; } - strncpy(tmp, field, (size_t) length); + strncpy(tmp, field, length); tmp[length] = 0; newEl.nameUid = Tk_GetUid(tmp); if (isupper(UCHAR(*field))) { diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index dafadb0..c0bbf5f 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -236,7 +236,7 @@ static void AdjustForSticky(int sticky, int cavityWidth, int *slaveWidthPtr, int *slaveHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); -static char * ComputeSlotAddress(char *recordPtr, int offset); +static void * ComputeSlotAddress(void *recordPtr, int offset); static int PanedWindowIdentifyCoords(PanedWindow *pwPtr, Tcl_Interp *interp, int x, int y); @@ -459,7 +459,7 @@ Tk_PanedWindowObjCmd( Tcl_Preserve(pwPtr->tkwin); - if (Tk_InitOptions(interp, (char *) pwPtr, pwOpts->pwOptions, + if (Tk_InitOptions(interp, pwPtr, pwOpts->pwOptions, tkwin) != TCL_OK) { Tk_DestroyWindow(pwPtr->tkwin); return TCL_ERROR; @@ -578,7 +578,7 @@ PanedWindowWidgetObjCmd( result = TCL_ERROR; break; } - resultObj = Tk_GetOptionValue(interp, (char *) pwPtr, + resultObj = Tk_GetOptionValue(interp, pwPtr, pwPtr->optionTable, objv[2], pwPtr->tkwin); if (resultObj == NULL) { result = TCL_ERROR; @@ -590,7 +590,7 @@ PanedWindowWidgetObjCmd( case PW_CONFIGURE: resultObj = NULL; if (objc <= 3) { - resultObj = Tk_GetOptionInfo(interp, (char *) pwPtr, + resultObj = Tk_GetOptionInfo(interp, pwPtr, pwPtr->optionTable, (objc == 3) ? objv[2] : NULL, pwPtr->tkwin); if (resultObj == NULL) { @@ -669,7 +669,7 @@ PanedWindowWidgetObjCmd( for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionValue(interp, - (char *) pwPtr->slaves[i], pwPtr->slaveOpts, + pwPtr->slaves[i], pwPtr->slaveOpts, objv[3], tkwin); } } @@ -709,7 +709,7 @@ PanedWindowWidgetObjCmd( for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionInfo(interp, - (char *) pwPtr->slaves[i], pwPtr->slaveOpts, + pwPtr->slaves[i], pwPtr->slaveOpts, (objc == 4) ? objv[3] : NULL, pwPtr->tkwin); if (resultObj == NULL) { @@ -848,7 +848,7 @@ ConfigureSlaves( */ memset((void *)&options, 0, sizeof(Slave)); - if (Tk_SetOptions(interp, (char *) &options, pwPtr->slaveOpts, + if (Tk_SetOptions(interp, &options, pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; @@ -925,7 +925,7 @@ ConfigureSlaves( found = 0; for (j = 0; j < pwPtr->numSlaves; j++) { if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) { - Tk_SetOptions(interp, (char *) pwPtr->slaves[j], + Tk_SetOptions(interp, pwPtr->slaves[j], pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); if (pwPtr->slaves[j]->minSize < 0) { @@ -972,9 +972,9 @@ ConfigureSlaves( slavePtr = ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); - Tk_InitOptions(interp, (char *)slavePtr, pwPtr->slaveOpts, + Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts, pwPtr->tkwin); - Tk_SetOptions(interp, (char *)slavePtr, pwPtr->slaveOpts, + Tk_SetOptions(interp, slavePtr, pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); slavePtr->tkwin = tkwin; @@ -1249,7 +1249,7 @@ ConfigurePanedWindow( Tk_SavedOptions savedOptions; int typemask = 0; - if (Tk_SetOptions(interp, (char *) pwPtr, pwPtr->optionTable, objc, objv, + if (Tk_SetOptions(interp, pwPtr, pwPtr->optionTable, objc, objv, pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; @@ -2455,7 +2455,8 @@ SetSticky( int flags) /* Flags for the option, set Tk_SetOptions. */ { int sticky = 0; - char c, *internalPtr; + char c; + void *internalPtr; const char *string; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); @@ -3019,13 +3020,13 @@ ObjectIsEmpty( *---------------------------------------------------------------------- */ -static char * +static void * ComputeSlotAddress( - char *recordPtr, /* Pointer to the start of a record. */ + void *recordPtr, /* Pointer to the start of a record. */ int offset) /* Offset of a slot within that record; may be < 0. */ { if (offset >= 0) { - return recordPtr + offset; + return (char *)recordPtr + offset; } else { return NULL; } diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 9fa406a..e627794 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -290,7 +290,7 @@ Tk_PlaceObjCmd( if (slavePtr == NULL) { return TCL_OK; } - objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr, optionTable, + objPtr = Tk_GetOptionInfo(interp, slavePtr, optionTable, (objc == 4) ? objv[3] : NULL, tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -628,7 +628,7 @@ ConfigureSlave( slavePtr = CreateSlave(tkwin, table); - if (Tk_SetOptions(interp, (char *) slavePtr, table, objc, objv, + if (Tk_SetOptions(interp, slavePtr, table, objc, objv, slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } diff --git a/generic/tkScale.c b/generic/tkScale.c index 5733c8a..8b016a2 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -300,7 +300,7 @@ Tk_ScaleObjCmd( ExposureMask|StructureNotifyMask|FocusChangeMask, ScaleEventProc, scalePtr); - if ((Tk_InitOptions(interp, (char *) scalePtr, optionTable, tkwin) + if ((Tk_InitOptions(interp, scalePtr, optionTable, tkwin) != TCL_OK) || (ConfigureScale(interp, scalePtr, objc - 2, objv + 2) != TCL_OK)) { Tk_DestroyWindow(scalePtr->tkwin); @@ -363,7 +363,7 @@ ScaleWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } - objPtr = Tk_GetOptionValue(interp, (char *) scalePtr, + objPtr = Tk_GetOptionValue(interp, scalePtr, scalePtr->optionTable, objv[2], scalePtr->tkwin); if (objPtr == NULL) { goto error; @@ -372,7 +372,7 @@ ScaleWidgetObjCmd( break; case COMMAND_CONFIGURE: if (objc <= 3) { - objPtr = Tk_GetOptionInfo(interp, (char *) scalePtr, + objPtr = Tk_GetOptionInfo(interp, scalePtr, scalePtr->optionTable, (objc == 3) ? objv[2] : NULL, scalePtr->tkwin); if (objPtr == NULL) { @@ -582,7 +582,7 @@ ConfigureScale( * First pass: set options to new values. */ - if (Tk_SetOptions(interp, (char *) scalePtr, + if (Tk_SetOptions(interp, scalePtr, scalePtr->optionTable, objc, objv, scalePtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; 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/tkSelect.c b/generic/tkSelect.c index 02268d3..d97db45 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -357,7 +357,7 @@ Tk_OwnSelection( TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; - ClientData clearData = NULL;/* Initialization needed only to prevent + void *clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ if (dispPtr->multipleAtom == None) { @@ -466,7 +466,7 @@ Tk_ClearSelection( TkSelectionInfo *prevPtr; TkSelectionInfo *nextPtr; Tk_LostSelProc *clearProc = NULL; - ClientData clearData = NULL;/* Initialization needed only to prevent + void *clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ if (dispPtr->multipleAtom == None) { @@ -1246,7 +1246,7 @@ TkSelClearSelection( } if (infoPtr != NULL && (infoPtr->owner == tkwin) && - (eventPtr->xselectionclear.serial >= (unsigned) infoPtr->serial)) { + (eventPtr->xselectionclear.serial >= (unsigned long) infoPtr->serial)) { if (prevPtr == NULL) { dispPtr->selectionInfoPtr = infoPtr->nextPtr; } else { diff --git a/generic/tkSelect.h b/generic/tkSelect.h index 74326d0..d7df94e 100644 --- a/generic/tkSelect.h +++ b/generic/tkSelect.h @@ -25,14 +25,18 @@ typedef struct TkSelectionInfo { Atom selection; /* Selection name, e.g. XA_PRIMARY. */ Tk_Window owner; /* Current owner of this selection. */ - int serial; /* Serial number of last XSelectionSetOwner +#if TCL_MAJOR_VERSION > 8 + unsigned long serial; /* Serial number of last XSelectionSetOwner * request made to server for this selection * (used to filter out redundant * SelectionClear events). */ +#else + int serial; +#endif Time time; /* Timestamp used to acquire selection. */ Tk_LostSelProc *clearProc; /* Procedure to call when owner loses * selection. */ - ClientData clearData; /* Info to pass to clearProc. */ + void *clearData; /* Info to pass to clearProc. */ struct TkSelectionInfo *nextPtr; /* Next in list of current selections on this * display. NULL means end of list. */ @@ -52,8 +56,8 @@ typedef struct TkSelHandler { * returned, such as STRING or ATOM. */ Tk_SelectionProc *proc; /* Procedure to generate selection in this * format. */ - ClientData clientData; /* Argument to pass to proc. */ - int size; /* Size of units returned by proc (8 for + void *clientData; /* Argument to pass to proc. */ + TkSizeT size; /* Size of units returned by proc (8 for * STRING, 32 for almost anything else). */ struct TkSelHandler *nextPtr; /* Next selection handler associated with same diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 36d2d6e..2a64dbb 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -172,7 +172,7 @@ SquareObjCmd( squarePtr->gc = None; squarePtr->optionTable = optionTable; - if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin) + if (Tk_InitOptions(interp, squarePtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(squarePtr->tkwin); ckfree(squarePtr); @@ -181,7 +181,7 @@ SquareObjCmd( Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask, SquareObjEventProc, squarePtr); - if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2, + if (Tk_SetOptions(interp, squarePtr, optionTable, objc - 2, objv + 2, tkwin, NULL, NULL) != TCL_OK) { goto error; } @@ -250,7 +250,7 @@ SquareWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } - resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr, + resultObjPtr = Tk_GetOptionValue(interp, squarePtr, squarePtr->optionTable, objv[2], squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; @@ -261,19 +261,19 @@ SquareWidgetObjCmd( case SQUARE_CONFIGURE: resultObjPtr = NULL; if (objc == 2) { - resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr, + resultObjPtr = Tk_GetOptionInfo(interp, squarePtr, squarePtr->optionTable, NULL, squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } } else if (objc == 3) { - resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr, + resultObjPtr = Tk_GetOptionInfo(interp, squarePtr, squarePtr->optionTable, objv[2], squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } } else { - result = Tk_SetOptions(interp, (char *) squarePtr, + result = Tk_SetOptions(interp, squarePtr, squarePtr->optionTable, objc - 2, objv + 2, squarePtr->tkwin, NULL, NULL); if (result == TCL_OK) { diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index acea978..731fa50 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -594,7 +594,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkMacOSXWindowOffset, /* 37 */ TkSetMacColor, /* 38 */ TkSetWMName, /* 39 */ - TkSuspendClipboard, /* 40 */ + 0, /* 40 */ TkMacOSXZoomToplevel, /* 41 */ Tk_TopCoordsToWindow, /* 42 */ TkMacOSXContainerId, /* 43 */ diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 10d2104..508a2c4 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1076,7 +1076,7 @@ Tk_GetElementSize( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ int width, int height, /* Requested size. */ int inner, /* If TRUE, compute the outer size according @@ -1117,7 +1117,7 @@ Tk_GetElementBox( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ int x, int y, /* Top left corner of available area. */ int width, int height, /* Size of available area. */ @@ -1159,7 +1159,7 @@ Tk_GetElementBorderWidth( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_Window tkwin) /* The widget window. */ { Style *stylePtr = (Style *) style; @@ -1190,7 +1190,7 @@ Tk_DrawElement( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ Drawable d, /* Where to draw element. */ int x, int y, /* Top left corner of element. */ diff --git a/generic/tkTest.c b/generic/tkTest.c index 567540e..0cf1f49 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -168,7 +168,7 @@ static int TestmenubarObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #endif -#if defined(_WIN32) || defined(MAC_OSX_TK) +#if defined(_WIN32) static int TestmetricsObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); @@ -276,17 +276,17 @@ Tktest_Init( TestPhotoStringMatchCmd, (ClientData) Tk_MainWindow(interp), NULL); -#if defined(_WIN32) || defined(MAC_OSX_TK) +#if defined(_WIN32) Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd, (ClientData) Tk_MainWindow(interp), NULL); -#elif !defined(__CYGWIN__) +#elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK) Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testsend", TkpTestsendCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperObjCmd, (ClientData) Tk_MainWindow(interp), NULL); -#endif /* _WIN32 || MAC_OSX_TK */ +#endif /* _WIN32 */ /* * Create test image type. @@ -675,7 +675,7 @@ TestobjconfigObjCmd( recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; recordPtr->customPtr = NULL; - result = Tk_InitOptions(interp, (char *) recordPtr, optionTable, + result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, @@ -683,7 +683,7 @@ TestobjconfigObjCmd( (ClientData) recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, (ClientData) recordPtr); - result = Tk_SetOptions(interp, (char *) recordPtr, optionTable, + result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_DestroyWindow(tkwin); @@ -718,12 +718,12 @@ TestobjconfigObjCmd( recordPtr->header.tkwin = tkwin; recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL; recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; - result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin); + result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { - result = Tk_SetOptions(interp, (char *) recordPtr, optionTable, + result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { - Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin); + Tk_FreeConfigOptions(recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { @@ -772,9 +772,9 @@ TestobjconfigObjCmd( recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL; recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; recordPtr->extension5ObjPtr = NULL; - result = Tk_InitOptions(interp, (char *)recordPtr, optionTable, tkwin); + result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { - result = Tk_SetOptions(interp, (char *) recordPtr, optionTable, + result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin); @@ -806,7 +806,7 @@ TestobjconfigObjCmd( widgetRecord.intPtr = NULL; optionTable = Tk_CreateOptionTable(interp, errorSpecs); tables[index] = optionTable; - return Tk_InitOptions(interp, (char *) &widgetRecord, optionTable, + return Tk_InitOptions(interp, &widgetRecord, optionTable, (Tk_Window) NULL); } @@ -954,7 +954,7 @@ TestobjconfigObjCmd( recordPtr->mm = 0.0; recordPtr->tkwin = NULL; recordPtr->custom = NULL; - result = Tk_InitOptions(interp, (char *) recordPtr, optionTable, + result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, @@ -962,7 +962,7 @@ TestobjconfigObjCmd( recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); - result = Tk_SetOptions(interp, (char *) recordPtr, optionTable, + result = Tk_SetOptions(interp, recordPtr, optionTable, objc - 3, objv + 3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_DestroyWindow(tkwin); @@ -1015,10 +1015,10 @@ TestobjconfigObjCmd( recordPtr->one = recordPtr->two = recordPtr->three = NULL; recordPtr->four = recordPtr->five = NULL; Tcl_SetObjResult(interp, objv[2]); - result = Tk_InitOptions(interp, (char *) recordPtr, + result = Tk_InitOptions(interp, recordPtr, recordPtr->header.optionTable, (Tk_Window) NULL); if (result == TCL_OK) { - result = Tk_SetOptions(interp, (char *) recordPtr, + result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, (Tk_Window) NULL, NULL, NULL); if (result == TCL_OK) { @@ -1026,7 +1026,7 @@ TestobjconfigObjCmd( Tcl_GetString(objv[2]), TrivialConfigObjCmd, (ClientData) recordPtr, TrivialCmdDeletedProc); } else { - Tk_FreeConfigOptions((char *) recordPtr, + Tk_FreeConfigOptions(recordPtr, recordPtr->header.optionTable, (Tk_Window) NULL); } } @@ -1055,8 +1055,8 @@ TestobjconfigObjCmd( Tk_SetClass(tkwin, "Config"); optionTable = Tk_CreateOptionTable(interp, errorSpecs); tables[index] = optionTable; - Tk_InitOptions(interp, (char *) &record, optionTable, tkwin); - if (Tk_SetOptions(interp, (char *) &record, optionTable, 1, + Tk_InitOptions(interp, &record, optionTable, tkwin); + if (Tk_SetOptions(interp, &record, optionTable, 1, &newObjPtr, tkwin, NULL, NULL) != TCL_OK) { result = TCL_ERROR; } @@ -1093,10 +1093,10 @@ TestobjconfigObjCmd( recordPtr->header.tkwin = tkwin; recordPtr->windowPtr = NULL; - result = Tk_InitOptions(interp, (char *) recordPtr, + result = Tk_InitOptions(interp, recordPtr, recordPtr->header.optionTable, tkwin); if (result == TCL_OK) { - result = Tk_SetOptions(interp, (char *) recordPtr, + result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, tkwin, NULL, NULL); if (result == TCL_OK) { @@ -1107,7 +1107,7 @@ TestobjconfigObjCmd( TrivialEventProc, recordPtr); Tcl_SetObjResult(interp, objv[2]); } else { - Tk_FreeConfigOptions((char *) recordPtr, + Tk_FreeConfigOptions(recordPtr, recordPtr->header.optionTable, tkwin); } } @@ -1178,7 +1178,7 @@ TrivialConfigObjCmd( result = TCL_ERROR; goto done; } - resultObjPtr = Tk_GetOptionValue(interp, (char *) clientData, + resultObjPtr = Tk_GetOptionValue(interp, clientData, headerPtr->optionTable, objv[2], tkwin); if (resultObjPtr != NULL) { Tcl_SetObjResult(interp, resultObjPtr); @@ -1189,7 +1189,7 @@ TrivialConfigObjCmd( break; case CONFIGURE: if (objc == 2) { - resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData, + resultObjPtr = Tk_GetOptionInfo(interp, clientData, headerPtr->optionTable, NULL, tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; @@ -1197,7 +1197,7 @@ TrivialConfigObjCmd( Tcl_SetObjResult(interp, resultObjPtr); } } else if (objc == 3) { - resultObjPtr = Tk_GetOptionInfo(interp, (char *) clientData, + resultObjPtr = Tk_GetOptionInfo(interp, clientData, headerPtr->optionTable, objv[2], tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; @@ -1205,7 +1205,7 @@ TrivialConfigObjCmd( Tcl_SetObjResult(interp, resultObjPtr); } } else { - result = Tk_SetOptions(interp, (char *) clientData, + result = Tk_SetOptions(interp, clientData, headerPtr->optionTable, objc - 2, objv + 2, tkwin, NULL, &mask); if (result == TCL_OK) { @@ -1214,7 +1214,7 @@ TrivialConfigObjCmd( } break; case CSAVE: - result = Tk_SetOptions(interp, (char *) clientData, + result = Tk_SetOptions(interp, clientData, headerPtr->optionTable, objc - 2, objv + 2, tkwin, &saved, &mask); Tk_FreeSavedOptions(&saved); @@ -1774,7 +1774,7 @@ TestmenubarObjCmd( *---------------------------------------------------------------------- */ -#if defined(_WIN32) || defined(MAC_OSX_TK) +#if defined(_WIN32) static int TestmetricsObjCmd( ClientData clientData, /* Main window for application. */ @@ -1785,38 +1785,15 @@ TestmetricsObjCmd( char buf[TCL_INTEGER_SPACE]; int val; -#ifdef _WIN32 if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } -#else - Tk_Window tkwin = (Tk_Window) clientData; - TkWindow *winPtr; - - if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "option window"); - return TCL_ERROR; - } - - winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); - if (winPtr == NULL) { - return TCL_ERROR; - } -#endif if (strcmp(Tcl_GetString(objv[1]), "cyvscroll") == 0) { -#ifdef _WIN32 val = GetSystemMetrics(SM_CYVSCROLL); -#else - val = ((TkScrollbar *) winPtr->instanceData)->width; -#endif } else if (strcmp(Tcl_GetString(objv[1]), "cxhscroll") == 0) { -#ifdef _WIN32 val = GetSystemMetrics(SM_CXHSCROLL); -#else - val = ((TkScrollbar *) winPtr->instanceData)->width; -#endif } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), "\": must be cxhscroll or cyvscroll", NULL); @@ -2053,7 +2030,7 @@ CustomOptionSet( objEmpty = 0; - if (internalOffset >= 0) { + if (internalOffset != -1) { internalPtr = recordPtr + internalOffset; } else { internalPtr = NULL; diff --git a/generic/tkText.c b/generic/tkText.c index 1585e27..a08878c 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -661,7 +661,7 @@ CreateWidget( Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING, TextFetchSelection, textPtr, XA_STRING); - if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin) + if (Tk_InitOptions(interp, textPtr, optionTable, textPtr->tkwin) != TCL_OK) { Tk_DestroyWindow(textPtr->tkwin); return TCL_ERROR; @@ -764,7 +764,7 @@ TextWidgetObjCmd( result = TCL_ERROR; goto done; } else { - Tcl_Obj *objPtr = Tk_GetOptionValue(interp, (char *) textPtr, + Tcl_Obj *objPtr = Tk_GetOptionValue(interp, textPtr, textPtr->optionTable, objv[2], textPtr->tkwin); if (objPtr == NULL) { @@ -827,7 +827,7 @@ TextWidgetObjCmd( } case TEXT_CONFIGURE: if (objc <= 3) { - Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) textPtr, + Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, textPtr, textPtr->optionTable, ((objc == 3) ? objv[2] : NULL), textPtr->tkwin); @@ -1155,14 +1155,14 @@ TextWidgetObjCmd( objc++; } useIdx = ckalloc(objc); - memset(useIdx, 0, (size_t) objc); + memset(useIdx, 0, objc); /* * Do a decreasing order sort so that we delete the end ranges * first to maintain index consistency. */ - qsort(indices, (size_t) objc / 2, + qsort(indices, objc / 2, 2 * sizeof(TkTextIndex), TextIndexSortProc); lastStart = NULL; @@ -5076,7 +5076,7 @@ DumpSegment( Tcl_DecrRefCount(tuple); return 0; } else { - int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); + TkSizeT oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); Tcl_DString buf; int code; @@ -5903,7 +5903,7 @@ SearchCore( firstOffset = 0; } - if (alreadySearchOffset != -1) { + if (alreadySearchOffset >= 0) { if (searchSpecPtr->backwards) { if (alreadySearchOffset < lastOffset) { lastOffset = alreadySearchOffset; @@ -5992,17 +5992,17 @@ SearchCore( * match. */ - const char c = pattern[0]; + const char c = matchLength ? pattern[0] : '\0'; - if (alreadySearchOffset != -1) { + if (alreadySearchOffset >= 0) { p = startOfLine + alreadySearchOffset; alreadySearchOffset = -1; } else { p = startOfLine + lastOffset -1; } while (p >= startOfLine + firstOffset) { - if (p[0] == c && !strncmp(p, pattern, - (size_t) matchLength)) { + if (matchLength == 0 || (p[0] == c && !strncmp( + p, pattern, (size_t) matchLength))) { goto backwardsMatch; } p--; @@ -6165,10 +6165,14 @@ SearchCore( if (firstNewLine != -1) { break; } else { - alreadySearchOffset -= matchLength; + alreadySearchOffset -= (matchLength ? matchLength : 1); + if (alreadySearchOffset < 0) { + break; + } } } else { - firstOffset = p - startOfLine + matchLength; + firstOffset = matchLength ? p - startOfLine + matchLength + : p - startOfLine + 1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find @@ -6829,7 +6833,7 @@ SetLineStartEnd( TkText *textPtr = (TkText *) recordPtr; if (internalOffset >= 0) { - internalPtr = recordPtr + internalOffset; + internalPtr = (char *)recordPtr + internalOffset; } else { internalPtr = NULL; } diff --git a/generic/tkText.h b/generic/tkText.h index 430c96b..5e84fd5 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -532,8 +532,16 @@ typedef enum { * that are peers. */ +#ifndef TkSizeT +# if TCL_MAJOR_VERSION > 8 +# define TkSizeT size_t +# else +# define TkSizeT int +# endif +#endif + typedef struct TkSharedText { - int refCount; /* Reference count this shared object. */ + TkSizeT refCount; /* Reference count this shared object. */ TkTextBTree tree; /* B-tree representation of text and tags for * widget. */ Tcl_HashTable tagTable; /* Hash table that maps from tag names to @@ -562,7 +570,7 @@ typedef struct TkSharedText { * exist, so the table hasn't been created. * Each "object" used for this table is the * name of a tag. */ - int stateEpoch; /* This is incremented each time the B-tree's + TkSizeT stateEpoch; /* This is incremented each time the B-tree's * contents change structurally, or when the * start/end limits change, and means that any * cached TkTextIndex objects are no longer @@ -783,7 +791,7 @@ typedef struct TkText { * definitions. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ - int refCount; /* Number of cached TkTextIndex objects + TkSizeT refCount; /* Number of cached TkTextIndex objects * refering to us. */ int insertCursorType; /* 0 = standard insertion cursor, 1 = block * cursor. */ @@ -1009,7 +1017,7 @@ MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr); -MODULE_SCOPE int TkBTreeEpoch(TkTextBTree tree); +MODULE_SCOPE TkSizeT TkBTreeEpoch(TkTextBTree tree); MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree, const TkText *textPtr, int line); MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree, diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 81e31dc..66fa140 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -105,7 +105,7 @@ typedef struct BTree { int clients; /* Number of clients of this B-tree. */ int pixelReferences; /* Number of clients of this B-tree which care * about pixel heights. */ - int stateEpoch; /* Updated each time any aspect of the B-tree + TkSizeT stateEpoch; /* Updated each time any aspect of the B-tree * changes. */ TkSharedText *sharedTextPtr;/* Used to find tagTable in consistency * checking code, and to access list of all @@ -140,10 +140,10 @@ int tkBTreeDebug = 0; * Macros that determine how much space to allocate for new segments: */ -#define CSEG_SIZE(chars) ((unsigned) (Tk_Offset(TkTextSegment, body) \ - + 1 + (chars))) -#define TSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \ - + sizeof(TkTextToggle))) +#define CSEG_SIZE(chars) (Tk_Offset(TkTextSegment, body) \ + + 1 + (chars)) +#define TSEG_SIZE (Tk_Offset(TkTextSegment, body) \ + + sizeof(TkTextToggle)) /* * Forward declarations for functions defined in this file: @@ -501,7 +501,7 @@ TkBTreeDestroy( *---------------------------------------------------------------------- */ -int +TkSizeT TkBTreeEpoch( TkTextBTree tree) /* Tree to get epoch for. */ { @@ -1021,7 +1021,7 @@ TkBTreeInsertChars( * this line). */ register TkTextSegment *segPtr; TkTextLine *newLinePtr; - int chunkSize; /* # characters in current chunk. */ + size_t chunkSize; /* # characters in current chunk. */ register const char *eol; /* Pointer to character just after last one in * current chunk. */ int changeToLineCount; /* Counts change to total number of lines in @@ -1070,7 +1070,7 @@ TkBTreeInsertChars( curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; - memcpy(segPtr->body.chars, string, (size_t) chunkSize); + memcpy(segPtr->body.chars, string, chunkSize); segPtr->body.chars[chunkSize] = 0; if (eol[-1] != '\n') { @@ -4563,7 +4563,7 @@ CharSplitProc( newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; - memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t) index); + memcpy(newPtr1->body.chars, segPtr->body.chars, index); newPtr1->body.chars[index] = 0; newPtr2->typePtr = &tkTextCharType; newPtr2->nextPtr = segPtr->nextPtr; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 2df41d4..9f0d7e0 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -162,7 +162,7 @@ typedef struct StyleValues { */ typedef struct TextStyle { - int refCount; /* Number of times this structure is + TkSizeT refCount; /* Number of times this structure is * referenced in Chunks. */ GC bgGC; /* Graphics context for background. None means * use widget background. */ @@ -400,7 +400,7 @@ typedef struct TextDInfo { * to so far... */ int metricPixelHeight; /* ...and this is for the height calculation * so far...*/ - int metricEpoch; /* ...and this for the epoch of the partial + TkSizeT metricEpoch; /* ...and this for the epoch of the partial * calculation so it can be cancelled if * things change once more. This field will be * -1 if there is no long-line calculation in @@ -1052,8 +1052,7 @@ FreeStyle( register TextStyle *stylePtr) /* Information about style to free. */ { - stylePtr->refCount--; - if (stylePtr->refCount == 0) { + if (stylePtr->refCount-- <= 1) { if (stylePtr->bgGC != None) { Tk_FreeGC(textPtr->display, stylePtr->bgGC); } @@ -3044,7 +3043,7 @@ AsyncUpdateLineMetrics( * and we've reached the last line, then we're done. */ - if (dInfoPtr->metricEpoch == -1 + if (dInfoPtr->metricEpoch == TCL_AUTO_LENGTH && lineNum == dInfoPtr->lastMetricUpdateLine) { /* * We have looped over all lines, so we're done. We must release our @@ -3194,7 +3193,7 @@ TkTextUpdateLineMetrics( * then we can't be done. */ - if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) { + if (textPtr->dInfoPtr->metricEpoch == TCL_AUTO_LENGTH && lineNum == endLine) { /* * We have looped over all lines, so we're done. */ @@ -6258,7 +6257,7 @@ TkTextPendingsync( TextDInfo *dInfoPtr = textPtr->dInfoPtr; return ( - ((dInfoPtr->metricEpoch == -1) && + ((dInfoPtr->metricEpoch == TCL_AUTO_LENGTH) && (dInfoPtr->lastMetricUpdateLine == dInfoPtr->currentMetricUpdateLine)) ? 0 : 1); } @@ -7690,7 +7689,7 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit); + ciPtr = ckalloc(Tk_Offset(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, (unsigned) bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 41dd448..defda56 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -18,7 +18,7 @@ */ #define EI_SEG_SIZE \ - ((unsigned) (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage))) + (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)) /* * Prototypes for functions defined in this file: @@ -161,7 +161,7 @@ TkTextImageCmd( Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL); return TCL_ERROR; } - objPtr = Tk_GetOptionValue(interp, (char *) &eiPtr->body.ei, + objPtr = Tk_GetOptionValue(interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -188,7 +188,7 @@ TkTextImageCmd( } if (objc <= 5) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, - (char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable, + &eiPtr->body.ei, eiPtr->body.ei.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { @@ -337,7 +337,7 @@ EmbImageConfigure( int conflict = 0; /* True if we have a name conflict */ size_t len; /* length of image name */ - if (Tk_SetOptions(textPtr->interp, (char *) &eiPtr->body.ei, + if (Tk_SetOptions(textPtr->interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 0ee7347..2870c07 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -64,7 +64,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr); #define SET_TEXTINDEX(objPtr, indexPtr) \ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr)) #define SET_INDEXEPOCH(objPtr, epoch) \ - ((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch)) + ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch)) /* * Define the 'textindex' object type, which Tk uses to represent indices in @@ -104,7 +104,7 @@ DupTextIndexInternalRep( Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */ { - int epoch; + TkSizeT epoch; TkTextIndex *dupIndexPtr, *indexPtr; dupIndexPtr = ckalloc(sizeof(TkTextIndex)); @@ -206,7 +206,7 @@ TkTextGetIndexFromObj( int cache; if (objPtr->typePtr == &tkTextIndexType) { - int epoch; + TkSizeT epoch; indexPtr = GET_TEXTINDEX(objPtr); epoch = GET_INDEXEPOCH(objPtr); @@ -923,7 +923,7 @@ GetIndex( } if ((string[0] == 'e') && (strncmp(string, "end", - (size_t) (endOfBase-Tcl_DStringValue(©))) == 0)) { + endOfBase-Tcl_DStringValue(©)) == 0)) { /* * Base position is end of text. */ diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index 19d0c2a..da455d3 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -19,8 +19,8 @@ * Macro that determines the size of a mark segment: */ -#define MSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \ - + sizeof(TkTextMark))) +#define MSEG_SIZE (Tk_Offset(TkTextSegment, body) \ + + sizeof(TkTextMark)) /* * Forward references for functions defined in this file: diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index d8ffb5a..0a749c4 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -343,7 +343,7 @@ TkTextTagCmd( if (tagPtr == NULL) { return TCL_ERROR; } - objPtr = Tk_GetOptionValue(interp, (char *) tagPtr, + objPtr = Tk_GetOptionValue(interp, tagPtr, tagPtr->optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -362,7 +362,7 @@ TkTextTagCmd( } tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag); if (objc <= 5) { - Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) tagPtr, + Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, tagPtr, tagPtr->optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); @@ -374,7 +374,7 @@ TkTextTagCmd( } else { int result = TCL_OK; - if (Tk_SetOptions(interp, (char *) tagPtr, tagPtr->optionTable, + if (Tk_SetOptions(interp, tagPtr, tagPtr->optionTable, objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } @@ -1563,7 +1563,8 @@ TkTextPickCurrent( TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ - int numOldTags, numNewTags, i, j, size, nearby; + int numOldTags, numNewTags, i, j, nearby; + size_t size; XEvent event; /* @@ -1656,7 +1657,7 @@ TkTextPickCurrent( if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); copyArrayPtr = ckalloc(size); - memcpy(copyArrayPtr, newArrayPtr, (size_t) size); + memcpy(copyArrayPtr, newArrayPtr, size); for (i = 0; i < textPtr->numCurTags; i++) { for (j = 0; j < numNewTags; j++) { if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) { diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9fc20f..79ed1a1 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -35,8 +35,8 @@ static const Tk_GeomMgr textGeomType = { * Macro that determines the size of an embedded window segment: */ -#define EW_SEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \ - + sizeof(TkTextEmbWindow))) +#define EW_SEG_SIZE (Tk_Offset(TkTextSegment, body) \ + + sizeof(TkTextEmbWindow)) /* * Prototypes for functions defined in this file: @@ -191,7 +191,7 @@ TkTextWindowCmd( ewPtr->body.ew.tkwin = NULL; } - objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew, + objPtr = Tk_GetOptionValue(interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -233,7 +233,7 @@ TkTextWindowCmd( ewPtr->body.ew.tkwin = NULL; } - objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew, + objPtr = Tk_GetOptionInfo(interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { @@ -403,7 +403,7 @@ EmbWinConfigure( } oldWindow = ewPtr->body.ew.tkwin; - if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew, + if (Tk_SetOptions(textPtr->interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; 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: diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 6f6816d..427e946 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -21,9 +21,9 @@ typedef struct VisualDictionary { const char *name; /* Textual name of class. */ - int minLength; /* Minimum # characters that must be specified + unsigned short minLength; /* Minimum # characters that must be specified * for an unambiguous match. */ - int class; /* X symbol for class. */ + short class; /* X symbol for class. */ } VisualDictionary; static const VisualDictionary visualNames[] = { {"best", 1, 0}, @@ -99,7 +99,7 @@ Tk_GetVisual( XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; - ptrdiff_t length; + size_t length; int c, numVisuals, prio, bestPrio, i; const char *p; const VisualDictionary *dictPtr; @@ -195,8 +195,7 @@ Tk_GetVisual( template.class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) - && (strncmp(string, dictPtr->name, - (size_t) length) == 0)) { + && (strncmp(string, dictPtr->name, length) == 0)) { template.class = dictPtr->class; break; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index bc57165..d36313b 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1136,7 +1136,7 @@ Tk_CreateWindowFromPath( char fixedSpace[FIXED_SPACE+1]; char *p; Tk_Window parent; - int numChars; + size_t numChars; /* * Strip the parent's name out of pathName (it's everything up to the last @@ -1153,7 +1153,7 @@ Tk_CreateWindowFromPath( Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } - numChars = (int) (p-pathName); + numChars = p-pathName; if (numChars > FIXED_SPACE) { p = ckalloc(numChars + 1); } else { @@ -1163,7 +1163,7 @@ Tk_CreateWindowFromPath( *p = '.'; p[1] = '\0'; } else { - strncpy(p, pathName, (size_t) numChars); + strncpy(p, pathName, numChars); p[numChars] = '\0'; } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 40e49b7..e5268e7 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -585,7 +585,7 @@ static int EntryNeedsValidation(VMODE vmode, VREASON reason) * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected - * TCL_ERROR if any errors occured + * TCL_ERROR if any errors occurred * * The change will be rejected if -validatecommand returns 0, * or if -validatecommand or -invalidcommand modifies the value. diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index d2ee50c..0625af8 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -217,7 +217,7 @@ static int ConfigureTab( Tk_SavedOptions savedOptions; int mask = 0; - if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable, + if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 1c99a0b..8f8094e 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -147,7 +147,7 @@ static int ConfigurePane( Tk_SavedOptions savedOptions; int mask = 0; - if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable, + if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 342b16a..f98cc26 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -142,7 +142,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( /* Make sure widget option has a Tcl_Obj* entry: */ - if (optionSpec->objOffset < 0) { + if (optionSpec->objOffset == TCL_AUTO_LENGTH) { return 0; } @@ -970,12 +970,12 @@ static int InitializeElementRecord( Ttk_ElementClass *eclass, /* Element instance to initialize */ Ttk_Style style, /* Style table */ - char *widgetRecord, /* Source of widget option values */ + void *widgetRecord, /* Source of widget option values */ Tk_OptionTable optionTable, /* Option table describing widget record */ Tk_Window tkwin, /* Corresponding window */ Ttk_State state) /* Widget or element state */ { - char *elementRecord = eclass->elementRecord; + void *elementRecord = eclass->elementRecord; OptionMap optionMap = GetOptionMap(eclass,optionTable); int nResources = eclass->nResources; Ttk_ResourceCache cache = style->cache; @@ -984,7 +984,7 @@ int InitializeElementRecord( int i; for (i=0; i<nResources; ++i, ++elementOption) { Tcl_Obj **dest = (Tcl_Obj **) - (elementRecord + elementOption->offset); + ((char *)elementRecord + elementOption->offset); const char *optionName = elementOption->optionName; Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state); Tcl_Obj *widgetValue = 0; @@ -992,7 +992,7 @@ int InitializeElementRecord( if (optionMap[i]) { widgetValue = *(Tcl_Obj **) - (widgetRecord + optionMap[i]->objOffset); + ((char *)widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { @@ -1064,7 +1064,7 @@ void Ttk_ElementSize( Ttk_ElementClass *eclass, /* Element to query */ Ttk_Style style, /* Style settings */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of widget record */ Tk_Window tkwin, /* The widget window. */ Ttk_State state, /* Current widget state */ @@ -1094,7 +1094,7 @@ void Ttk_DrawElement( Ttk_ElementClass *eclass, /* Element instance */ Ttk_Style style, /* Style settings */ - char *recordPtr, /* The widget record. */ + void *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of option table */ Tk_Window tkwin, /* The widget window. */ Drawable d, /* Where to draw element. */ diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 9251dea..f087ce3 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -234,11 +234,19 @@ typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); +#ifndef TkSizeT +# if TCL_MAJOR_VERSION > 8 +# define TkSizeT size_t +# else +# define TkSizeT int +# endif +#endif + typedef struct Ttk_ElementOptionSpec { const char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ - int offset; /* Offset of Tcl_Obj* field in element record */ + TkSizeT offset; /* Offset of Tcl_Obj* field in element record */ const char *defaultValue; /* Default value to used if resource missing */ } Ttk_ElementOptionSpec; diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 3aaada8..25a5fdf 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -15,11 +15,11 @@ MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name); MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *); MODULE_SCOPE void Ttk_ElementSize( - Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable, + Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable, Tk_Window tkwin, Ttk_State state, int *widthPtr, int *heightPtr, Ttk_Padding*); MODULE_SCOPE void Ttk_DrawElement( - Ttk_ElementClass *, Ttk_Style, char *recordPtr, Tk_OptionTable, + Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle( diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index a09ff84..7aad8ae 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1129,7 +1129,7 @@ static int ConfigureItem( Ttk_ImageSpec *newImageSpec = NULL; Ttk_TagSet newTagSet = NULL; - if (Tk_SetOptions(interp, (ClientData)item, tv->tree.itemOptionTable, + if (Tk_SetOptions(interp, item, tv->tree.itemOptionTable, objc, objv, tv->core.tkwin, &savedOptions, &mask) != TCL_OK) { @@ -1209,7 +1209,7 @@ static int ConfigureColumn( Tk_SavedOptions savedOptions; int mask; - if (Tk_SetOptions(interp, (ClientData)column, + if (Tk_SetOptions(interp, column, tv->tree.columnOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { @@ -1255,7 +1255,7 @@ static int ConfigureHeading( Tk_SavedOptions savedOptions; int mask; - if (Tk_SetOptions(interp, (ClientData)column, + if (Tk_SetOptions(interp, column, tv->tree.headingOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { @@ -1823,7 +1823,7 @@ static int DrawSubtree( static int DrawForest( Treeview *tv, TreeItem *item, Drawable d, int depth, int row) { - while (item && row <= tv->tree.yscroll.last) { + while (item && row < tv->tree.yscroll.last) { row = DrawSubtree(tv, item, d, depth, row); item = item->next; } |