summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvPs.c
diff options
context:
space:
mode:
authordas <das>2008-12-07 16:34:12 (GMT)
committerdas <das>2008-12-07 16:34:12 (GMT)
commitdad5f8c673f46f8a689841cdc0568fff52c5ef87 (patch)
treebc363e25b63d1114e0d291507eb02c7876149aa9 /generic/tkCanvPs.c
parent59bd7a0159445f73e970d56b2751c7b9a1924eca (diff)
downloadtk-dad5f8c673f46f8a689841cdc0568fff52c5ef87.zip
tk-dad5f8c673f46f8a689841cdc0568fff52c5ef87.tar.gz
tk-dad5f8c673f46f8a689841cdc0568fff52c5ef87.tar.bz2
Fix potential use of uninitialized variable flagged by clang static analyzer
Diffstat (limited to 'generic/tkCanvPs.c')
-rw-r--r--generic/tkCanvPs.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 866ebba..43fc88a 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.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: tkCanvPs.c,v 1.24 2008/12/05 16:58:41 das Exp $
+ * RCS: @(#) $Id: tkCanvPs.c,v 1.25 2008/12/07 16:34:12 das Exp $
*/
#include "tkInt.h"
@@ -1255,7 +1255,7 @@ TkPostscriptImage(
* monochrome screen, use gray or monochrome mode instead.
*/
- if (!cdata.color && level == 2) {
+ if (!cdata.color && level >= 2) {
level = 1;
}
@@ -1272,7 +1272,7 @@ TkPostscriptImage(
switch (level) {
case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
case 1: bytesPerLine = width; maxWidth = 60000; break;
- case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
+ default: bytesPerLine = 3 * width; maxWidth = 20000; break;
}
if (bytesPerLine > 60000) {
@@ -1300,7 +1300,7 @@ TkPostscriptImage(
sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
Tcl_AppendResult(interp, buffer, NULL);
break;
- case 2:
+ default:
sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
Tcl_AppendResult(interp, buffer, NULL);
break;
@@ -1362,7 +1362,7 @@ TkPostscriptImage(
}
}
break;
- case 2:
+ default:
/*
* Finally, color mode. Here, just output the red, green, and
* blue values directly.
@@ -1388,7 +1388,7 @@ TkPostscriptImage(
switch (level) {
case 0: case 1:
sprintf(buffer, ">\n} image\n"); break;
- case 2:
+ default:
sprintf(buffer, ">\n} false 3 colorimage\n"); break;
}
Tcl_AppendResult(interp, buffer, NULL);
@@ -1587,7 +1587,7 @@ Tk_PostscriptPhoto(
switch (colorLevel) {
case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
case 1: bytesPerLine = width; maxWidth = 60000; break;
- case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
+ default: bytesPerLine = 3 * width; maxWidth = 20000; break;
}
if (bytesPerLine > 60000) {
Tcl_ResetResult(interp);