diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-05 20:15:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-05 20:15:15 (GMT) |
commit | 9888ccda67f1a91d95ba372d5f008f939da39b6b (patch) | |
tree | c2458544667db9eb3f788ebf678f941b92a296a7 /generic | |
parent | 3558c049708c9a7a007d5a4462acb95507ebab71 (diff) | |
download | tcl-9888ccda67f1a91d95ba372d5f008f939da39b6b.zip tcl-9888ccda67f1a91d95ba372d5f008f939da39b6b.tar.gz tcl-9888ccda67f1a91d95ba372d5f008f939da39b6b.tar.bz2 |
Fix signature of TclWCharToUtfDString for TCL_UTF_MAX=6, and handling of length -1
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclInt.h | 4 | ||||
-rw-r--r-- | generic/tclUtf.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index cb08a54..1631316 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3175,9 +3175,9 @@ MODULE_SCOPE void TclRegisterCommandTypeName( #if (TCL_UTF_MAX > 4) && (defined(__CYGWIN__) || defined(_WIN32)) MODULE_SCOPE int TclUtfToWChar(const char *src, WCHAR *chPtr); MODULE_SCOPE char * TclWCharToUtfDString(const WCHAR *uniStr, - int uniLength, Tcl_DString *dsPtr); + size_t uniLength, Tcl_DString *dsPtr); MODULE_SCOPE WCHAR * TclUtfToWCharDString(const char *src, - int length, Tcl_DString *dsPtr); + size_t length, Tcl_DString *dsPtr); #else # define TclUtfToWChar TclUtfToUniChar # define TclWCharToUtfDString Tcl_UniCharToUtfDString diff --git a/generic/tclUtf.c b/generic/tclUtf.c index ef89a6a..e27e465 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -269,7 +269,7 @@ Tcl_UniCharToUtfDString( char * TclWCharToUtfDString( const WCHAR *uniStr, /* WCHAR string to convert to UTF-8. */ - int uniLength, /* Length of WCHAR string in Tcl_UniChars + size_t uniLength, /* Length of WCHAR string in Tcl_UniChars * (must be >= 0). */ Tcl_DString *dsPtr) /* UTF-8 representation of string is appended * to this previously initialized DString. */ @@ -636,7 +636,7 @@ Tcl_UtfToUniCharDString( WCHAR * TclUtfToWCharDString( const char *src, /* UTF-8 string to convert to Unicode. */ - int length, /* Length of UTF-8 string in bytes, or -1 for + size_t length, /* Length of UTF-8 string in bytes, or -1 for * strlen(). */ Tcl_DString *dsPtr) /* Unicode representation of string is * appended to this previously initialized @@ -646,7 +646,7 @@ TclUtfToWCharDString( const char *p, *end; int oldLength; - if (length < 0) { + if (length == TCL_AUTO_LENGTH) { length = strlen(src); } |