Skip to content

Commit

Permalink
Backport indenting from Tk 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Dec 5, 2024
1 parent 7d132b5 commit ca57aed
Show file tree
Hide file tree
Showing 19 changed files with 253 additions and 252 deletions.
4 changes: 2 additions & 2 deletions generic/tkDList.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void \
LT##_Free(struct ElemType *elem) \
{ \
LT##_Remove(elem); \
ckfree((void *)elem); \
ckfree((char *)elem); \
} \
\
__TK_DLIST_UNUSED \
Expand Down Expand Up @@ -508,7 +508,7 @@ LT##_Clear(LT *head) \
assert(head); \
for (p = head->first; p; p = next) { \
next = LT##_Next(p); \
ckfree((void *)p); \
ckfree((char *)p); \
} \
LT##_Init(head); \
} \
Expand Down
14 changes: 7 additions & 7 deletions generic/tkEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ DestroyEntry(
* Tk_FreeOptions handle all the standard option-related stuff.
*/

ckfree((void *)entryPtr->string);
ckfree((char *)entryPtr->string);
if (entryPtr->textVarNameObj != NULL) {
Tcl_UntraceVar2(entryPtr->interp, Tcl_GetString(entryPtr->textVarNameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
Expand All @@ -1059,7 +1059,7 @@ DestroyEntry(
}
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
if (entryPtr->displayString != entryPtr->string) {
ckfree((void *)entryPtr->displayString);
ckfree((char *)entryPtr->displayString);
}
if (entryPtr->type == TK_SPINBOX) {
Spinbox *sbPtr = (Spinbox *) entryPtr;
Expand Down Expand Up @@ -1984,7 +1984,7 @@ EntryComputeGeometry(
char *p;

if (entryPtr->displayString != entryPtr->string) {
ckfree((void *)entryPtr->displayString);
ckfree((char *)entryPtr->displayString);
entryPtr->displayString = entryPtr->string;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
Expand Down Expand Up @@ -2192,7 +2192,7 @@ InsertChars(
return TCL_OK;
}

ckfree((void *)string);
ckfree((char *)string);
entryPtr->string = newStr;

/*
Expand Down Expand Up @@ -2298,7 +2298,7 @@ DeleteChars(
}

ckfree(toDelete);
ckfree((void *)entryPtr->string);
ckfree((char *)entryPtr->string);
entryPtr->string = newStr;
entryPtr->numChars -= count;
entryPtr->numBytes -= byteCount;
Expand Down Expand Up @@ -2488,13 +2488,13 @@ EntrySetValue(

if (entryPtr->flags & VALIDATE_ABORT) {
entryPtr->flags &= ~VALIDATE_ABORT;
ckfree((void *)value);
ckfree((char *)value);
return;
}
}

oldSource = entryPtr->string;
ckfree((void *)entryPtr->string);
ckfree((char *)entryPtr->string);

if (malloced) {
entryPtr->string = value;
Expand Down
4 changes: 2 additions & 2 deletions generic/tkImgPhoto.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ PhotoFormatThreadExitProc(
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
ckfree((void *)freePtr->name);
ckfree((char *)freePtr->name);
ckfree(freePtr);
}
while (tsdPtr->formatListVersion3 != NULL) {
freePtrVersion3 = tsdPtr->formatListVersion3;
tsdPtr->formatListVersion3 = tsdPtr->formatListVersion3->nextPtr;
ckfree((void *)freePtrVersion3->name);
ckfree((char *)freePtrVersion3->name);
ckfree(freePtrVersion3);
}
}
Expand Down
8 changes: 4 additions & 4 deletions win/nmakehlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ main(
case 'l':
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
Expand Down Expand Up @@ -493,9 +493,9 @@ IsIn(

/*
* GetVersionFromFile --
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
*/

static const char *
Expand Down
7 changes: 3 additions & 4 deletions win/tkWinButton.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ TkpDisplayButton(
XSetClipOrigin(butPtr->display, gc, 0, 0);
}
if ((butPtr->state == STATE_DISABLED) &&
(butPtr->disabledFg != NULL)) {
(butPtr->disabledFg != NULL)) {
COLORREF oldFgColor = gc->foreground;

if (gc->background == GetSysColor(COLOR_BTNFACE)) {
Expand Down Expand Up @@ -827,10 +827,9 @@ TkpDisplayButton(
if (gc->background == GetSysColor(COLOR_BTNFACE)) {
gc->foreground = GetSysColor(COLOR_3DHILIGHT);
Tk_DrawTextLayout(butPtr->display, pixmap, gc,
butPtr->textLayout,
x + 1, y + 1, 0, -1);
butPtr->textLayout, x + 1, y + 1, 0, -1);
Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
butPtr->textLayout, x + 1, y + 1, butPtr->underline);
butPtr->textLayout, x + 1, y + 1, butPtr->underline);
gc->foreground = oldFgColor;
}
}
Expand Down
4 changes: 2 additions & 2 deletions win/tkWinColor.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ TkpGetColor(

XAllocColor(Tk_Display(tkwin), Tk_Colormap(tkwin),
&winColPtr->info.color);
return (TkColor *) winColPtr;
return (TkColor *)winColPtr;
}
return (TkColor *) NULL;
return (TkColor *)NULL;
}

/*
Expand Down
26 changes: 13 additions & 13 deletions win/tkWinDialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr,
enum OFNOper oper);
static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
enum OFNOper oper);
static int GetFileName(void *clientData,
static int GetFileName(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], enum OFNOper oper);
static int MakeFilterVista(Tcl_Interp *interp, OFNOpts *optsPtr,
DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr,
DWORD *defaultFilterIndexPtr);
static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr);
static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
Tcl_DString *dsPtr, Tcl_Obj *initialPtr,
int *indexPtr);
static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam,
Expand All @@ -601,24 +601,24 @@ static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *);
* to the window underneath. If the window underneath happens to be a
* windows control (eg a button) then it will be activated by accident.
*
* This problem does not occur in dialog boxes, because windows must do
* some special processing to solve the problem. (separate message
* processing functions are used to cope with keyboard navigation of
* controls.)
* This problem does not occur in dialog boxes, because windows must do
* some special processing to solve the problem. (separate message
* processing functions are used to cope with keyboard navigation of
* controls.)
*
* Here is one solution. After returning, we flush all mouse events
* Here is one solution. After returning, we flush all mouse events
* for 1/4 second. In 8.6.5 and earlier, the code used to
* poll the message queue consuming WM_LBUTTONUP messages.
* On seeing a WM_LBUTTONDOWN message, it would exit early, since the user
* must be doing something new. However this early exit does not work
* On seeing a WM_LBUTTONDOWN message, it would exit early, since the user
* must be doing something new. However this early exit does not work
* on Vista and later because the Windows sends both BUTTONDOWN and
* BUTTONUP after the DBLCLICK instead of just BUTTONUP as on XP.
* Rather than try and figure out version specific sequences, we
* ignore all mouse events in that interval.
*
* This fix only works for the current application, so the problem will
* still occur if the open dialog happens to be over another applications
* button. However this is a fairly rare occurrance.
* still occur if the open dialog happens to be over another applications
* button. However this is a fairly rare occurrance.
*
* Results:
* None.
Expand Down Expand Up @@ -1436,7 +1436,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,

ConvertExternalFilename(wstr, &fnds);
resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
Tcl_DStringLength(&fnds));
Tcl_DStringLength(&fnds));
CoTaskMemFree(wstr);
Tcl_DStringFree(&fnds);
}
Expand Down Expand Up @@ -1814,7 +1814,7 @@ GetFileName(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects. */
enum OFNOper oper) /* 1 to call GetOpenFileName(), 0 to call
enum OFNOper oper) /* 1 to call GetOpenFileName(), 0 to call
* GetSaveFileName(). */
{
OFNOpts ofnOpts;
Expand Down
2 changes: 1 addition & 1 deletion win/tkWinDraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TkWinGetDrawableDC(
if (twdPtr->type == TWD_WINDOW) {
TkWindow *winPtr = twdPtr->window.winPtr;

dc = GetDC(twdPtr->window.handle);
dc = GetDC(twdPtr->window.handle);
if (winPtr == NULL) {
cmap = DefaultColormap(display, DefaultScreen(display));
} else {
Expand Down
4 changes: 2 additions & 2 deletions win/tkWinEmbed.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Tk_UseWindow(
id = SendMessageW(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
if (id == PTR2INT(hwnd)) {
if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"The container is already in use", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "IN_USE", NULL);
return TCL_ERROR;
Expand All @@ -312,7 +312,7 @@ Tk_UseWindow(
wsprintfW(msg, L"Unable to get information of window \"%.40hs\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string);
if (IDCANCEL == MessageBoxW(hwnd, msg, L"Tk Warning",
MB_OKCANCEL | MB_ICONWARNING)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Operation has been canceled", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "CANCEL", NULL);
return TCL_ERROR;
Expand Down
10 changes: 5 additions & 5 deletions win/tkWinFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ void
TkpGetFontAttrsForChar(
Tk_Window tkwin, /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
int c, /* Character of interest */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
WinFont *fontPtr = (WinFont *) tkfont;
Expand Down Expand Up @@ -1622,7 +1622,7 @@ InitFont(
fmPtr->maxWidth = tm.tmMaxCharWidth;
fmPtr->fixed = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);

fontPtr->numSubFonts = 1;
fontPtr->numSubFonts = 1;
fontPtr->subFontArray = fontPtr->staticSubFonts;
InitSubFont(hdc, hFont, 1, &fontPtr->subFontArray[0]);

Expand Down Expand Up @@ -1694,7 +1694,7 @@ InitSubFont(
int base, /* Non-zero if this SubFont is being used as
* the base font for a font object. */
SubFont *subFontPtr) /* Filled with SubFont constructed from above
* attributes. */
* attributes. */
{
subFontPtr->hFont0 = hFont;
subFontPtr->familyPtr = AllocFontFamily(hdc, hFont, base);
Expand Down Expand Up @@ -1883,7 +1883,7 @@ FreeFontFamily(
return;
}
if (familyPtr->refCount-- > 1) {
return;
return;
}
for (i = 0; i < FONTMAP_PAGES; i++) {
if (familyPtr->fontMap[i] != NULL) {
Expand Down Expand Up @@ -2443,7 +2443,7 @@ CanUseFallback(
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
SubFont *newPtr;

newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
memcpy(newPtr, fontPtr->subFontArray,
fontPtr->numSubFonts * sizeof(SubFont));
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
Expand Down
26 changes: 14 additions & 12 deletions win/tkWinGDI.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static const struct gdi_command {
*
* GdiArc --
*
* Map canvas arcs to GDI context.
* Map canvas arcs to GDI context.
*
* Results:
* Renders arcs.
Expand Down Expand Up @@ -290,8 +290,8 @@ static int GdiArc(
*
* GdiBitmap --
*
* Unimplemented for now. Should use the same techniques as
* CanvasPsBitmap (tkCanvPs.c).
* Unimplemented for now. Should use the same techniques as
* CanvasPsBitmap (tkCanvPs.c).
*
* Results:
* None.
Expand Down Expand Up @@ -676,9 +676,9 @@ static int GdiLine(
return TCL_ERROR;
}
if ((Tcl_GetIntFromObj(interp, objv[2], (int *)&polypoints[0].x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK)
) {
return TCL_ERROR;
}
Expand Down Expand Up @@ -1366,7 +1366,8 @@ static int GdiCharWidths(

HDC hDC;
LOGFONTW lf;
HFONT hfont, oldfont;
HFONT hfont;
HGDIOBJ oldfont;
int made_font = 0;
const char *aryvarname = "GdiCharWidths";
/* For now, assume 256 characters in the font.... */
Expand Down Expand Up @@ -1481,9 +1482,10 @@ int GdiText(
const char *string = 0;
RECT sizerect;
UINT format_flags = DT_EXPANDTABS|DT_NOPREFIX; /* Like the canvas. */
Tk_Anchor anchor = 0;
Tk_Anchor anchor = TK_ANCHOR_N;
LOGFONTW lf;
HFONT hfont, oldfont;
HFONT hfont;
HGDIOBJ oldfont;
int made_font = 0;
int retval;
int dotextcolor = 0;
Expand Down Expand Up @@ -3114,7 +3116,7 @@ static HBITMAP CopyScreenToBitmap(
LPRECT lpRect)
{
HDC hScrDC, hMemDC; /* Screen DC and memory DC. */
HBITMAP hBitmap, hOldBitmap; /* Handles to deice-dependent bitmaps. */
HGDIOBJ hBitmap, hOldBitmap; /* Handles to deice-dependent bitmaps. */
int nX, nY, nX2, nY2; /* Coordinates of rectangle to grab. */
int nWidth, nHeight; /* DIB width and height */
int xScrn, yScrn; /* Screen resolution. */
Expand Down Expand Up @@ -3186,7 +3188,7 @@ static HBITMAP CopyScreenToBitmap(

/* Return handle to the bitmap. */

return hBitmap;
return (HBITMAP)hBitmap;
}

/*
Expand Down Expand Up @@ -3230,7 +3232,7 @@ static HANDLE BitmapToDIB(
/* Ff no palette is specified, use default palette. */

if (hPal == NULL) {
hPal = GetStockObject(DEFAULT_PALETTE);
hPal = (HPALETTE)GetStockObject(DEFAULT_PALETTE);
}

/* Calculate bits per pixel. */
Expand Down
Loading

0 comments on commit ca57aed

Please sign in to comment.