summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvPoly.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-09 07:48:22 (GMT)
committerhobbs <hobbs>2003-02-09 07:48:22 (GMT)
commit7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c (patch)
treec6933d15bed38ac3ee37519fe2b9700aeee30333 /generic/tkCanvPoly.c
parent5181ceda950c495e8e4bfc881184539c9c5313d9 (diff)
downloadtk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.zip
tk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.tar.gz
tk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.tar.bz2
* generic/tkCanvArc.c (CreateArc): Rework canvas create item
* generic/tkCanvBmap.c (CreateBitmap): type coords handling to be * generic/tkCanvImg.c (CreateImage): consistent across types * generic/tkCanvPoly.c (CreatePolygon): and not pass empty coords * generic/tkCanvLine.c (CreateLine): to item creation procs. * generic/tkCanvText.c (CreateText): * generic/tkCanvWind.c (CreateWinItem): * generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE): * generic/tkRectOval.c (CreateRectOval): * tests/canvRect.test: * tests/canvText.test: * tests/canvas.test:
Diffstat (limited to 'generic/tkCanvPoly.c')
-rw-r--r--generic/tkCanvPoly.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index b3f5374..5058b9f 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.9 2002/08/05 04:30:38 dgp Exp $
+ * RCS: @(#) $Id: tkCanvPoly.c,v 1.10 2003/02/09 07:48:22 hobbs Exp $
*/
#include <stdio.h>
@@ -266,6 +266,10 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv)
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int i;
+ if (objc == 0) {
+ panic("canvas did not pass any coords\n");
+ }
+
/*
* Carry out initialization that is needed in order to clean
* up after errors during the the remainder of this procedure.
@@ -368,9 +372,10 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv)
}
}
if (objc & 1) {
- Tcl_AppendResult(interp,
- "odd number of coordinates specified for polygon",
- (char *) NULL);
+ char buf[64 + TCL_INTEGER_SPACE];
+ sprintf(buf, "wrong # coordinates: expected an even number, got %d",
+ objc);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
} else {
numPoints = objc/2;