diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-10-11 21:58:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-10-11 21:58:15 (GMT) |
commit | b2a490e00b366529ee01568a6e3eb47fd718d59f (patch) | |
tree | a29d52a3dbbbf0de75a893365d283a51a95ad24c /generic | |
parent | 214d96af007b0c11714f5d497a37405807450a72 (diff) | |
parent | e5e9aa998d3fc89826a2546bf137cc70f70aa4ea (diff) | |
download | tk-b2a490e00b366529ee01568a6e3eb47fd718d59f.zip tk-b2a490e00b366529ee01568a6e3eb47fd718d59f.tar.gz tk-b2a490e00b366529ee01568a6e3eb47fd718d59f.tar.bz2 |
Merge 8.6. Some C++-fixes
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkBusy.c | 8 | ||||
-rw-r--r-- | generic/tkCanvPoly.c | 2 | ||||
-rw-r--r-- | generic/tkCanvText.c | 2 | ||||
-rw-r--r-- | generic/tkCanvas.c | 2 | ||||
-rw-r--r-- | generic/tkEntry.c | 2 | ||||
-rw-r--r-- | generic/tkFrame.c | 2 | ||||
-rw-r--r-- | generic/tkGrid.c | 2 | ||||
-rw-r--r-- | generic/tkImage.c | 9 | ||||
-rw-r--r-- | generic/tkListbox.c | 2 | ||||
-rw-r--r-- | generic/tkMain.c | 13 | ||||
-rw-r--r-- | generic/tkMenu.c | 12 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 4 | ||||
-rw-r--r-- | generic/tkPack.c | 2 | ||||
-rw-r--r-- | generic/tkSquare.c | 30 | ||||
-rw-r--r-- | generic/ttk/ttkClamTheme.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkDefaultTheme.c | 12 | ||||
-rw-r--r-- | generic/ttk/ttkElements.c | 14 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.c | 11 |
18 files changed, 54 insertions, 83 deletions
diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 8d40fc9..388d3fb 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -137,7 +137,7 @@ BusyCustodyProc( busyPtr); TkpHideBusyWindow(busyPtr); busyPtr->tkBusy = NULL; - Tcl_EventuallyFree(busyPtr, (Tcl_FreeProc *)DestroyBusy); + Tcl_EventuallyFree(busyPtr, DestroyBusy); } /* @@ -262,7 +262,7 @@ RefWinEventProc( * Arrange for the busy structure to be removed at a proper time. */ - Tcl_EventuallyFree(busyPtr, (Tcl_FreeProc *)DestroyBusy); + Tcl_EventuallyFree(busyPtr, DestroyBusy); break; case ConfigureNotify: @@ -383,7 +383,7 @@ BusyEventProc( if (eventPtr->type == DestroyNotify) { busyPtr->tkBusy = NULL; - Tcl_EventuallyFree(busyPtr, (Tcl_FreeProc *)DestroyBusy); + Tcl_EventuallyFree(busyPtr, DestroyBusy); } } @@ -918,7 +918,7 @@ Tk_BusyObjCmd( return TCL_ERROR; } TkpHideBusyWindow(busyPtr); - Tcl_EventuallyFree(busyPtr, (Tcl_FreeProc *)DestroyBusy); + Tcl_EventuallyFree(busyPtr, DestroyBusy); return TCL_OK; case BUSY_HOLD: diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 8c824b2..3d93afa 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -1741,7 +1741,7 @@ GetPolygonIndex( const char *p; p = string+1; - rest = strchr(p, ','); + rest = strchr((char *)p, ','); *rest = '\0'; if (Tcl_GetDouble(NULL, p, &x) != TCL_OK) { *rest = ','; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index b631ebd..abc050c 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -1506,7 +1506,7 @@ GetTextIndex( const char *p; p = string+1; - rest = strchr(p, ','); + rest = strchr((char *)p, ','); if (!rest) { goto badIndex; } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 355fd7b..12389a5 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -3328,7 +3328,7 @@ CanvasEventProc( if (canvasPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayCanvas, canvasPtr); } - Tcl_EventuallyFree(canvasPtr, (Tcl_FreeProc *) DestroyCanvas); + Tcl_EventuallyFree(canvasPtr, DestroyCanvas); } else if (eventPtr->type == ConfigureNotify) { canvasPtr->flags |= UPDATE_SCROLLBARS; diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 65018e9..07ab2d9 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2591,7 +2591,7 @@ EntryEventProc( if (entryPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayEntry, clientData); } - Tcl_EventuallyFree(clientData, (Tcl_FreeProc *) DestroyEntry); + Tcl_EventuallyFree(clientData, DestroyEntry); } break; case ConfigureNotify: diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 91ab80d..b0d2e85 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -1776,7 +1776,7 @@ FrameEventProc( Tcl_CancelIdleCall(DisplayFrame, framePtr); } Tcl_CancelIdleCall(MapFrame, framePtr); - Tcl_EventuallyFree(framePtr, (Tcl_FreeProc *) DestroyFrame); + Tcl_EventuallyFree(framePtr, DestroyFrame); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { framePtr->flags |= GOT_FOCUS; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 55f5ef4..6d72f31 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -2908,7 +2908,7 @@ GridStructureProc( Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; - Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); + Tcl_EventuallyFree(gridPtr, DestroyGrid); } else if (eventPtr->type == MapNotify) { if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { diff --git a/generic/tkImage.c b/generic/tkImage.c index acc6d1b..4291f33 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -86,7 +86,7 @@ static Tcl_ThreadDataKey dataKey; */ static void ImageTypeThreadExitProc(void *clientData); -static void DeleteImage(ImageModel *modelPtr); +static void DeleteImage(void *blockPtr); static void EventuallyDeleteImage(ImageModel *modelPtr, int forgetImageHashNow); @@ -935,7 +935,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr)); + DeleteImage(Tcl_GetHashValue(hPtr)); } /* @@ -958,10 +958,11 @@ Tk_DeleteImage( static void DeleteImage( - ImageModel *modelPtr) /* Pointer to main data structure for image. */ + void *blockPtr) /* Pointer to main data structure for image. */ { Image *imagePtr; Tk_ImageType *typePtr; + ImageModel *modelPtr = (ImageModel *)blockPtr; typePtr = modelPtr->typePtr; modelPtr->typePtr = NULL; @@ -1015,7 +1016,7 @@ EventuallyDeleteImage( } if (!modelPtr->deleted) { modelPtr->deleted = 1; - Tcl_EventuallyFree(modelPtr, (Tcl_FreeProc *) DeleteImage); + Tcl_EventuallyFree(modelPtr, DeleteImage); } } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6920f3a..e701dd3 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -2625,7 +2625,7 @@ ListboxEventProc( if (listPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayListbox, clientData); } - Tcl_EventuallyFree(clientData, (Tcl_FreeProc *) DestroyListbox); + Tcl_EventuallyFree(clientData, DestroyListbox); } } else if (eventPtr->type == ConfigureNotify) { int vertSpace; diff --git a/generic/tkMain.c b/generic/tkMain.c index 8db676c..949afca 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -23,6 +23,7 @@ extern int TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); */ static const char DEFAULT_PRIMARY_PROMPT[] = "% "; +static const char ENCODING_ERROR[] = "\n\t(encoding error in stderr)"; /* * This file can be compiled on Windows in UNICODE mode, as well as on all @@ -466,7 +467,9 @@ StdinProc( chan = Tcl_GetStdChannel(TCL_STDERR); if (chan != NULL) { - Tcl_WriteObj(chan, Tcl_GetObjResult(interp)); + if (Tcl_WriteObj(chan, Tcl_GetObjResult(interp)) < 0) { + Tcl_WriteChars(chan, ENCODING_ERROR, -1); + } Tcl_WriteChars(chan, "\n", 1); } } else if (isPtr->tty) { @@ -476,7 +479,9 @@ StdinProc( Tcl_IncrRefCount(resultPtr); (void)Tcl_GetStringFromObj(resultPtr, &length); if ((length > 0) && (chan != NULL)) { - Tcl_WriteObj(chan, resultPtr); + if (Tcl_WriteObj(chan, resultPtr) < 0) { + Tcl_WriteChars(chan, "\n\t(encoding error in stdout)", -1); + } Tcl_WriteChars(chan, "\n", 1); } Tcl_DecrRefCount(resultPtr); @@ -537,7 +542,9 @@ Prompt( "\n (script that generates prompt)"); chan = Tcl_GetStdChannel(TCL_STDERR); if (chan != NULL) { - Tcl_WriteObj(chan, Tcl_GetObjResult(interp)); + if (Tcl_WriteObj(chan, Tcl_GetObjResult(interp)) < 0) { + Tcl_WriteChars(chan, ENCODING_ERROR, -1); + } Tcl_WriteChars(chan, "\n", 1); } goto defaultPrompt; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index a16c6c4..e573a82 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -840,7 +840,7 @@ MenuWidgetObjCmd( } entryPtr = menuPtr->entries[index]->entryPtr; if (entryPtr) { - idStr = Tcl_GetHashKey(&menuPtr->items, entryPtr); + idStr = (const char *)Tcl_GetHashKey(&menuPtr->items, entryPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(idStr, TCL_INDEX_NONE)); } break; @@ -1218,7 +1218,7 @@ DestroyMenuInstance( */ Tcl_EventuallyFree(menuPtr->entries[i], - (Tcl_FreeProc*)DestroyMenuEntry); + DestroyMenuEntry); menuPtr->numEntries = i; } if (menuPtr->entries != NULL) { @@ -1663,7 +1663,7 @@ ConfigureMenu( } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { - Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry); + Tcl_EventuallyFree(menuListPtr->entries[0], DestroyMenuEntry); for (i = 0; i < (int)menuListPtr->numEntries - 1; i++) { menuListPtr->entries[i] = menuListPtr->entries[i + 1]; @@ -2197,7 +2197,7 @@ GetMenuIndex( entryPtr = Tcl_FindHashEntry(&menuPtr->items, string); if (entryPtr) { - TkMenuEntry *mePtr = Tcl_GetHashValue(entryPtr); + TkMenuEntry *mePtr = (TkMenuEntry *)Tcl_GetHashValue(entryPtr); *indexPtr = mePtr->index; return TCL_OK; } @@ -2458,7 +2458,7 @@ MenuAddOrInsert( errorMenuPtr != NULL; errorMenuPtr = errorMenuPtr->nextInstancePtr) { Tcl_EventuallyFree(errorMenuPtr->entries[index], - (Tcl_FreeProc *) DestroyMenuEntry); + DestroyMenuEntry); for (i = index; i < errorMenuPtr->numEntries - 1; i++) { errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1]; errorMenuPtr->entries[i]->index = i; @@ -3612,7 +3612,7 @@ DeleteMenuCloneEntries( for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { for (i = last; i >= first; i--) { - Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry); + Tcl_EventuallyFree(menuListPtr->entries[i], DestroyMenuEntry); } for (i = last + 1; i < (int)menuListPtr->numEntries; i++) { j = i - numDeleted; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index e9c3d7c..bb44763 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -734,7 +734,7 @@ FormatConfigInfo( } result = Tcl_Merge(5, argv); if (freeProc != NULL) { - if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { + if (freeProc == TCL_DYNAMIC) { ckfree((char *) argv[4]); } else { freeProc((char *) argv[4]); @@ -957,7 +957,7 @@ Tk_ConfigureValue( &freeProc); Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_INDEX_NONE)); if (freeProc != NULL) { - if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { + if (freeProc == TCL_DYNAMIC) { ckfree((char *) result); } else { freeProc((char *) result); diff --git a/generic/tkPack.c b/generic/tkPack.c index 38797a5..e82e3db 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1481,7 +1481,7 @@ PackStructureProc( Tcl_CancelIdleCall(ArrangePacking, packPtr); } packPtr->tkwin = NULL; - Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker); + Tcl_EventuallyFree(packPtr, DestroyPacker); } else if (eventPtr->type == MapNotify) { /* * When a container gets mapped, must redo the geometry computation so diff --git a/generic/tkSquare.c b/generic/tkSquare.c index a05ee70..b459148 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -98,7 +98,6 @@ static const Tk_OptionSpec optionSpecs[] = { static void SquareDeletedProc(void *clientData); static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr); -static void SquareDestroy(void *memPtr); static void SquareDisplay(void *clientData); static void KeepInWindow(Square *squarePtr); static void SquareObjEventProc(void *clientData, @@ -410,7 +409,7 @@ SquareObjEventProc( if (squarePtr->updatePending) { Tcl_CancelIdleCall(SquareDisplay, squarePtr); } - Tcl_EventuallyFree(squarePtr, (Tcl_FreeProc *) SquareDestroy); + Tcl_EventuallyFree(squarePtr, TCL_DYNAMIC); } } @@ -537,33 +536,6 @@ SquareDisplay( /* *---------------------------------------------------------------------- * - * SquareDestroy -- - * - * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to - * clean up the internal structure of a square at a safe time (when - * no-one is using it anymore). - * - * Results: - * None. - * - * Side effects: - * Everything associated with the square is freed up. - * - *---------------------------------------------------------------------- - */ - -static void -SquareDestroy( - void *memPtr) /* Info about square widget. */ -{ - Square *squarePtr = (Square *)memPtr; - - ckfree(squarePtr); -} - -/* - *---------------------------------------------------------------------- - * * KeepInWindow -- * * Adjust the position of the square if necessary to keep it in the diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 81c5641..7731377 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -485,10 +485,10 @@ static void IndicatorElementDraw( * Update the colors within svgDataCopy */ - upperBdColorPtr = strstr(svgDataPtr, "9e9a91"); - lowerBdColorPtr = strstr(svgDataPtr, "cfcdc8"); - bgColorPtr = strstr(svgDataPtr, "ffffff"); - fgColorPtr = strstr(svgDataPtr, "000000"); + upperBdColorPtr = strstr((char *)svgDataPtr, "9e9a91"); + lowerBdColorPtr = strstr((char *)svgDataPtr, "cfcdc8"); + bgColorPtr = strstr((char *)svgDataPtr, "ffffff"); + fgColorPtr = strstr((char *)svgDataPtr, "000000"); assert(upperBdColorPtr); assert(lowerBdColorPtr); diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index e9f001a..2be365e 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -657,12 +657,12 @@ static void IndicatorElementDraw( * Update the colors within svgDataCopy */ - shadeColorPtr = strstr(svgDataPtr, "888888"); - highlightColorPtr = strstr(svgDataPtr, "eeeeee"); - borderColorPtr = strstr(svgDataPtr, "414141"); - bgColorPtr = strstr(svgDataPtr, "d9d9d9"); - indicatorColorPtr = strstr(svgDataPtr, "ffffff"); - fgColorPtr = strstr(svgDataPtr, "000000"); + shadeColorPtr = strstr((char *)svgDataPtr, "888888"); + highlightColorPtr = strstr((char *)svgDataPtr, "eeeeee"); + borderColorPtr = strstr((char *)svgDataPtr, "414141"); + bgColorPtr = strstr((char *)svgDataPtr, "d9d9d9"); + indicatorColorPtr = strstr((char *)svgDataPtr, "ffffff"); + fgColorPtr = strstr((char *)svgDataPtr, "000000"); assert(shadeColorPtr); assert(highlightColorPtr); diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index bbe5a95..17bc1ae 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -799,8 +799,8 @@ static void IndicatorElementDraw( * Update the colors within svgDataCopy */ if (selected || tristate) { - bgColorPtr = strstr(svgDataPtr, "4a6984"); - fgColorPtr = strstr(svgDataPtr, "ffffff"); + bgColorPtr = strstr((char *)svgDataPtr, "4a6984"); + fgColorPtr = strstr((char *)svgDataPtr, "ffffff"); assert(bgColorPtr); assert(fgColorPtr); @@ -808,8 +808,8 @@ static void IndicatorElementDraw( memcpy(bgColorPtr, bgColorStr, 6); memcpy(fgColorPtr, fgColorStr, 6); } else { - bgColorPtr = strstr(svgDataPtr, "ffffff"); - borderColorPtr = strstr(svgDataPtr, "888888"); + bgColorPtr = strstr((char *)svgDataPtr, "ffffff"); + borderColorPtr = strstr((char *)svgDataPtr, "888888"); assert(bgColorPtr); assert(borderColorPtr); @@ -1430,9 +1430,9 @@ static void SliderElementDraw( /* * Update the colors within svgDataCopy */ - innerColorPtr = strstr(svgDataPtr, "4a6984"); - outerColorPtr = strstr(svgDataPtr, "ffffff"); - borderColorPtr = strstr(svgDataPtr, "c3c3c3"); + innerColorPtr = strstr((char *)svgDataPtr, "4a6984"); + outerColorPtr = strstr((char *)svgDataPtr, "ffffff"); + borderColorPtr = strstr((char *)svgDataPtr, "c3c3c3"); assert(innerColorPtr); assert(outerColorPtr); assert(borderColorPtr); diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index d395caa..d819af7 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -202,15 +202,6 @@ WidgetInstanceObjCmdDeleted(ClientData clientData) Tk_DestroyWindow(corePtr->tkwin); } -/* FreeWidget -- - * Final cleanup for widget; called via Tcl_EventuallyFree(). - */ -static void -FreeWidget(void *memPtr) -{ - ckfree(memPtr); -} - /* DestroyWidget -- * Main widget destructor; called from <DestroyNotify> event handler. */ @@ -239,7 +230,7 @@ DestroyWidget(WidgetCore *corePtr) /* NB: this can reenter the interpreter via a command traces */ Tcl_DeleteCommandFromToken(corePtr->interp, cmd); } - Tcl_EventuallyFree(corePtr, (Tcl_FreeProc *) FreeWidget); + Tcl_EventuallyFree(corePtr, TCL_DYNAMIC); } /* |