From 2ca7ab9af0d59c9907dde3d844e1785d33df4812 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 Apr 2020 13:53:54 +0000 Subject: Fix TclUtfNext() macro. Use it in tclTest.c, so such a mistake can be detected next time. --- generic/tclInt.h | 2 +- generic/tclTest.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 11c9ec8..780ea30 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4472,7 +4472,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, Tcl_UtfPrev(src, start)) #define TclUtfNext(src) \ - ((((unsigned char) *(src)) < 0xC0) ? src + 1 : Tcl_UtfNext(src)) + ((((unsigned char) *(src)) < 0x80) ? src + 1 : Tcl_UtfNext(src)) /* *---------------------------------------------------------------- diff --git a/generic/tclTest.c b/generic/tclTest.c index 539d188..856e9ea 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6739,10 +6739,10 @@ TestUtfNextCmd( memcpy(buffer + 1, bytes, numBytes); buffer[0] = buffer[numBytes + 1] = '\x00'; - first = Tcl_UtfNext(buffer + 1); + first = TclUtfNext(buffer + 1); while ((buffer[0] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */ - result = Tcl_UtfNext(buffer + 1); + result = TclUtfNext(buffer + 1); if (first != result) { Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL); return TCL_ERROR; @@ -6795,7 +6795,7 @@ TestUtfPrevCmd( bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1); bytes[numBytes] = '\0'; - result = Tcl_UtfPrev(bytes + offset, bytes); + result = TclUtfPrev(bytes + offset, bytes); Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes)); Tcl_DecrRefCount(copy); -- cgit v0.12