summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-01 22:23:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-01 22:23:37 (GMT)
commitd8fdcffdf72f128c8ea667a075b28050d2ef2bae (patch)
tree67e1a8f7bc3ea0f6bcb6a07494119dc07d48e6e7 /generic
parent889df48bf09c5e4280601969dd98e1f1f7a82035 (diff)
parent2368ea0a97ff1dd3956039fa640d9667a185f602 (diff)
downloadtcl-d8fdcffdf72f128c8ea667a075b28050d2ef2bae.zip
tcl-d8fdcffdf72f128c8ea667a075b28050d2ef2bae.tar.gz
tcl-d8fdcffdf72f128c8ea667a075b28050d2ef2bae.tar.bz2
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r--generic/tclTest.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 1597e04..8a60baa 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -6824,22 +6824,15 @@ TestUtfNextCmd(
char *bytes;
const char *result, *first;
char buffer[32];
- static const char tobetested[] = "\xFF\xFE\xF4\xF2\xF0\xEF\xE8\xE3\xE2\xE1\xE0\xC2\xC1\xC0\x82";
+ static const char tobetested[] = "A\xA0\xC0\xC1\xC2\xD0\xE0\xE8\xF2\xF7\xF8\xFE\xFF";
const char *p = tobetested;
- if (objc != 3 || strcmp(Tcl_GetString(objv[1]), "-bytestring")) {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes");
- return TCL_ERROR;
- }
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes");
+ return TCL_ERROR;
+ }
bytes = Tcl_GetString(objv[1]);
numBytes = objv[1]->length;
- } else {
- bytes = (char *) TclGetBytesFromObj(interp, objv[2], &numBytes);
- if (bytes == NULL) {
- return TCL_ERROR;
- }
- }
if (numBytes > (int)sizeof(buffer)-3) {
Tcl_AppendResult(interp, "\"testutfnext\" can only handle 29 bytes", NULL);
@@ -6888,17 +6881,14 @@ TestUtfPrevCmd(
size_t numBytes, offset;
char *bytes;
const char *result;
- Tcl_Obj *copy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?");
return TCL_ERROR;
}
- bytes = (char *) TclGetBytesFromObj(interp, objv[1], &numBytes);
- if (bytes == NULL) {
- return TCL_ERROR;
- }
+ bytes = Tcl_GetString(objv[1]);
+ numBytes = objv[1]->length;
if (objc == 3) {
if (TCL_OK != Tcl_GetIntForIndex(interp, objv[2], numBytes, &offset)) {
@@ -6913,14 +6903,8 @@ TestUtfPrevCmd(
} else {
offset = numBytes;
}
- copy = Tcl_DuplicateObj(objv[1]);
- bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1);
- bytes[numBytes] = '\0';
-
result = TclUtfPrev(bytes + offset, bytes);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result - bytes));
-
- Tcl_DecrRefCount(copy);
return TCL_OK;
}