summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tkCanvPs.c13
2 files changed, 10 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 4590f7c..84ceccb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-07 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd): [Bug 3565533]: Purge use
+ of variable that was only ever checked once immediately afterwards,
+ except for one (buggy) case where it was checked without assignment.
+
2012-08-30 Andreas Kupries <andreask@activestate.com>
* generic/tkCanvWind.c (CanvasPsWindow): Unbreak AIX, replaced use
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 6542864..0c7b0dd 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -170,7 +170,6 @@ TkCanvPostscriptCmd(
TkPostscriptInfo psInfo, *psInfoPtr = &psInfo;
Tk_PostscriptInfo oldInfoPtr;
int result;
- int written;
Tk_Item *itemPtr;
#define STRING_LENGTH 400
const char *p;
@@ -492,8 +491,7 @@ TkCanvPostscriptCmd(
Tcl_AppendObjToObj(psObj, preambleObj);
if (psInfo.chan != NULL) {
- written = Tcl_WriteObj(psInfo.chan, psObj);
- if (written == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
channelWriteFailed:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"problem writing postscript data to channel: %s",
@@ -547,8 +545,7 @@ TkCanvPostscriptCmd(
psInfo.x, Tk_PostscriptY((double)psInfo.y2,
(Tk_PostscriptInfo)psInfoPtr));
if (psInfo.chan != NULL) {
- written = Tcl_WriteObj(psInfo.chan, psObj);
- if (written == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
goto channelWriteFailed;
}
Tcl_DecrRefCount(psObj);
@@ -590,8 +587,7 @@ TkCanvPostscriptCmd(
Tcl_AppendToObj(psObj, "grestore\n", -1);
if (psInfo.chan != NULL) {
- written = Tcl_WriteObj(psInfo.chan, psObj);
- if (written == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
goto channelWriteFailed;
}
Tcl_DecrRefCount(psObj);
@@ -612,8 +608,7 @@ TkCanvPostscriptCmd(
"%%EOF\n", -1);
if (psInfo.chan != NULL) {
- Tcl_WriteObj(psInfo.chan, psObj);
- if (written == -1) {
+ if (Tcl_WriteObj(psInfo.chan, psObj) == -1) {
goto channelWriteFailed;
}
}