From 4240bad9540eb94ede3be8055f42064d2f4a6f88 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Mar 2024 16:16:24 +0000 Subject: Don't use "boolean" as variable name --- generic/tkTest.c | 6 +++--- macosx/tkMacOSXWm.c | 44 ++++++++++++++++++++++---------------------- unix/tkUnixWm.c | 8 ++++---- win/tkWinWm.c | 18 +++++++++--------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/generic/tkTest.c b/generic/tkTest.c index 49fd93f..4d96ad3 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -821,7 +821,7 @@ TestobjconfigObjCmd( typedef struct { TrivialCommandHeader header; - int boolean; + int boolValue; int integer; double doubleValue; char *string; @@ -845,7 +845,7 @@ TestobjconfigObjCmd( }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", - TCL_INDEX_NONE, offsetof(InternalRecord, boolean), TK_CONFIG_NULL_OK, 0, 0x1}, + TCL_INDEX_NONE, offsetof(InternalRecord, boolValue), TK_CONFIG_NULL_OK, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237", TCL_INDEX_NONE, offsetof(InternalRecord, integer), 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", @@ -909,7 +909,7 @@ TestobjconfigObjCmd( recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; - recordPtr->boolean = 0; + recordPtr->boolValue = 0; recordPtr->integer = 0; recordPtr->doubleValue = 0.0; recordPtr->string = NULL; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index dafd94f..1df9cc5 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1624,7 +1624,7 @@ WmSetAttribute( Tcl_Obj *value) /* New value */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - int boolean; + int boolValue; NSString *identifier; switch (attribute) { @@ -1700,10 +1700,10 @@ WmSetAttribute( break; } case WMATT_FULLSCREEN: - if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } - if (boolean != (([macWindow styleMask] & NSFullScreenWindowMask) != 0)) { + if (boolValue != (([macWindow styleMask] & NSFullScreenWindowMask) != 0)) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 [macWindow toggleFullScreen:macWindow]; #else @@ -1712,28 +1712,28 @@ WmSetAttribute( } break; case WMATT_MODIFIED: - if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } - if (boolean != [macWindow isDocumentEdited]) { - [macWindow setDocumentEdited:(BOOL)boolean]; + if (boolValue != [macWindow isDocumentEdited]) { + [macWindow setDocumentEdited:(BOOL)boolValue]; } break; case WMATT_NOTIFY: - if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } - if (boolean == !tkMacOSXWmAttrNotifyVal) { + if (boolValue == !tkMacOSXWmAttrNotifyVal) { static NSInteger request = -1; if (request >= 0) { [NSApp cancelUserAttentionRequest:request]; request = -1; } - if (boolean) { + if (boolValue) { request = [NSApp requestUserAttention:NSCriticalRequest]; } - tkMacOSXWmAttrNotifyVal = boolean; + tkMacOSXWmAttrNotifyVal = boolValue; } break; case WMATT_STYLEMASK: { @@ -1862,13 +1862,13 @@ WmSetAttribute( break; } case WMATT_TOPMOST: - if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } - if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) { + if (boolValue != ((wmPtr->flags & WM_TOPMOST) != 0)) { int oldFlags = wmPtr->flags; - if (boolean) { + if (boolValue) { wmPtr->flags |= WM_TOPMOST; } else { wmPtr->flags &= ~WM_TOPMOST; @@ -1878,14 +1878,14 @@ WmSetAttribute( } break; case WMATT_TRANSPARENT: - if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } - if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) { + if (boolValue != ((wmPtr->flags & WM_TRANSPARENT) != 0)) { UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; - if (boolean) { + if (boolValue) { wmPtr->flags |= WM_TRANSPARENT; wmPtr->attributes |= kWindowNoShadowAttribute; } else { @@ -1894,8 +1894,8 @@ WmSetAttribute( } ApplyWindowAttributeFlagChanges(winPtr, macWindow, oldAttributes, oldFlags, 1, 0); - [macWindow setBackgroundColor:boolean ? [NSColor clearColor] : nil]; - [macWindow setOpaque:!boolean]; + [macWindow setBackgroundColor:boolValue ? [NSColor clearColor] : nil]; + [macWindow setOpaque:!boolValue]; TkMacOSXInvalidateWindow((MacDrawable *)winPtr->window, TK_PARENT_WINDOW); } @@ -3624,7 +3624,7 @@ WmOverrideredirectCmd( Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int flag; + Bool boolValue; XSetWindowAttributes atts; TKWindow *win = (TKWindow *)TkMacOSXGetNSWindowForDrawable(winPtr->window); @@ -3639,13 +3639,13 @@ WmOverrideredirectCmd( return TCL_OK; } - if (Tcl_GetBooleanFromObj(interp, objv[3], &flag) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } - atts.override_redirect = flag ? True : False; + atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); if ([NSApp macOSVersion] >= 101300) { - if (flag) { + if (boolValue) { win.styleMask |= NSWindowStyleMaskDocModalWindow; } else { win.styleMask &= ~NSWindowStyleMaskDocModalWindow; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 7526e3a..0424218 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -2929,7 +2929,7 @@ WmOverrideredirectCmd( Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int boolean, curValue; + Bool boolValue, curValue; XSetWindowAttributes atts; if ((objc != 3) && (objc != 4)) { @@ -2941,16 +2941,16 @@ WmOverrideredirectCmd( Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0)); return TCL_OK; } - if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } - if (curValue != boolean) { + if (curValue != boolValue) { /* * Only do this if we are really changing value, because it causes * some funky stuff to occur */ - atts.override_redirect = (boolean) ? True : False; + atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); if (winPtr->wmInfoPtr->wrapperPtr != NULL) { diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 16072d7..5c42ee5 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -2914,7 +2914,7 @@ WmAttributesCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; - int boolean; + Bool boolValue; Tcl_Size i, length; int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; @@ -3090,7 +3090,7 @@ WmAttributesCmd( } } else { if ((i < objc-1) - && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) + && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolValue) != TCL_OK) { return TCL_ERROR; } @@ -3100,13 +3100,13 @@ WmAttributesCmd( (wmPtr->flags & WM_FULLSCREEN) != 0)); } else { fullscreen_attr_changed = 1; - fullscreen_attr = boolean; + fullscreen_attr = boolValue; } config_fullscreen = 0; } else if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj((*stylePtr & styleBit) != 0)); - } else if (boolean) { + } else if (boolValue) { *stylePtr |= styleBit; } else { *stylePtr &= ~styleBit; @@ -4733,7 +4733,7 @@ WmOverrideredirectCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - int boolean, curValue; + Bool boolValue, curValue; XSetWindowAttributes atts; if ((objc != 3) && (objc != 4)) { @@ -4755,19 +4755,19 @@ WmOverrideredirectCmd( Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0)); return TCL_OK; } - if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } - if (curValue != boolean) { + if (curValue != boolValue) { if (winPtr->flags & TK_EMBEDDED) { - SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); + SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolValue, 0); } else { /* * Only do this if we are really changing value, because it causes * some funky stuff to occur. */ - atts.override_redirect = (boolean) ? True : False; + atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); if (!(wmPtr->flags & (WM_NEVER_MAPPED)) -- cgit v0.12 From efb0baaed5df995abbbc5210bf0d3ea8d6bf5120 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 29 Mar 2024 14:39:52 +0000 Subject: Fix [c2b8a44bb9]: compiler warnings about ckfree() --- generic/tkOldConfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 36ad95a..55765e2 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -735,7 +735,7 @@ FormatConfigInfo( result = Tcl_Merge(5, argv); if (freeProc != NULL) { if (freeProc == TCL_DYNAMIC) { - ckfree(argv[4]); + ckfree((char *)argv[4]); } else { freeProc((char *)argv[4]); } @@ -958,7 +958,7 @@ Tk_ConfigureValue( Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_INDEX_NONE)); if (freeProc != NULL) { if (freeProc == TCL_DYNAMIC) { - ckfree(result); + ckfree((char *)result); } else { freeProc((char *)result); } -- cgit v0.12