From a3eea6dc3f9b7ffcbcff6b1ee933f9ef1189df3f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 13 Jul 2022 07:33:57 +0000 Subject: Fix build with -DTCL_NO_DEPRECATED --- generic/tclStringObj.c | 6 +++++- generic/tclStubInit.c | 1 + generic/tclTest.c | 6 ++---- tests/string.test | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 130379f..b9d603d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -68,7 +68,9 @@ static int SetStringFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); static int UnicodeLength(const Tcl_UniChar *unicode); +#if !defined(TCL_NO_DEPRECATED) static int UTF16Length(const unsigned short *unicode); +#endif static void UpdateStringOfString(Tcl_Obj *objPtr); #if (TCL_UTF_MAX) > 3 && !defined(TCL_NO_DEPRECATED) static void DupUTF16StringInternalRep(Tcl_Obj *objPtr, @@ -979,6 +981,7 @@ Tcl_GetUnicodeFromObj( } #endif +#if !defined(TCL_NO_DEPRECATED) unsigned short * TclGetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string @@ -1001,6 +1004,7 @@ TclGetUnicodeFromObj( } return stringPtr->unicode; } +#endif /* *---------------------------------------------------------------------- @@ -1481,7 +1485,6 @@ Tcl_SetUnicodeObj( TclInvalidateStringRep(objPtr); stringPtr->allocated = numChars; } -#endif static int UTF16Length( @@ -1497,6 +1500,7 @@ UTF16Length( stringCheckLimits(numChars); return numChars; } +#endif static int UnicodeLength( diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index eae72ba..2b7952d 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -96,6 +96,7 @@ static void uniCodePanic(void) { } # define Tcl_GetUnicode (unsigned short *(*)(Tcl_Obj *))(void *)uniCodePanic # define Tcl_GetUnicodeFromObj (unsigned short *(*)(Tcl_Obj *, int *))(void *)uniCodePanic +# define TclGetUnicodeFromObj (unsigned short *(*)(Tcl_Obj *, size_t *))(void *)uniCodePanic # define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const unsigned short *, int))(void *)uniCodePanic # define Tcl_SetUnicodeObj (void(*)(Tcl_Obj *, const unsigned short *, int))(void *)uniCodePanic # define Tcl_AppendUnicodeToObj (void(*)(Tcl_Obj *, const unsigned short *, int))(void *)uniCodePanic diff --git a/generic/tclTest.c b/generic/tclTest.c index bf5741c..e3c6663 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -5195,14 +5195,12 @@ TestbytestringObjCmd( static int Testutf16stringObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - int n = 0; - const Tcl_UniChar *p; - (void)dummy; + const unsigned short *p; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); diff --git a/tests/string.test b/tests/string.test index d128a0b..ba5be14 100644 --- a/tests/string.test +++ b/tests/string.test @@ -2638,7 +2638,7 @@ test string-32.17.$noComp {string is dict, valid dict packed in invalid dict} { }; # foreach noComp {0 1} test string-bug-b79df322a9 {Tcl_GetUnicode/Tcl_NewUnicodeObj api} -constraints { - testutf16string + testutf16string deprecated } -body { # This simple test suffices because the bug has nothing to do with # the actual encoding conversion. The test was added because these -- cgit v0.12