diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-10-06 19:20:43 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-10-06 19:20:43 (GMT) |
commit | 99e9ce3656f195c60ba4e928559c05d47167901c (patch) | |
tree | 64fba30ebef34869f49fcdf5b36b3b41164698db /win | |
parent | d84d03b91a4eb72f88b56011713706a6f36bc17c (diff) | |
download | tcl-99e9ce3656f195c60ba4e928559c05d47167901c.zip tcl-99e9ce3656f195c60ba4e928559c05d47167901c.tar.gz tcl-99e9ce3656f195c60ba4e928559c05d47167901c.tar.bz2 |
Use more TCL_AUTO_LENGTH, when appropriate
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWin32Dll.c | 12 | ||||
-rw-r--r-- | win/tclWinPipe.c | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 03bcc7c..25bddee 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -466,14 +466,14 @@ TclWinDriveLetterForVolMountPoint( TCHAR * Tcl_WinUtfToTChar( const char *string, /* Source string in UTF-8. */ - size_t len, /* Source string length in bytes, or (size_t)-1 + size_t len, /* Source string length in bytes, or -1 * for strlen(). */ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { Tcl_DStringInit(dsPtr); if (!string) { - return (TCHAR *)Tcl_DStringValue(dsPtr); + return NULL; } return Tcl_UtfToUniCharDString(string, len, dsPtr); } @@ -481,18 +481,18 @@ Tcl_WinUtfToTChar( char * Tcl_WinTCharToUtf( const TCHAR *string, /* Source string in Unicode. */ - size_t len, /* Source string length in bytes, or (size_t)-1 + size_t len, /* Source string length in bytes, or -1 * for platform-specific string length. */ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { Tcl_DStringInit(dsPtr); if (!string) { - return Tcl_DStringValue(dsPtr); + return NULL; } - if (len != (size_t)-1) { + if (len != TCL_AUTO_LENGTH) { len /= 2; - } else if (len < 0) { + } else { len = wcslen(string); } return Tcl_UniCharToUtfDString(string, len, dsPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 0313708..eda9fe0 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -851,7 +851,7 @@ TclpCloseFile( * Results: * Returns the process id for the child process. If the pid was not known * by Tcl, either because the pid was not created by Tcl or the child - * process has already been reaped, -1 is returned. + * process has already been reaped, (size_t)-1 is returned. * * Side effects: * None. |