summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclPlatDecls.h20
-rw-r--r--win/tclWin32Dll.c5
2 files changed, 10 insertions, 15 deletions
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index 2265d80..e35091d 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -117,20 +117,18 @@ extern const TclPlatStubs *tclPlatStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#if defined(USE_TCL_STUBS) && defined(_WIN32) \
+#if defined(USE_TCL_STUBS) && (defined(_WIN32) || defined(__CYGWIN__))\
&& ((TCL_UTF_MAX > 4) || defined(TCL_NO_DEPRECATED))
#undef Tcl_WinUtfToTChar
#undef Tcl_WinTCharToUtf
-
-#define Tcl_WinUtfToTChar(string, len, dsPtr) (((string) != NULL) \
- ? (Tcl_DStringInit(dsPtr), (TCHAR *)Tcl_UtfToUtf16DString((string), (len), (dsPtr))) \
- : (Tcl_DStringInit(dsPtr), (void)(len), NULL))
-#define Tcl_WinTCharToUtf(string, len, dsPtr) (((string) != NULL) \
- ? (Tcl_DStringInit(dsPtr), (char *)Tcl_Utf16ToUtfDString((string), ((int)(len) >> 1), (dsPtr))) \
- : (Tcl_DStringInit(dsPtr), (void)(len), NULL))
+#ifdef _WIN32
+#define Tcl_WinUtfToTChar(string, len, dsPtr) ((Tcl_DStringInit(dsPtr), (string) != NULL) \
+ ? (TCHAR *)Tcl_UtfToUtf16DString((string), (len), (dsPtr)) \
+ : ((void)(len), NULL))
+#define Tcl_WinTCharToUtf(string, len, dsPtr) ((Tcl_DStringInit(dsPtr), (string) != NULL) \
+ ? (char *)Tcl_Utf16ToUtfDString((string), ((int)(len) >> 1), (dsPtr)) \
+ : ((void)(len), NULL))
+#endif
#endif
-
#endif /* _TCLPLATDECLS */
-
-
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index fc97cba..ef8f503 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -492,10 +492,7 @@ Tcl_WinTCharToUtf(
if (!string) {
return NULL;
}
- if (len > 0) {
- len /= 2;
- }
- return Tcl_Utf16ToUtfDString((unsigned short *)string, len, dsPtr);
+ return Tcl_Utf16ToUtfDString((unsigned short *)string, len >> 1, dsPtr);
}
#endif /* !defined(TCL_NO_DEPRECATED) */