Posted to tcl by Emiliano at Thu Jul 12 12:27:36 GMT 2012view pretty
Index: generic/tkListbox.c =================================================================== --- generic/tkListbox.c +++ generic/tkListbox.c @@ -699,11 +699,11 @@ } break; } case COMMAND_CURSELECTION: { - char indexStringRep[TCL_INTEGER_SPACE]; + Tcl_Obj *resultObj; int i; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); result = TCL_ERROR; @@ -715,17 +715,17 @@ * search functions (Tcl_FirstHashEntry, Tcl_NextHashEntry), but then * the result wouldn't be in sorted order. So instead we loop through * the indices in order, adding them to the result if they are * selected. */ - + resultObj = Tcl_NewListObj(0, NULL); for (i = 0; i < listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, (char *) INT2PTR(i))) { - sprintf(indexStringRep, "%d", i); - Tcl_AppendElement(interp, indexStringRep); + Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewIntObj(i)); } } + Tcl_SetObjResult(interp, resultObj); result = TCL_OK; break; } case COMMAND_DELETE: {