From 229640003624b9acf35b7559855fc8e418596943 Mon Sep 17 00:00:00 2001 From: das Date: Sun, 7 Dec 2008 16:36:26 +0000 Subject: Remove/disable dead code flagged by clang static analyzer --- macosx/tkMacOSXDialog.c | 8 +++----- macosx/tkMacOSXMenu.c | 8 ++++---- macosx/tkMacOSXMenubutton.c | 6 ++---- macosx/tkMacOSXMenus.c | 4 ++-- macosx/tkMacOSXScrlbr.c | 9 +++++---- macosx/tkMacOSXSend.c | 12 +++++------- macosx/tkMacOSXWm.c | 4 +--- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index e592e3c..1553592 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.41 2008/12/07 16:34:12 das Exp $ + * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.42 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -135,7 +135,6 @@ Tk_ChooseColorObjCmd( Tk_Window parent, tkwin = clientData; const char *title; int i, srcRead, dstWrote; - CMError cmerr; CMProfileRef prof; NColorPickerInfo cpinfo; static RGBColor color = {0xffff, 0xffff, 0xffff}; @@ -196,7 +195,7 @@ Tk_ChooseColorObjCmd( } } - cmerr = CMGetDefaultProfileBySpace(cmRGBData, &prof); + ChkErr(CMGetDefaultProfileBySpace, cmRGBData, &prof); cpinfo.theColor.profile = prof; cpinfo.dstProfile = prof; cpinfo.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal; @@ -209,7 +208,7 @@ Tk_ChooseColorObjCmd( TkMacOSXTrackingLoop(1); err = ChkErr(NPickColor, &cpinfo); TkMacOSXTrackingLoop(0); - cmerr = CMCloseProfile(prof); + ChkErr(CMCloseProfile, prof); if ((err == noErr) && (cpinfo.newColorChosen != 0)) { char colorstr[8]; @@ -1599,7 +1598,6 @@ Tk_MessageBoxObjCmd( * we do this here. */ - str = Tcl_GetString(objv[indexDefaultOption + 1]); if (Tcl_GetIndexFromObj(interp, objv[indexDefaultOption + 1], movableButtonStrings, "value", TCL_EXACT, &defaultButtonIndex) != TCL_OK) { diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 366b222..73ccbae 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.47 2008/12/07 16:30:09 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.48 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -3194,8 +3194,8 @@ TkpComputeStandardMenuGeometry( &activeBorderWidth); x = y = borderWidth; indicatorSpace = labelWidth = accelWidth = maxAccelTextWidth = 0; - windowHeight = windowWidth = maxWidth = lastColumnBreak = 0; - maxModifierWidth = nonAccelMargin = maxNonAccelMargin = 0; + windowHeight = maxWidth = lastColumnBreak = 0; + maxModifierWidth = maxNonAccelMargin = 0; maxEntryWithAccelWidth = maxEntryWithoutAccelWidth = 0; maxIndicatorSpace = 0; @@ -3265,7 +3265,7 @@ TkpComputeStandardMenuGeometry( lastColumnBreak = i; y = borderWidth; } - geometryPtr = (EntryGeometry *) mePtr->platformEntryData; + /*geometryPtr = (EntryGeometry *) mePtr->platformEntryData;*/ /* dead code */ if (mePtr->type == SEPARATOR_ENTRY) { GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index ee13904..70d85a5 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.19 2008/11/08 18:44:40 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.20 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -446,7 +446,7 @@ void TkpComputeMenuButtonGeometry( register TkMenuButton *mbPtr) /* Widget record for menu button. */ { - int width, height, mm, pixels; + int width, height; int hasImageOrBitmap = 0; mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth; @@ -490,8 +490,6 @@ TkpComputeMenuButtonGeometry( width += TK_POPUP_OFFSET; } if (mbPtr->indicatorOn) { - mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin)); - pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin)); mbPtr->indicatorHeight = kTriangleHeight; mbPtr->indicatorWidth = kTriangleWidth + kTriangleMargin; width += mbPtr->indicatorWidth; diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index e1b0446..89867fe 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.22 2008/10/05 18:22:21 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.23 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -376,7 +376,7 @@ GenerateEditEvent( XQueryPointer(NULL, None, NULL, NULL, &event.x_root, &event.y_root, &x, &y, &event.state); - tkwin = Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); + Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); event.same_screen = true; switch (flag) { diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index ccf1991..1a071f3 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.28 2008/11/08 18:44:40 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.29 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -562,7 +562,8 @@ ThumbActionProc( GetControlReference(theControl); MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; Tcl_DString cmdString; - int origValue, variant; + /*int origValue;*/ /* dead code */ + int variant; short trackBarSize; double oldFirstFraction, newFirstFraction; char valueString[40]; @@ -577,7 +578,7 @@ ThumbActionProc( } Tcl_DStringInit(&cmdString); - origValue = GetControl32BitValue(macScrollPtr->sbHandle); + /*origValue = GetControl32BitValue(macScrollPtr->sbHandle);*/ /* dead code */ GetControlBounds(macScrollPtr->sbHandle, &trackRect); if (scrollPtr->vertical) { @@ -789,7 +790,7 @@ ScrollbarBindProc( mouseDownPoint.h = where.h; mouseDownPoint.v = where.v; - part = HandleControlClick(macScrollPtr->sbHandle, where, + HandleControlClick(macScrollPtr->sbHandle, where, TkMacOSXModifierState(), thumbActionProc); } else if (part == kAppearancePartIndicator) { /* diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c index 52da21a..d46b017 100644 --- a/macosx/tkMacOSXSend.c +++ b/macosx/tkMacOSXSend.c @@ -30,7 +30,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXSend.c,v 1.11 2008/10/17 23:18:38 nijtmans Exp $ + * RCS: @(#) $Id: tkMacOSXSend.c,v 1.12 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXInt.h" @@ -256,7 +256,7 @@ Tk_SetAppName( Tcl_IncrRefCount(resultObjPtr); for (i = 0; ; ) { result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr); - if (interpNamePtr == NULL) { + if (result != TCL_OK || interpNamePtr == NULL) { break; } interpName = Tcl_GetString(interpNamePtr); @@ -329,10 +329,10 @@ Tk_SendObjCmd( { const char *const sendOptions[] = {"-async", "-displayof", "-", NULL}; char *stringRep, *destName; - int async = 0; + /*int async = 0;*/ int i, index, firstArg; RegisteredInterp *riPtr; - Tcl_Obj *resultPtr, *listObjPtr; + Tcl_Obj *listObjPtr; int result = TCL_OK; for (i = 1; i < (objc - 1); ) { @@ -343,7 +343,7 @@ Tk_SendObjCmd( return TCL_ERROR; } if (index == 0) { - async = 1; + /*async = 1;*/ i++; } else if (index == 1) { i += 2; @@ -364,8 +364,6 @@ Tk_SendObjCmd( destName = Tcl_GetString(objv[i]); firstArg = i + 1; - resultPtr = Tcl_GetObjResult(interp); - /* * See if the target interpreter is local. If so, execute the command * directly without going through the DDE server. The only tricky thing is diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index bf2100b..96605c8 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.72 2008/11/18 23:49:43 nijtmans Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.73 2008/12/07 16:36:26 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -3337,7 +3337,6 @@ UpdateGeometryInfo( TkWindow *winPtr = clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; - unsigned long serial; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -3502,7 +3501,6 @@ UpdateGeometryInfo( } return; } - serial = NextRequest(winPtr->display); if (wmPtr->flags & WM_MOVE_PENDING) { wmPtr->configWidth = width; wmPtr->configHeight = height; -- cgit v0.12