diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-01 14:30:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-01 14:30:07 (GMT) |
commit | 36cc0029458ead72be711c8c402f55a4fd26edd3 (patch) | |
tree | 9d78414244a27069e5362313cf542baba8dfefb1 /generic | |
parent | c122ab6dc1e84c1b07be22f6b1b3983df7268a68 (diff) | |
parent | 5f84e8bb5604b44e2682c85e6bf8724deb5c3257 (diff) | |
download | tk-36cc0029458ead72be711c8c402f55a4fd26edd3.zip tk-36cc0029458ead72be711c8c402f55a4fd26edd3.tar.gz tk-36cc0029458ead72be711c8c402f55a4fd26edd3.tar.bz2 |
Use internalRep.twoPtrValue.ptr1 in stead of internalRep.otherValuePtr everywhere.
Change some internal "length" variables from type int to type size_t, so it could handle bigger string sizes (for "novem")
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkConfig.c | 2 | ||||
-rw-r--r-- | generic/tkEntry.c | 14 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 2 | ||||
-rw-r--r-- | generic/tkMenu.c | 4 | ||||
-rw-r--r-- | generic/tkObj.c | 32 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 2 | ||||
-rw-r--r-- | generic/tkPanedWindow.c | 2 | ||||
-rw-r--r-- | generic/tkStyle.c | 16 | ||||
-rw-r--r-- | generic/tkTest.c | 10 | ||||
-rw-r--r-- | generic/tkText.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 4 |
11 files changed, 45 insertions, 45 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 2503f31..3be882f 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1004,7 +1004,7 @@ ObjectIsEmpty( if (objPtr->bytes != NULL) { return (objPtr->length == 0); } - Tcl_GetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); return (length == 0); } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9d1595c..551da30 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1019,7 +1019,7 @@ DestroyEntry( * Tk_FreeOptions handle all the standard option-related stuff. */ - ckfree(entryPtr->string); + ckfree((char *)entryPtr->string); if (entryPtr->textVarName != NULL) { Tcl_UntraceVar(entryPtr->interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1034,7 +1034,7 @@ DestroyEntry( } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); if (entryPtr->displayString != entryPtr->string) { - ckfree(entryPtr->displayString); + ckfree((char *)entryPtr->displayString); } if (entryPtr->type == TK_SPINBOX) { Spinbox *sbPtr = (Spinbox *) entryPtr; @@ -1881,7 +1881,7 @@ EntryComputeGeometry( char *p; if (entryPtr->displayString != entryPtr->string) { - ckfree(entryPtr->displayString); + ckfree((char *)entryPtr->displayString); entryPtr->displayString = entryPtr->string; entryPtr->numDisplayBytes = entryPtr->numBytes; } @@ -2037,7 +2037,7 @@ InsertChars( return; } - ckfree(string); + ckfree((char *)string); entryPtr->string = newStr; /* @@ -2142,7 +2142,7 @@ DeleteChars( } ckfree(toDelete); - ckfree(entryPtr->string); + ckfree((char *)entryPtr->string); entryPtr->string = newStr; entryPtr->numChars -= count; entryPtr->numBytes -= byteCount; @@ -2318,13 +2318,13 @@ EntrySetValue( if (entryPtr->flags & VALIDATE_ABORT) { entryPtr->flags &= ~VALIDATE_ABORT; - ckfree(value); + ckfree((char *)value); return; } } oldSource = entryPtr->string; - ckfree(entryPtr->string); + ckfree((char *)entryPtr->string); if (malloced) { entryPtr->string = value; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index ce160a4..4fcc3db 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -230,7 +230,7 @@ PhotoFormatThreadExitProc( while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; - ckfree(freePtr->name); + ckfree((char *)freePtr->name); ckfree(freePtr); } } diff --git a/generic/tkMenu.c b/generic/tkMenu.c index c303c2f..70e8335 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1742,12 +1742,12 @@ PostProcessEntry( if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { - Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); + (void)Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); } if (mePtr->accelPtr == NULL) { mePtr->accelLength = 0; } else { - Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); + (void)Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); } /* diff --git a/generic/tkObj.c b/generic/tkObj.c index 1ccf3c5..b027b0f 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -33,7 +33,7 @@ typedef struct PixelRep { (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr1)) #define SET_COMPLEXPIXEL(objPtr, repPtr) \ - (objPtr)->internalRep.twoPtrValue.ptr1 = 0; \ + (objPtr)->internalRep.twoPtrValue.ptr1 = NULL; \ (objPtr)->internalRep.twoPtrValue.ptr2 = repPtr #define GET_COMPLEXPIXEL(objPtr) \ @@ -553,7 +553,7 @@ Tk_GetMMFromObj( } } - mmPtr = objPtr->internalRep.otherValuePtr; + mmPtr = objPtr->internalRep.twoPtrValue.ptr1; if (mmPtr->tkwin != tkwin) { d = mmPtr->value; if (mmPtr->units == -1) { @@ -592,8 +592,8 @@ static void FreeMMInternalRep( Tcl_Obj *objPtr) /* MM object with internal rep to free. */ { - ckfree(objPtr->internalRep.otherValuePtr); - objPtr->internalRep.otherValuePtr = NULL; + ckfree(objPtr->internalRep.twoPtrValue.ptr1); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } @@ -623,13 +623,13 @@ DupMMInternalRep( MMRep *oldPtr, *newPtr; copyPtr->typePtr = srcPtr->typePtr; - oldPtr = srcPtr->internalRep.otherValuePtr; + oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; newPtr = ckalloc(sizeof(MMRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; newPtr->returnValue = oldPtr->returnValue; - copyPtr->internalRep.otherValuePtr = newPtr; + copyPtr->internalRep.twoPtrValue.ptr1 = newPtr; } /* @@ -659,7 +659,7 @@ UpdateStringOfMM( char buffer[TCL_DOUBLE_SPACE]; register int len; - mmPtr = objPtr->internalRep.otherValuePtr; + mmPtr = objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); @@ -782,7 +782,7 @@ SetMMFromAny( mmPtr->tkwin = NULL; mmPtr->returnValue = d; - objPtr->internalRep.otherValuePtr = mmPtr; + objPtr->internalRep.twoPtrValue.ptr1 = mmPtr; return TCL_OK; } @@ -824,7 +824,7 @@ TkGetWindowFromObj( return result; } - winPtr = objPtr->internalRep.otherValuePtr; + winPtr = objPtr->internalRep.twoPtrValue.ptr1; if (winPtr->tkwin == NULL || winPtr->mainPtr == NULL || winPtr->mainPtr != mainPtr @@ -880,7 +880,7 @@ SetWindowFromAny( * Free the old internalRep before setting the new one. */ - Tcl_GetString(objPtr); + (void)Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); @@ -891,7 +891,7 @@ SetWindowFromAny( winPtr->mainPtr = NULL; winPtr->epoch = 0; - objPtr->internalRep.otherValuePtr = winPtr; + objPtr->internalRep.twoPtrValue.ptr1 = winPtr; objPtr->typePtr = &windowObjType; return TCL_OK; @@ -922,12 +922,12 @@ DupWindowInternalRep( { register WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.otherValuePtr; + oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; newPtr = ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; - copyPtr->internalRep.otherValuePtr = newPtr; + copyPtr->internalRep.twoPtrValue.ptr1 = newPtr; copyPtr->typePtr = srcPtr->typePtr; } @@ -953,8 +953,8 @@ static void FreeWindowInternalRep( Tcl_Obj *objPtr) /* Window object with internal rep to free. */ { - ckfree(objPtr->internalRep.otherValuePtr); - objPtr->internalRep.otherValuePtr = NULL; + ckfree(objPtr->internalRep.twoPtrValue.ptr1); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } @@ -985,7 +985,7 @@ TkNewWindowObj( SetWindowFromAny(NULL, objPtr); - winPtr = objPtr->internalRep.otherValuePtr; + winPtr = objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr->deletionEpoch; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index f9a69de..a77edce 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -939,7 +939,7 @@ Tk_ConfigureValue( Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { - ckfree(result); + ckfree((char *) result); } else { freeProc((char *) result); } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index eb92aae..733610e 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -2905,7 +2905,7 @@ ObjectIsEmpty( if (objPtr->bytes != NULL) { return (objPtr->length == 0); } - Tcl_GetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); return (length == 0); } diff --git a/generic/tkStyle.c b/generic/tkStyle.c index d5e1407..e7401df 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -146,8 +146,8 @@ static int SetStyleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The following structure defines the implementation of the "style" Tcl - * object, used for drawing. The internalRep.otherValuePtr field of each style - * object points to the Style structure for the stylefont, or NULL. + * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of each + * style object points to the Style structure for the stylefont, or NULL. */ static const Tcl_ObjType styleObjType = { @@ -1410,7 +1410,7 @@ Tk_AllocStyleFromObj( if (objPtr->typePtr != &styleObjType) { SetStyleFromAny(interp, objPtr); } - stylePtr = objPtr->internalRep.otherValuePtr; + stylePtr = objPtr->internalRep.twoPtrValue.ptr1; return (Tk_Style) stylePtr; } @@ -1442,7 +1442,7 @@ Tk_GetStyleFromObj( SetStyleFromAny(NULL, objPtr); } - return objPtr->internalRep.otherValuePtr; + return objPtr->internalRep.twoPtrValue.ptr1; } /* @@ -1497,7 +1497,7 @@ SetStyleFromAny( } objPtr->typePtr = &styleObjType; - objPtr->internalRep.otherValuePtr = Tk_GetStyle(interp, name); + objPtr->internalRep.twoPtrValue.ptr1 = Tk_GetStyle(interp, name); return TCL_OK; } @@ -1520,7 +1520,7 @@ static void FreeStyleObjProc( Tcl_Obj *objPtr) /* The object we are releasing. */ { - objPtr->internalRep.otherValuePtr = NULL; + objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; } @@ -1541,8 +1541,8 @@ DupStyleObjProc( Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.otherValuePtr = - srcObjPtr->internalRep.otherValuePtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = + srcObjPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTest.c b/generic/tkTest.c index 13415c4..88c50fa 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -223,7 +223,7 @@ Tktest_Init( if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; } - if (Tk_InitStubs(interp, "8.1", 0) == NULL) { + if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { return TCL_ERROR; } @@ -2002,14 +2002,14 @@ CustomOptionSet( } else if ((*value)->bytes != NULL) { objEmpty = ((*value)->length == 0); } else { - Tcl_GetStringFromObj((*value), &length); + (void)Tcl_GetStringFromObj(*value, &length); objEmpty = (length == 0); } if ((flags & TK_OPTION_NULL_OK) && objEmpty) { *value = NULL; } else { - string = Tcl_GetStringFromObj((*value), &length); + string = Tcl_GetStringFromObj(*value, &length); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", -1)); @@ -2017,8 +2017,8 @@ CustomOptionSet( } } if (internalPtr != NULL) { - if ((*value) != NULL) { - string = Tcl_GetStringFromObj((*value), &length); + if (*valu) != NULL) { + string = Tcl_GetStringFromObj(*value, &length); newStr = ckalloc(length + 1); strcpy(newStr, string); } else { diff --git a/generic/tkText.c b/generic/tkText.c index b3fbaa1..07de6ee 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -6617,7 +6617,7 @@ ObjectIsEmpty( if (objPtr->bytes != NULL) { return (objPtr->length == 0); } - Tcl_GetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); return (length == 0); } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 9e99a5d..62a2720 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1314,8 +1314,8 @@ EntryIndex( int *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ - int length; - const char *string = Tcl_GetStringFromObj(indexObj, &length); + const char *string = Tcl_GetString(indexObj); + size_t length = indexObj->length; if (strncmp(string, "end", length) == 0) { *indexPtr = entryPtr->entry.numChars; |