summaryrefslogtreecommitdiffstats
path: root/generic/tclTest.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r--generic/tclTest.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index bfed72e..506cef9 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -7114,20 +7114,24 @@ TestUtfPrevCmd(
const char *result;
Tcl_Obj *copy;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "bytes offset");
+ if (objc < 2 || objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?");
return TCL_ERROR;
}
bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes);
- if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) {
- return TCL_ERROR;
- }
- if (offset < 0) {
- offset = 0;
- }
- if (offset > numBytes) {
+ if (objc == 3) {
+ if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) {
+ return TCL_ERROR;
+ }
+ if (offset < 0) {
+ offset = 0;
+ }
+ if (offset > numBytes) {
+ offset = numBytes;
+ }
+ } else {
offset = numBytes;
}
copy = Tcl_DuplicateObj(objv[1]);