diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-21 14:42:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-21 14:42:45 (GMT) |
commit | 12e7efea0c5b12c8f1953fe586197412aaafa8ef (patch) | |
tree | 142ba95eb4dd1b4487aa4b08c03df87117c8ae7c /generic | |
parent | da9c340245306d44f3c0a15ad6a28016abd73454 (diff) | |
parent | 04234b55afe944221c2b003572689431778c7c88 (diff) | |
download | tcl-12e7efea0c5b12c8f1953fe586197412aaafa8ef.zip tcl-12e7efea0c5b12c8f1953fe586197412aaafa8ef.tar.gz tcl-12e7efea0c5b12c8f1953fe586197412aaafa8ef.tar.bz2 |
Merge 8.7. Renumber testcases in cmdAH.test.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 15 | ||||
-rw-r--r-- | generic/tclDecls.h | 8 | ||||
-rw-r--r-- | generic/tclEncoding.c | 16 |
4 files changed, 21 insertions, 22 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index a33ea56..3cf794e 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2437,11 +2437,11 @@ declare 657 { int Tcl_UniCharIsUnicode(int ch) } declare 658 { - size_t Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding, + int Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr) } declare 659 { - size_t Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding, + int Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr) } diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 264e6ae..7746b2f 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -555,7 +555,7 @@ EncodingConvertfromObjCmd( #else int flags = TCL_ENCODING_NOCOMPLAIN; #endif - size_t result; + int result; Tcl_Obj *failVarObj = NULL; /* * Decode parameters: @@ -621,17 +621,16 @@ EncodingConvertfromObjCmd( } result = Tcl_ExternalToUtfDStringEx(encoding, bytesPtr, length, flags, &ds); - if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (result != (size_t)-1)) { + if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (result != TCL_INDEX_NONE)) { if (failVarObj != NULL) { - /* I hope, wide int will cover size_t data type */ if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) { return TCL_ERROR; } } else { char buf[TCL_INTEGER_SPACE]; - sprintf(buf, "%" TCL_Z_MODIFIER "u", result); + sprintf(buf, "%u", result); Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte sequence starting at index %" - TCL_Z_MODIFIER "u: '\\x%X'", result, UCHAR(bytesPtr[result]))); + "u: '\\x%X'", result, UCHAR(bytesPtr[result]))); Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE", buf, NULL); Tcl_DStringFree(&ds); @@ -685,7 +684,7 @@ EncodingConverttoObjCmd( Tcl_Encoding encoding; /* Encoding to use */ int length; /* Length of the string being converted */ const char *stringPtr; /* Pointer to the first byte of the string */ - size_t result; + int result; #if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED) int flags = TCL_ENCODING_STOPONERROR; #else @@ -750,7 +749,7 @@ EncodingConverttoObjCmd( stringPtr = TclGetStringFromObj(data, &length); result = Tcl_UtfToExternalDStringEx(encoding, stringPtr, length, flags, &ds); - if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (result != (size_t)-1)) { + if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (result != TCL_INDEX_NONE)) { if (failVarObj != NULL) { /* I hope, wide int will cover size_t data type */ if (Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(result), TCL_LEAVE_ERR_MSG) == NULL) { @@ -761,7 +760,7 @@ EncodingConverttoObjCmd( int ucs4; char buf[TCL_INTEGER_SPACE]; TclUtfToUCS4(&stringPtr[result], &ucs4); - sprintf(buf, "%" TCL_Z_MODIFIER "u", result); + sprintf(buf, "%u", result); Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected character at index %" TCL_Z_MODIFIER "u: 'U+%06X'", pos, ucs4)); Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE", diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 0830a11..57574b8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1944,11 +1944,11 @@ EXTERN const char * Tcl_UtfPrev(const char *src, const char *start); /* 657 */ EXTERN int Tcl_UniCharIsUnicode(int ch); /* 658 */ -EXTERN size_t Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding, +EXTERN int Tcl_ExternalToUtfDStringEx(Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 659 */ -EXTERN size_t Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding, +EXTERN int Tcl_UtfToExternalDStringEx(Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 660 */ @@ -2656,8 +2656,8 @@ typedef struct TclStubs { const char * (*tcl_UtfNext) (const char *src); /* 655 */ const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */ int (*tcl_UniCharIsUnicode) (int ch); /* 657 */ - size_t (*tcl_ExternalToUtfDStringEx) (Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 658 */ - size_t (*tcl_UtfToExternalDStringEx) (Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 659 */ + int (*tcl_ExternalToUtfDStringEx) (Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 658 */ + int (*tcl_UtfToExternalDStringEx) (Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_DString *dsPtr); /* 659 */ int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */ void (*reserved661)(void); void (*reserved662)(void); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index b6d5dcf..fd0386c 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1142,7 +1142,7 @@ Tcl_ExternalToUtfDString( Tcl_DString *dstPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { - Tcl_ExternalToUtfDStringEx(encoding, src, srcLen, 0, dstPtr); + Tcl_ExternalToUtfDStringEx(encoding, src, srcLen, TCL_ENCODING_NOCOMPLAIN, dstPtr); return Tcl_DStringValue(dstPtr); } @@ -1176,7 +1176,7 @@ Tcl_ExternalToUtfDString( *------------------------------------------------------------------------- */ -size_t +int Tcl_ExternalToUtfDStringEx( Tcl_Encoding encoding, /* The encoding for the source string, or NULL * for the default system encoding. */ @@ -1221,7 +1221,7 @@ Tcl_ExternalToUtfDStringEx( src += srcRead; if (result != TCL_CONVERT_NOSPACE) { Tcl_DStringSetLength(dstPtr, soFar); - return (result == TCL_OK) ? (size_t)-1 : (size_t)(src - srcStart); + return (result == TCL_OK) ? TCL_INDEX_NONE : (int)(src - srcStart); } flags &= ~TCL_ENCODING_START; srcLen -= srcRead; @@ -1380,7 +1380,7 @@ Tcl_UtfToExternalDString( Tcl_DString *dstPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { - Tcl_UtfToExternalDStringEx(encoding, src, srcLen, 0, dstPtr); + Tcl_UtfToExternalDStringEx(encoding, src, srcLen, TCL_ENCODING_NOCOMPLAIN, dstPtr); return Tcl_DStringValue(dstPtr); } @@ -1415,7 +1415,7 @@ Tcl_UtfToExternalDString( *------------------------------------------------------------------------- */ -size_t +int Tcl_UtfToExternalDStringEx( Tcl_Encoding encoding, /* The encoding for the converted string, or * NULL for the default system encoding. */ @@ -1459,7 +1459,7 @@ Tcl_UtfToExternalDStringEx( while (i >= soFar) { Tcl_DStringSetLength(dstPtr, i--); } - return (result == TCL_OK) ? (size_t)-1 : (size_t)(src - srcStart); + return (result == TCL_OK) ? TCL_INDEX_NONE : (int)(src - srcStart); } flags &= ~TCL_ENCODING_START; @@ -2375,7 +2375,7 @@ UtfToUtfProc( */ if (flags & TCL_ENCODING_MODIFIED) { - if (STOPONERROR) { + if ((STOPONERROR) && (flags & TCL_ENCODING_CHAR_LIMIT)) { result = TCL_CONVERT_MULTIBYTE; break; } @@ -3156,7 +3156,7 @@ TableFromUtfProc( word = fromUnicode[(ch >> 8)][ch & 0xFF]; if ((word == 0) && (ch != 0)) { - if (STOPONERROR) { + if ((STOPONERROR) && (flags & TCL_ENCODING_CHAR_LIMIT)) { result = TCL_CONVERT_UNKNOWN; break; } |