summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-12-20 21:33:51 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-12-20 21:33:51 (GMT)
commit56dae018e20d1810137e61564c4ca47da3d32937 (patch)
tree4bcd5a99aa7ffddca9232a3b90e19dd9e5895094 /test/tmisc.c
parent79c17d54cc2f66f57f51f578681a35140e2b580e (diff)
downloadhdf5-56dae018e20d1810137e61564c4ca47da3d32937.zip
hdf5-56dae018e20d1810137e61564c4ca47da3d32937.tar.gz
hdf5-56dae018e20d1810137e61564c4ca47da3d32937.tar.bz2
[svn-r13084] Fixed a bug that occurrs when copying DCPLs with filters that have filter
data. Added a regression test for this bug. Tested on kagiso.
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index 3625681..20489fe 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -4643,6 +4643,47 @@ test_misc25b(void)
/****************************************************************
**
+** test_misc26(): Regression test: ensure that copying filter
+** pipelines works properly.
+**
+****************************************************************/
+static void
+test_misc26(void)
+{
+ hid_t dcpl1, dcpl2; /* Property List IDs */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Copying filter pipelines\n"));
+
+ /* Create the property list */
+ dcpl1 = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK_I(dcpl1, "H5Pcreate");
+
+ /* Add a filter to the property list */
+ ret = H5Pset_deflate(dcpl1, 1);
+ CHECK_I(ret, "H5Pset_deflate");
+
+ /* Copy the property list */
+ dcpl2 = H5Pcopy(dcpl1);
+ CHECK_I(dcpl2, "H5Pcopy");
+
+ /* Add a filter to the copy */
+ ret = H5Pset_shuffle(dcpl2);
+ CHECK_I(ret, "H5Pset_shuffle");
+
+ /* Close the property lists. If adding the second filter to
+ * dcpl2 caused it to be in an inconsistent state, closing it
+ * will trip an assert.
+ */
+ ret = H5Pclose(dcpl1);
+ CHECK_I(ret, "H5Pclose");
+ ret = H5Pclose(dcpl2);
+ CHECK_I(ret, "H5Pclose");
+}
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -4680,6 +4721,8 @@ test_misc(void)
test_misc24(); /* Test inappropriate API opens of objects */
test_misc25a(); /* Exercise null object header message merge bug */
test_misc25b(); /* Exercise null object header message merge bug on existing file */
+ test_misc26(); /* Test closing property lists with long filter pipelines */
+
} /* test_misc() */
_button_segfault Tk is a free and open-source, cross-platform widget toolkit that provides a library of basic elements of GUI widgets for building a graphical user interface (GUI) in many programming languages.
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat
-rw-r--r--carbon/tkMacOSXWindowEvent.c7
-rw-r--r--generic/tk3d.c9
-rw-r--r--generic/tkArgv.c79
-rw-r--r--generic/tkBind.c25
-rw-r--r--generic/tkBitmap.c4
-rw-r--r--generic/tkBusy.c1
-rw-r--r--generic/tkCanvArc.c30
-rw-r--r--generic/tkCanvBmap.c18
-rw-r--r--generic/tkCanvImg.c22
-rw-r--r--generic/tkCanvLine.c98
-rw-r--r--generic/tkCanvPs.c8
-rw-r--r--generic/tkCanvWind.c23
-rw-r--r--generic/tkColor.c10
-rw-r--r--generic/tkConfig.c28
-rw-r--r--generic/tkEntry.c16
-rw-r--r--generic/tkFont.c10
-rw-r--r--generic/tkGrab.c52
-rw-r--r--generic/tkGrid.c36
-rw-r--r--generic/tkImage.c4
-rw-r--r--generic/tkImgBmap.c9
-rw-r--r--generic/tkImgGIF.c20
-rw-r--r--generic/tkImgPNG.c117
-rw-r--r--generic/tkImgPPM.c8
-rw-r--r--generic/tkImgPhoto.c70
-rw-r--r--generic/tkListbox.c156
-rw-r--r--generic/tkObj.c6
-rw-r--r--generic/tkOldConfig.c42
-rw-r--r--generic/tkOption.c31
-rw-r--r--generic/tkPack.c24
-rw-r--r--generic/tkPlace.c3
-rw-r--r--generic/tkRectOval.c6
-rw-r--r--generic/tkStubInit.c4
-rw-r--r--generic/tkStyle.c1
-rw-r--r--generic/tkUtil.c14
-rw-r--r--generic/tkVisual.c5
-rw-r--r--generic/tkWindow.c158
-rw-r--r--macosx/tkMacOSXWindowEvent.c7
-rw-r--r--macosx/tkMacOSXWm.c115
-rw-r--r--unix/tkUnix.c34
-rw-r--r--unix/tkUnixSelect.c38
-rw-r--r--unix/tkUnixWm.c178
-rw-r--r--win/tkWinDialog.c6
-rw-r--r--win/tkWinSend.c114
-rw-r--r--win/tkWinSendCom.c102
-rw-r--r--win/tkWinSendCom.h6
-rw-r--r--win/tkWinX.c9
46 files changed, 1006 insertions, 757 deletions
diff --git a/carbon/tkMacOSXWindowEvent.c b/carbon/tkMacOSXWindowEvent.c
index 2f46026..99ab918 100644
--- a/carbon/tkMacOSXWindowEvent.c
+++ b/carbon/tkMacOSXWindowEvent.c
@@ -885,10 +885,9 @@ TkWmProtocolEventProc(
Tcl_Preserve(interp);
result = Tcl_GlobalEval(interp, protPtr->command);
if (result != TCL_OK) {
- Tcl_AddErrorInfo(interp, "\n (command for \"");
- Tcl_AddErrorInfo(interp,
- Tk_GetAtomName((Tk_Window) winPtr, protocol));
- Tcl_AddErrorInfo(interp, "\" window manager protocol)");
+ Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
+ "\n (command for \"%s\" window manager protocol)",
+ Tk_GetAtomName((Tk_Window) winPtr, protocol)));
Tcl_BackgroundException(interp, result);
}
Tcl_Release(interp);
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 2920c76..dd7ab2f 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -673,11 +673,10 @@ Tk_GetRelief(
} else if ((c == 's') && (strncmp(name, "sunken", length) == 0)) {
*reliefPtr = TK_RELIEF_SUNKEN;
} else {
- char buf[200];
-
- sprintf(buf, "bad relief \"%.50s\": must be %s",
- name, "flat, groove, raised, ridge, solid, or sunken");
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp,
+ Tcl_ObjPrintf("bad relief \"%.50s\": must be %s",
+ name, "flat, groove, raised, ridge, solid, or sunken"));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "RELIEF", NULL);
return TCL_ERROR;
}
return TCL_OK;
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 3f235ad..f4ddda4 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -70,7 +70,7 @@ Tk_ParseArgv(
register const Tk_ArgvInfo *infoPtr;
/* Pointer to the current entry in the table
* of argument descriptions. */
- const Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
+ const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */
const char *curArg; /* Current argument */
register char c; /* Second character of current arg (used for
* quick check for matching; use 2nd char.
@@ -83,6 +83,7 @@ Tk_ParseArgv(
* than srcIndex). */
int argc; /* # arguments in argv still to process. */
size_t length; /* Number of characters in current argument. */
+ char *endPtr; /* Used for identifying junk in arguments. */
int i;
if (flags & TK_ARGV_DONT_SKIP_FIRST_ARG) {
@@ -139,8 +140,9 @@ Tk_ParseArgv(
continue;
}
if (matchPtr != NULL) {
- Tcl_AppendResult(interp, "ambiguous option \"", curArg,
- "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "ambiguous option \"%s\"", curArg));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "AMBIGUOUS", NULL);
return TCL_ERROR;
}
matchPtr = infoPtr;
@@ -153,8 +155,9 @@ Tk_ParseArgv(
*/
if (flags & TK_ARGV_NO_LEFTOVERS) {
- Tcl_AppendResult(interp, "unrecognized argument \"",
- curArg, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "unrecognized argument \"%s\"", curArg));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "UNRECOGNIZED", NULL);
return TCL_ERROR;
}
argv[dstIndex] = curArg;
@@ -175,19 +178,17 @@ Tk_ParseArgv(
case TK_ARGV_INT:
if (argc == 0) {
goto missingArg;
- } else {
- char *endPtr;
-
- *((int *) infoPtr->dst) = strtol(argv[srcIndex], &endPtr, 0);
- if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
- Tcl_AppendResult(interp,"expected integer argument for \"",
- infoPtr->key, "\" but got \"", argv[srcIndex],
- "\"", NULL);
- return TCL_ERROR;
- }
- srcIndex++;
- argc--;
}
+ *((int *) infoPtr->dst) = strtol(argv[srcIndex], &endPtr, 0);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected %s argument for \"%s\" but got \"%s\"",
+ "integer", infoPtr->key, argv[srcIndex]));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "INTEGER", NULL);
+ return TCL_ERROR;
+ }
+ srcIndex++;
+ argc--;
break;
case TK_ARGV_STRING:
if (argc == 0) {
@@ -211,19 +212,17 @@ Tk_ParseArgv(
case TK_ARGV_FLOAT:
if (argc == 0) {
goto missingArg;
- } else {
- char *endPtr;
-
- *((double *) infoPtr->dst) = strtod(argv[srcIndex], &endPtr);
- if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
- Tcl_AppendResult(interp, "expected floating-point ",
- "argument for \"", infoPtr->key, "\" but got \"",
- argv[srcIndex], "\"", NULL);
- return TCL_ERROR;
- }
- srcIndex++;
- argc--;
}
+ *((double *) infoPtr->dst) = strtod(argv[srcIndex], &endPtr);
+ if ((endPtr == argv[srcIndex]) || (*endPtr != 0)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected %s argument for \"%s\" but got \"%s\"",
+ "floating-point", infoPtr->key, argv[srcIndex]));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "FLOAT", NULL);
+ return TCL_ERROR;
+ }
+ srcIndex++;
+ argc--;
break;
case TK_ARGV_FUNC: {
typedef int (ArgvFunc)(char *, const char *, const char *);
@@ -249,6 +248,7 @@ Tk_ParseArgv(
}
case TK_ARGV_HELP:
PrintUsage(interp, argTable, flags);
+ Tcl_SetErrorCode(interp, "TK", "ARG", "HELP", NULL);
return TCL_ERROR;
case TK_ARGV_CONST_OPTION:
Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src,
@@ -265,8 +265,10 @@ Tk_ParseArgv(
break;
case TK_ARGV_OPTION_NAME_VALUE:
if (argc < 2) {
- Tcl_AppendResult(interp, "\"", curArg,
- "\" option requires two following arguments", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "\"%s\" option requires two following arguments",
+ curArg));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "NAME_VALUE", NULL);
return TCL_ERROR;
}
Tk_AddOption(tkwin, argv[srcIndex], argv[srcIndex+1],
@@ -274,14 +276,12 @@ Tk_ParseArgv(
srcIndex += 2;
argc -= 2;
break;
- default: {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "bad argument type %d in Tk_ArgvInfo", infoPtr->type);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ default:
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad argument type %d in Tk_ArgvInfo", infoPtr->type));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "BAD_TYPE", NULL);
return TCL_ERROR;
}
- }
}
/*
@@ -301,8 +301,9 @@ Tk_ParseArgv(
return TCL_OK;
missingArg:
- Tcl_AppendResult(interp, "\"", curArg,
- "\" option requires an additional argument", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "\"%s\" option requires an additional argument", curArg));
+ Tcl_SetErrorCode(interp, "TK", "ARG", "MISSING", NULL);
return TCL_ERROR;
}
diff --git a/generic/tkBind.c b/generic/tkBind.c
index e58ad4d..0c50368 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -2926,6 +2926,7 @@ HandleEventGenerate(
|| (mainPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) {
Tcl_AppendResult(interp, "window id \"", Tcl_GetString(objv[0]),
"\" doesn't exist in this application", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "FOREIGN_TARGET", NULL);
return TCL_ERROR;
}
@@ -2941,11 +2942,13 @@ HandleEventGenerate(
if (count != 1) {
Tcl_SetResult(interp, "Double or Triple modifier not allowed",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "BAD_MODIFIER", NULL);
return TCL_ERROR;
}
if (*p != '\0') {
Tcl_SetResult(interp, "only one event specification allowed",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "MULTIPLE", NULL);
return TCL_ERROR;
}
@@ -3023,6 +3026,7 @@ HandleEventGenerate(
Tcl_AppendResult(interp, "value for \"", Tcl_GetString(optionPtr),
"\" missing", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "MISSING_VALUE", NULL);
return TCL_ERROR;
}
@@ -3165,6 +3169,7 @@ HandleEventGenerate(
if (keysym == NoSymbol) {
Tcl_AppendResult(interp, "unknown keysym \"", value, "\"",
NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYSYM", NULL);
return TCL_ERROR;
}
@@ -3172,6 +3177,7 @@ HandleEventGenerate(
if (event.general.xkey.keycode == 0) {
Tcl_AppendResult(interp, "no keycode for keysym \"", value,
"\"", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYCODE", NULL);
return TCL_ERROR;
}
if (!(flags & KEY)
@@ -3402,6 +3408,7 @@ HandleEventGenerate(
badopt:
Tcl_AppendResult(interp, name, " event doesn't accept \"",
Tcl_GetString(optionPtr), "\" option", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "BAD_OPTION", NULL);
return TCL_ERROR;
}
@@ -3496,6 +3503,7 @@ NameToWindow(
badWindow:
Tcl_AppendResult(interp, "bad window name/identifier \"",name,"\"", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW_ID", NULL);
return TCL_ERROR;
}
@@ -3560,6 +3568,7 @@ GetVirtualEventUid(
virtString[length - 2] != '>' || virtString[length - 1] != '>') {
Tcl_AppendResult(interp, "virtual event \"", virtString,
"\" is badly formed", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "MALFORMED", NULL);
return NULL;
}
virtString[length - 2] = '\0';
@@ -3654,6 +3663,8 @@ FindSequence(
Tcl_SetResult(interp,
"virtual event not allowed in definition of another virtual event",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "INNER",
+ NULL);
return NULL;
}
virtualFound = 1;
@@ -3680,11 +3691,14 @@ FindSequence(
if (numPats == 0) {
Tcl_SetResult(interp, "no events specified in binding", TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "NO_EVENTS", NULL);
return NULL;
}
if ((numPats > 1) && (virtualFound != 0)) {
Tcl_SetResult(interp, "virtual events may not be composed",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "COMPOSITION",
+ NULL);
return NULL;
}
@@ -3804,6 +3818,7 @@ ParseEventDescription(
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ASCII character 0x%x", UCHAR(*p)));
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "BAD_CHAR", NULL);
count = 0;
goto done;
}
@@ -3846,12 +3861,16 @@ ParseEventDescription(
if (p == field) {
Tcl_SetResult(interp, "virtual event \"<<>>\" is badly formed",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "MALFORMED",
+ NULL);
count = 0;
goto done;
}
if ((p == NULL) || (p[1] != '>')) {
Tcl_SetResult(interp, "missing \">\" in virtual binding",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "MALFORMED",
+ NULL);
count = 0;
goto done;
}
@@ -3920,6 +3939,7 @@ ParseEventDescription(
} else if ((eventFlags & BUTTON) == 0) {
Tcl_AppendResult(interp, "specified button \"", field,
"\" for non-button event", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "NON_BUTTON", NULL);
count = 0;
goto done;
}
@@ -3931,6 +3951,7 @@ ParseEventDescription(
if (patPtr->detail.keySym == NoSymbol) {
Tcl_AppendResult(interp, "bad event type or keysym \"",
field, "\"", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYSYM", NULL);
count = 0;
goto done;
}
@@ -3940,6 +3961,7 @@ ParseEventDescription(
} else if ((eventFlags & KEY) == 0) {
Tcl_AppendResult(interp, "specified keysym \"", field,
"\" for non-key event", NULL);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "NON_KEY", NULL);
count = 0;
goto done;
}
@@ -3947,6 +3969,7 @@ ParseEventDescription(
} else if (eventFlags == 0) {
Tcl_SetResult(interp, "no event type or button # or keysym",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "UNMODIFIABLE", NULL);
count = 0;
goto done;
}
@@ -3961,11 +3984,13 @@ ParseEventDescription(
Tcl_SetResult(interp,
"extra characters after detail in binding",
TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "PAST_DETAIL", NULL);
count = 0;
goto done;
}
}
Tcl_SetResult(interp, "missing \">\" in binding", TCL_STATIC);
+ Tcl_SetErrorCode(interp, "TK", "EVENT", "MALFORMED", NULL);
count = 0;
goto done;
}
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index b0d1ecc..5349fd5 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -344,6 +344,7 @@ GetBitmap(
if (Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't specify bitmap with '@' in a",
" safe interpreter", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL);
goto error;
}
@@ -365,6 +366,7 @@ GetBitmap(
if (interp != NULL) {
Tcl_AppendResult(interp, "error reading bitmap file \"",
string, "\"", NULL);
+ Tcl_SetErrorCode(interp, "TK", "BITMAP", "FILE_ERROR", NULL);
}
Tcl_DStringFree(&buffer);
goto error;
@@ -386,6 +388,7 @@ GetBitmap(
if (interp != NULL) {
Tcl_AppendResult(interp, "bitmap \"", string,
"\" not defined", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "BITMAP", NULL);
}
goto error;
}
@@ -489,6 +492,7 @@ Tk_DefineBitmap(
if (!isNew) {
Tcl_AppendResult(interp, "bitmap \"", name, "\" is already defined",
NULL);
+ Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL);
return TCL_ERROR;
}
predefPtr = ckalloc(sizeof(TkPredefBitmap));
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index fc7f6ab..5439969 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -689,6 +689,7 @@ GetBusy(
if (hPtr == NULL) {
Tcl_AppendResult(interp, "can't find busy window \"",
Tcl_GetString(windowObj), "\"", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "BUSY", NULL);
return NULL;
}
return Tcl_GetHashValue(hPtr);
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index 6cbc89b..d8a8062 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -344,27 +344,21 @@ ArcCoords(
ArcItem *arcPtr = (ArcItem *) itemPtr;
if (objc == 0) {
- Tcl_Obj *obj = Tcl_NewObj();
- Tcl_Obj *subobj = Tcl_NewDoubleObj(arcPtr->bbox[0]);
-
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(arcPtr->bbox[1]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(arcPtr->bbox[2]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(arcPtr->bbox[3]);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- Tcl_SetObjResult(interp, obj);
+ Tcl_Obj *objs[4];
+
+ objs[0] = Tcl_NewDoubleObj(arcPtr->bbox[0]);
+ objs[1] = Tcl_NewDoubleObj(arcPtr->bbox[1]);
+ objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]);
+ objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs));
} else if ((objc == 1)||(objc == 4)) {
if (objc==1) {
if (Tcl_ListObjGetElements(interp, objv[0], &objc,
(Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
} else if (objc != 4) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "wrong # coordinates: expected 4, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 4, got %d", objc));
return TCL_ERROR;
}
}
@@ -380,10 +374,8 @@ ArcCoords(
}
ComputeArcBbox(canvas, arcPtr);
} else {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 0 or 4, got %d", objc));
return TCL_ERROR;
}
return TCL_OK;
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index ea16a29..adaa184 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -249,10 +249,8 @@ BitmapCoords(
if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
- Tcl_Obj *subobj = Tcl_NewDoubleObj(bmapPtr->x);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(bmapPtr->y);
- Tcl_ListObjAppendElement(interp, obj, subobj);
+ Tcl_ListObjAppendElement(NULL, obj, Tcl_NewDoubleObj(bmapPtr->x));
+ Tcl_ListObjAppendElement(NULL, obj, Tcl_NewDoubleObj(bmapPtr->y));
Tcl_SetObjResult(interp, obj);
} else if (objc < 3) {
if (objc == 1) {
@@ -260,10 +258,8 @@ BitmapCoords(
(Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
} else if (objc != 2) {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "wrong # coordinates: expected 2, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 2, got %d", objc));
return TCL_ERROR;
}
}
@@ -275,10 +271,8 @@ BitmapCoords(
}
ComputeBitmapBbox(canvas, bmapPtr);
} else {
- char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 0 or 2, got %d", objc));
return TCL_ERROR;
}
return TCL_OK;
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 880070b..b92659b 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -232,23 +232,19 @@ ImageCoords(
ImageItem *imgPtr = (ImageItem *) itemPtr;
if (objc == 0) {
- Tcl_Obj *obj = Tcl_NewObj();
+ Tcl_Obj *objs[2];
- Tcl_Obj *subobj = Tcl_NewDoubleObj(imgPtr->x);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- subobj = Tcl_NewDoubleObj(imgPtr->y);
- Tcl_ListObjAppendElement(interp, obj, subobj);
- Tcl_SetObjResult(interp, obj);
+ objs[0] = Tcl_NewDoubleObj(imgPtr->x);
+ objs[1] = Tcl_NewDoubleObj(imgPtr->y);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, objs));
} else if (objc < 3) {
if (objc==1) {
if (Tcl_ListObjGetElements(interp, objv[0], &objc,
(Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
} else if (objc != 2) {
- char buf[64];
-
- sprintf(buf, "wrong # coordinates: expected 2, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 2, got %d", objc));
return TCL_ERROR;
}
}
@@ -259,10 +255,8 @@ ImageCoords(
}
ComputeImageBbox(canvas, imgPtr);
} else {
- char buf[64];
-
- sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "wrong # coordinates: expected 0 or 2, got %d", objc));
return TCL_ERROR;
}
return TCL_OK;
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c