From c69d9fda477d73e88273b55ef9e129a7e0ee8690 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 10 Dec 2020 12:17:50 +0000 Subject: Potential fix for [ed5be77734]: win: "comx:" not recognized as serial port. (concluded from code inspection, not tested yet) --- generic/tclFileName.c | 4 ++-- win/tclWinFile.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 15f93f4..cfd76e6 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -242,7 +242,7 @@ ExtractWinRoot( if (path[4] == '\0') { abs = 4; - } else if (path [4] == ':' && path[5] == '\0') { + } else if (path[4] == ':' && path[5] == '\0') { abs = 5; } @@ -264,7 +264,7 @@ ExtractWinRoot( if (path[4] == '\0') { abs = 4; - } else if (path [4] == ':' && path[5] == '\0') { + } else if (path[4] == ':' && path[5] == '\0') { abs = 5; } } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6cfeae1..2fa2258 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -1250,7 +1250,7 @@ WinIsReserved( if (path[4] == '\0') { return 4; - } else if (path [4] == ':' && path[5] == '\0') { + } else if (path[4] == ':' && path[5] == '\0') { return 4; } } else if ((path[2] == 'n' || path[2] == 'N') && path[3] == '\0') { @@ -1271,7 +1271,7 @@ WinIsReserved( if (path[4] == '\0') { return 4; - } else if (path [4] == ':' && path[5] == '\0') { + } else if (path[4] == ':' && path[5] == '\0') { return 4; } } @@ -3101,6 +3101,7 @@ TclNativeCreateNativeRep( } MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len + 1); + nativePathPtr[len] = 0; /* * If path starts with "//?/" or "\\?\" (extended path), translate any -- cgit v0.12 From 45c9e44c82a3494ca972276c1454a9bda8e0900e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 10 Dec 2020 12:31:37 +0000 Subject: Tweak: account for terminating '\0' --- win/tclWinFile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 2fa2258..2967cce 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -3100,7 +3100,7 @@ TclNativeCreateNativeRep( goto done; } MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, - len + 1); + len + 2); nativePathPtr[len] = 0; /* -- cgit v0.12