summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-01-12 10:41:23 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-01-12 10:41:23 (GMT)
commit6c75da00b675108a826e392e827698d4eeb5e4cf (patch)
treeef82d8fda6efa38bb2958e9d9816fd6f4b4eedbf
parent32d9b2358c24a7c31ab8662b3c8d91dd932dbde0 (diff)
downloadtk-6c75da00b675108a826e392e827698d4eeb5e4cf.zip
tk-6c75da00b675108a826e392e827698d4eeb5e4cf.tar.gz
tk-6c75da00b675108a826e392e827698d4eeb5e4cf.tar.bz2
More warning squelching (mostly uninit variable warnings)
-rw-r--r--generic/tkListbox.c6
-rw-r--r--win/tkWin3d.c4
-rw-r--r--win/tkWinFont.c4
-rw-r--r--win/tkWinImage.c11
-rw-r--r--win/tkWinMenu.c39
-rw-r--r--win/tkWinWm.c16
6 files changed, 45 insertions, 35 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index ca888a2..9e7d575 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.37 2007/01/03 05:06:25 nijtmans Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.38 2007/01/12 10:41:23 dkf Exp $
*/
#include "tkPort.h"
@@ -1819,7 +1819,7 @@ DisplayListbox(clientData)
register Listbox *listPtr = (Listbox *) clientData;
register Tk_Window tkwin = listPtr->tkwin;
GC gc;
- int i, limit, x, y, width, prevSelected, freeGC;
+ int i, limit, x, y, prevSelected, freeGC;
Tk_FontMetrics fm;
Tcl_Obj *curElement;
Tcl_HashEntry *entry;
@@ -1895,6 +1895,8 @@ DisplayListbox(clientData)
prevSelected = 0;
for (i = listPtr->topIndex; i <= limit; i++) {
+ int width = Tk_Width(tkwin); /* zeroth approx to silence warning */
+
x = listPtr->inset;
y = ((i - listPtr->topIndex) * listPtr->lineHeight) + listPtr->inset;
gc = listPtr->textGC;
diff --git a/win/tkWin3d.c b/win/tkWin3d.c
index a619082..78f5146 100644
--- a/win/tkWin3d.c
+++ b/win/tkWin3d.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: tkWin3d.c,v 1.9 2005/12/02 13:42:29 dkf Exp $
+ * RCS: @(#) $Id: tkWin3d.c,v 1.10 2007/01/12 10:41:23 dkf Exp $
*/
#include "tkWinInt.h"
@@ -162,6 +162,7 @@ Tk_3DVerticalBevel(
left = right = borderPtr->bgGC->foreground;
break;
case TK_RELIEF_SOLID:
+ default:
left = right = RGB(0,0,0);
break;
}
@@ -261,6 +262,7 @@ Tk_3DHorizontalBevel(
topColor = bottomColor = borderPtr->bgGC->foreground;
break;
case TK_RELIEF_SOLID:
+ default:
topColor = bottomColor = RGB(0,0,0);
}
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 7ae3db7..a86a6bd 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.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: tkWinFont.c,v 1.29 2007/01/11 15:35:40 dkf Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.30 2007/01/12 10:41:23 dkf Exp $
*/
#include "tkWinInt.h"
@@ -672,7 +672,7 @@ Tk_MeasureChars(
Tcl_DString runString;
SubFont *thisSubFontPtr;
SubFont *lastSubFontPtr;
- CONST char *p, *end, *next, *start;
+ CONST char *p, *end, *next = NULL, *start;
if (numBytes == 0) {
*lengthPtr = 0;
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index dbced49..37e4351 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinImage.c,v 1.10 2007/01/11 15:35:40 dkf Exp $
+ * RCS: @(#) $Id: tkWinImage.c,v 1.11 2007/01/12 10:41:23 dkf Exp $
*/
#include "tkWinInt.h"
@@ -294,7 +294,7 @@ XGetImageZPixmap(
HDC hdc, hdcMem;
HBITMAP hbmp, hbmpPrev;
BITMAPINFO *bmInfo = NULL;
- HPALETTE hPal, hPalPrev1, hPalPrev2;
+ HPALETTE hPal, hPalPrev1 = 0, hPalPrev2 = 0;
int size;
unsigned int n;
unsigned int depth;
@@ -323,12 +323,12 @@ XGetImageZPixmap(
hPalPrev1 = SelectPalette(hdcMem, hPal, FALSE);
n = RealizePalette(hdcMem);
if (n > 0) {
- UpdateColors (hdcMem);
+ UpdateColors(hdcMem);
}
hPalPrev2 = SelectPalette(hdc, hPal, FALSE);
n = RealizePalette(hdc);
if (n > 0) {
- UpdateColors (hdc);
+ UpdateColors(hdc);
}
}
@@ -339,6 +339,7 @@ XGetImageZPixmap(
SelectObject(hdcMem, hbmpPrev);
TkWinReleaseDrawableDC(d, hdc, &state);
if (ret == FALSE) {
+ ret_image = NULL;
goto cleanup;
}
if (twdPtr->type == TWD_WINDOW) {
@@ -454,7 +455,7 @@ XGetImageZPixmap(
*/
if (GetDIBits(hdcMem, hbmp, 0, height, ret_image->data, bmInfo,
- DIB_RGB_COLORS) == 0) {
+ DIB_RGB_COLORS) == 0) {
ckfree((char *) ret_image->data);
ckfree((char *) ret_image);
ret_image = NULL;
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index bacfb70..9b0ec85 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.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: tkWinMenu.c,v 1.52 2007/01/11 15:35:40 dkf Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.53 2007/01/12 10:41:23 dkf Exp $
*/
#define OEMRESOURCE
@@ -1712,19 +1712,18 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
*/
void
-DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
- x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics */
- Tk_3DBorder activeBorder; /* The border when an item is active */
- int x; /* left edge */
- int y; /* top edge */
- int width; /* Width of menu entry */
- int height; /* Height of menu entry */
+DrawMenuEntryAccelerator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The precalculated font */
+ CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ Tk_3DBorder activeBorder, /* The border when an item is active */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* Width of menu entry */
+ int height) /* Height of menu entry */
{
int baseline;
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
@@ -1732,6 +1731,8 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
if (mePtr->accelPtr != NULL) {
accel = Tcl_GetString(mePtr->accelPtr);
+ } else {
+ accel = NULL;
}
baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
@@ -1742,13 +1743,11 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
if ((mePtr->state == ENTRY_DISABLED)
- && (menuPtr->disabledFgPtr != NULL)
- && (mePtr->accelPtr != NULL)) {
+ && (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) {
COLORREF oldFgColor = gc->foreground;
gc->foreground = GetSysColor(COLOR_3DHILIGHT);
- if ((mePtr->accelPtr != NULL) &&
- ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0)) {
+ if ((mePtr->entryFlags & ENTRY_PLATFORM_FLAG1) == 0) {
Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, leftEdge + 1, baseline + 1);
}
@@ -1756,7 +1755,7 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
}
}
- if (mePtr->accelPtr != NULL) {
+ if (accel != NULL) {
Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, leftEdge, baseline);
}
@@ -2149,7 +2148,7 @@ DrawMenuEntryLabel(
int activeBorderWidth;
int leftEdge;
int imageHeight, imageWidth;
- int textHeight, textWidth;
+ int textHeight = 0, textWidth = 0;
int haveImage = 0, haveText = 0;
int imageXOffset = 0, imageYOffset = 0;
int textXOffset = 0, textYOffset = 0;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 4118b17..6eddb59 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.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: tkWinWm.c,v 1.112 2007/01/11 15:35:41 dkf Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.113 2007/01/12 10:41:23 dkf Exp $
*/
#include "tkWinInt.h"
@@ -2600,6 +2600,8 @@ TkpWmSetState(
cmd = SW_SHOWNOACTIVATE;
} else if (state == ZoomState) {
cmd = SW_SHOWMAXIMIZED;
+ } else {
+ return;
}
ShowWindow(wmPtr->wrapper, cmd);
@@ -3146,7 +3148,7 @@ WmAttributesCmd(
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- LONG style, exStyle, styleBit, *stylePtr;
+ LONG style, exStyle, styleBit, *stylePtr = NULL;
char *string;
int i, boolean, length;
int config_fullscreen = 0;
@@ -5209,8 +5211,9 @@ WmStateCmd(
}
if (winPtr->flags & TK_EMBEDDED) {
- int state;
- switch(index) {
+ int state = 0;
+
+ switch (index) {
case OPT_NORMAL:
state = NormalState;
break;
@@ -5223,9 +5226,11 @@ WmStateCmd(
case OPT_ZOOMED:
state = ZoomState;
break;
+ default:
+ Tcl_Panic("unexpected index");
}
- if(state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
+ if (state+1 != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) {
Tcl_AppendResult(interp, "can't change state of ",
winPtr->pathName,
": the container does not support the request", NULL);
@@ -7020,6 +7025,7 @@ ConfigureTopLevel(
state = IconicState;
break;
case SW_SHOWNORMAL:
+ default:
state = NormalState;
break;
}