From 6c7ad3b1183f1a912bac6ba4fcdf0231749c359e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Nov 2022 21:16:15 +0000 Subject: Let Tcl_GetEncodingNulLength() return size_t on 9.0, for consisancy with other API's. No change on 8.7 --- doc/Encoding.3 | 6 +++--- generic/tcl.decls | 2 +- generic/tcl.h | 4 ++-- generic/tclDecls.h | 4 ++-- generic/tclEncoding.c | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/Encoding.3 b/doc/Encoding.3 index 43bb2b8..9b88c11 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.3 @@ -347,7 +347,7 @@ typedef struct Tcl_EncodingType { Tcl_EncodingConvertProc *\fItoUtfProc\fR; Tcl_EncodingConvertProc *\fIfromUtfProc\fR; Tcl_EncodingFreeProc *\fIfreeProc\fR; - ClientData \fIclientData\fR; + void *\fIclientData\fR; int \fInullSize\fR; } \fBTcl_EncodingType\fR; .CE @@ -378,7 +378,7 @@ type \fBTcl_EncodingConvertProc\fR: .PP .CS typedef int \fBTcl_EncodingConvertProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, const char *\fIsrc\fR, int \fIsrcLen\fR, int \fIflags\fR, @@ -410,7 +410,7 @@ The callback procedure \fIfreeProc\fR, if non-NULL, should match the type .PP .CS typedef void \fBTcl_EncodingFreeProc\fR( - ClientData \fIclientData\fR); + void *\fIclientData\fR); .CE .PP This \fIfreeProc\fR function is called when the encoding is deleted. The diff --git a/generic/tcl.decls b/generic/tcl.decls index a9c042c..a48ab02 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2549,7 +2549,7 @@ declare 682 { # TIP 643 declare 683 { - int Tcl_GetEncodingNulLength(Tcl_Encoding encoding) + Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding) } # TIP #650 diff --git a/generic/tcl.h b/generic/tcl.h index ebe989c..c6afaa1 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2078,11 +2078,11 @@ typedef struct Tcl_EncodingType { * encoding is deleted. */ void *clientData; /* Arbitrary value associated with encoding * type. Passed to conversion functions. */ - int nullSize; /* Number of zero bytes that signify + Tcl_Size nullSize; /* Number of zero bytes that signify * end-of-string in this encoding. This number * is used to determine the source string * length when the srcLen argument is - * negative. Must be 1 or 2. */ + * negative. Must be 1, 2, or 4. */ } Tcl_EncodingType; /* diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d8b4b5d..77517e8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -2039,7 +2039,7 @@ EXTERN int Tcl_GetNumber(Tcl_Interp *interp, const char *bytes, EXTERN int Tcl_RemoveChannelMode(Tcl_Interp *interp, Tcl_Channel chan, int mode); /* 683 */ -EXTERN int Tcl_GetEncodingNulLength(Tcl_Encoding encoding); +EXTERN Tcl_Size Tcl_GetEncodingNulLength(Tcl_Encoding encoding); /* 684 */ EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); @@ -2766,7 +2766,7 @@ typedef struct TclStubs { int (*tcl_GetNumberFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void **clientDataPtr, int *typePtr); /* 680 */ int (*tcl_GetNumber) (Tcl_Interp *interp, const char *bytes, size_t numBytes, void **clientDataPtr, int *typePtr); /* 681 */ int (*tcl_RemoveChannelMode) (Tcl_Interp *interp, Tcl_Channel chan, int mode); /* 682 */ - int (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */ + Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */ int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */ Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */ void (*reserved686)(void); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 5be6a2e..169e975 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -33,13 +33,13 @@ typedef struct { Tcl_EncodingFreeProc *freeProc; /* If non-NULL, function to call when this * encoding is deleted. */ + void *clientData; /* Arbitrary value associated with encoding + * type. Passed to conversion functions. */ int nullSize; /* Number of 0x00 bytes that signify * end-of-string in this encoding. This number * is used to determine the source string * length when the srcLen argument is * negative. This number can be 1, 2, or 4. */ - void *clientData; /* Arbitrary value associated with encoding - * type. Passed to conversion functions. */ LengthProc *lengthProc; /* Function to compute length of * null-terminated strings in this encoding. * If nullSize is 1, this is strlen; if @@ -888,7 +888,7 @@ FreeEncoding( * * Tcl_GetEncodingName -- * - * Given an encoding, return the name that was used to constuct the + * Given an encoding, return the name that was used to construct the * encoding. * * Results: @@ -991,7 +991,7 @@ Tcl_GetEncodingNames( * string termination. * * Results: - * The name of the encoding. + * The number of nul bytes used for the string termination. * * Side effects: * None. -- cgit v0.12