From e3cc01895622b0949e83b829d84a4cb1fbedce4f Mon Sep 17 00:00:00 2001 From: patthoyts Date: Tue, 3 Mar 2009 23:54:10 +0000 Subject: Backported some fixes for uninitialized variables identified by das using clang analysis. --- ChangeLog | 6 ++++++ generic/tkFileFilter.c | 4 ++-- generic/tkFont.c | 4 ++-- generic/tkListbox.c | 7 ++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33ed7ce..bacee82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-03 Pat Thoyts + + * generic/tkFileFilter.c: Backported some fixes for uninitialized + * generic/tkFont.c: variables identified by das using clang + * generic/tkListbox.c: analysis. + 2009-02-27 Pat Thoyts * generic/tkWindow.c: [Bug 2645457] check for dead windows after diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 06e63d6..21e6a93 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFileFilter.c,v 1.10 2007/05/09 12:51:30 das Exp $ + * RCS: @(#) $Id: tkFileFilter.c,v 1.10.4.1 2009/03/03 23:54:11 patthoyts Exp $ */ #include "tkInt.h" @@ -338,7 +338,7 @@ AddClause( globPtr->next = NULL; } } - if (ostypeCount > 0 && ostypeList != NULL) { + if (ostypeList != NULL && ostypeCount > 0) { if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } diff --git a/generic/tkFont.c b/generic/tkFont.c index f2d2441..e48a0d5 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.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: tkFont.c,v 1.42 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.42.2.1 2009/03/03 23:54:11 patthoyts Exp $ */ #include "tkInt.h" @@ -2561,7 +2561,7 @@ Tk_CharBbox( { TextLayout *layoutPtr; LayoutChunk *chunkPtr; - int i, x, w; + int i, x = 0, w; Tk_Font tkfont; TkFont *fontPtr; const char *end; diff --git a/generic/tkListbox.c b/generic/tkListbox.c index d7c339c..1edeff5 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.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: tkListbox.c,v 1.44.2.2 2008/10/09 21:20:45 dgp Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.44.2.3 2009/03/03 23:54:11 patthoyts Exp $ */ #include "default.h" @@ -1343,8 +1343,6 @@ ListboxYviewSubCmd( } else { type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count); switch (type) { - case TK_SCROLL_ERROR: - return TCL_ERROR; case TK_SCROLL_MOVETO: index = (int) (listPtr->nElements*fraction + 0.5); break; @@ -1358,6 +1356,9 @@ ListboxYviewSubCmd( case TK_SCROLL_UNITS: index = listPtr->topIndex + count; break; + case TK_SCROLL_ERROR: + default: + return TCL_ERROR; } ChangeListboxView(listPtr, index); } -- cgit v0.12