From 700b782299b5ac82c829eae5725cdc7b577390a6 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 17 Apr 2020 04:17:51 +0000 Subject: enable the tests on a bug fix branch --- tests/utf.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/utf.test b/tests/utf.test index b89be25..2004625 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -415,7 +415,7 @@ test utf-6.85 {Tcl_UtfNext - overlong sequences} testutfnext { test utf-6.86 {Tcl_UtfNext - overlong sequences} testutfnext { testutfnext \xF0\x80\x80\x80 } 1 -test utf-6.87 {Tcl_UtfNext - overlong sequences} {testutfnext knownBug} { # Doesn't work with TCL_UTF_MAX>3 +test utf-6.87 {Tcl_UtfNext - overlong sequences} {testutfnext} { # Doesn't work with TCL_UTF_MAX>3 testutfnext \xF0\x90\x80\x80 } 1 test utf-6.88 {Tcl_UtfNext, pointing to 2th byte of 3-byte valid sequence} {testutfnext} { @@ -628,13 +628,13 @@ test utf-7.37 {Tcl_UtfPrev -- overlong sequence} testutfprev { test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xE0\xA0\x80 2 } 1 -test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev knownBug} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 } 4 -test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev knownBug} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 4 } 3 -test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev knownBug} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 3 } 2 test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev { -- cgit v0.12 From c998be1b068916a8009a76867ed4eaed8938d19b Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 17 Apr 2020 04:45:26 +0000 Subject: When supporting 4-byte sequences, make sure the Overlong test does too, and make sure the test results reflect it. --- generic/tclUtf.c | 2 +- tests/utf.test | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index fdf2e32..e637263 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -154,7 +154,7 @@ UtfCount( static CONST unsigned char overlong[3] = { 0x80, /* \xD0 -- all sequences valid */ 0xA0, /* \xE0\x80 through \xE0\x9F are invalid prefixes */ -#if TCL_UTF_MAX > 3 +#if TCL_UTF_MAX >= 3 0x90 /* \xF0\x80 through \xF0\x8F are invalid prefixes */ #else 0xC0 /* Not used, but reject all again for safety. */ diff --git a/tests/utf.test b/tests/utf.test index 2004625..e8b1d51 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -630,13 +630,13 @@ test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev { } 1 test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 -} 4 +} 1 test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 4 -} 3 +} 1 test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 3 -} 2 +} 1 test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xF0\x90\x80\x80 2 } 1 -- cgit v0.12 From 1edc023972ada28abd9649c5e153f0705ba1268d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 17 Apr 2020 04:51:48 +0000 Subject: more test fixes --- tests/utf.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/utf.test b/tests/utf.test index e8b1d51..c584ea1 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -415,9 +415,9 @@ test utf-6.85 {Tcl_UtfNext - overlong sequences} testutfnext { test utf-6.86 {Tcl_UtfNext - overlong sequences} testutfnext { testutfnext \xF0\x80\x80\x80 } 1 -test utf-6.87 {Tcl_UtfNext - overlong sequences} {testutfnext} { # Doesn't work with TCL_UTF_MAX>3 +test utf-6.87 {Tcl_UtfNext - overlong sequences} {testutfnext} { testutfnext \xF0\x90\x80\x80 -} 1 +} 4 test utf-6.88 {Tcl_UtfNext, pointing to 2th byte of 3-byte valid sequence} {testutfnext} { testutfnext \xE8\xA0\xA0 1 } 2 @@ -628,13 +628,13 @@ test utf-7.37 {Tcl_UtfPrev -- overlong sequence} testutfprev { test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xE0\xA0\x80 2 } 1 -test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { testutfprev A\xF0\x90\x80\x80 } 1 -test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { testutfprev A\xF0\x90\x80\x80 4 } 1 -test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 +test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { testutfprev A\xF0\x90\x80\x80 3 } 1 test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev { -- cgit v0.12 From ad85391b59eba72ecf8c0af3e83f800c61e52f26 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 17 Apr 2020 05:14:43 +0000 Subject: When supporting 4-byte sequences even with TCL_UTF_MAX = 3, need to paramterize a few things differently. (utf-4.11 failures). --- generic/tclUtf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index e637263..4b5d500 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -84,11 +84,7 @@ static const unsigned char complete[256] = { #endif 2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -#if TCL_UTF_MAX > 4 4,4,4,4,4, -#else - 3,3,3,3,3, /* Tcl_UtfCharComplete() only checks TCL_UTF_MAX bytes */ -#endif 1,1,1,1,1,1,1,1,1,1,1 }; @@ -606,14 +602,14 @@ Tcl_NumUtfChars( src = next; } } else { - register const char *endPtr = src + length - TCL_UTF_MAX; + register const char *endPtr = src + length - /*TCL_UTF_MAX*/ 4; while (src < endPtr) { next = TclUtfNext(src); i += 1 + ((next - src) > 3); src = next; } - endPtr += TCL_UTF_MAX; + endPtr += /*TCL_UTF_MAX*/ 4; while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) { next = TclUtfNext(src); i += 1 + ((next - src) > 3); -- cgit v0.12