diff options
-rw-r--r-- | doc/Encoding.3 | 4 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 4 | ||||
-rw-r--r-- | generic/tclDecls.h | 9 | ||||
-rw-r--r-- | generic/tclEncoding.c | 7 |
4 files changed, 17 insertions, 7 deletions
diff --git a/doc/Encoding.3 b/doc/Encoding.3 index d95ca89..52e7852 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.3 @@ -208,7 +208,7 @@ used. The return value is a pointer to the value stored in the DString. \fBTcl_ExternalToUtfDStringEx\fR is the same as \fBTcl_ExternalToUtfDString\fR, but it has an additional flags parameter. The return value is the index of the first byte in the input string causing a conversion error. -Or (size_t)-1 if all is OK. +Or TCL_INDEX_NONE if all is OK. .PP \fBTcl_ExternalToUtf\fR converts a source buffer \fIsrc\fR from the specified \fIencoding\fR into UTF-8. Up to \fIsrcLen\fR bytes are converted from the @@ -251,7 +251,7 @@ a pointer to the value stored in the DString. \fBTcl_UtfToExternalDStringEx\fR is the same as \fBTcl_UtfToExternalDString\fR, but it has an additional flags parameter. The return value is the index of the first byte of an utf-8 byte-sequence in the input string causing a -conversion error. Or (size_t)-1 if all is OK. +conversion error. Or TCL_INDEX_NONE if all is OK. .PP \fBTcl_UtfToExternal\fR converts a source buffer \fIsrc\fR from UTF-8 into the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index a413113..a236f8f 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -455,7 +455,7 @@ encConvFromOK: } 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)) { char buf[TCL_INTEGER_SPACE]; sprintf(buf, "%" TCL_Z_MODIFIER "u", result); Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte sequence starting at index %" @@ -547,7 +547,7 @@ encConvToOK: stringPtr = Tcl_GetStringFromObj(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)) { size_t pos = Tcl_NumUtfChars(stringPtr, result); int ucs4; char buf[TCL_INTEGER_SPACE]; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 14a21b9..cc33cf8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3816,6 +3816,15 @@ extern const TclStubs *tclStubsPtr; } \ } while(0) +#undef Tcl_UtfToExternalDString +#define Tcl_UtfToExternalDString(encoding, src, len, ds) \ + (Tcl_UtfToExternalDStringEx((encoding), (src), (len), \ + TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds)) +#undef Tcl_ExternalToUtfDString +#define Tcl_ExternalToUtfDString(encoding, src, len, ds) \ + (Tcl_ExternalToUtfDStringEx((encoding), (src), (len), \ + TCL_ENCODING_NOCOMPLAIN, (ds)), Tcl_DStringValue(ds)) + #if defined(USE_TCL_STUBS) # if defined(_WIN32) && defined(_WIN64) # undef Tcl_GetTime diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 162f25e..9bce621 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1068,6 +1068,7 @@ Tcl_CreateEncoding( *------------------------------------------------------------------------- */ +#undef Tcl_ExternalToUtfDString char * Tcl_ExternalToUtfDString( Tcl_Encoding encoding, /* The encoding for the source string, or NULL @@ -1078,7 +1079,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); } @@ -1304,7 +1305,7 @@ Tcl_ExternalToUtf( * *------------------------------------------------------------------------- */ - +#undef Tcl_UtfToExternalDString char * Tcl_UtfToExternalDString( Tcl_Encoding encoding, /* The encoding for the converted string, or @@ -1315,7 +1316,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); } |