summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unix/tclUnixFile.c6
-rw-r--r--win/tclWinFile.c2
-rw-r--r--win/tclWinInit.c12
3 files changed, 10 insertions, 10 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 3b09799..f2a6b23 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -43,9 +43,9 @@ TclpFindExecutable(
#ifdef __CYGWIN__
int length;
char buf[PATH_MAX * 2];
- char name[PATH_MAX * TCL_UTF_MAX + 1];
- GetModuleFileNameW(NULL, buf, PATH_MAX);
- cygwin_conv_path(3, buf, name, PATH_MAX);
+ char name[PATH_MAX * 3 + 1];
+ GetModuleFileNameW(NULL, buf, sizeof(buf)/2);
+ cygwin_conv_path(3, buf, name, sizeof(name));
length = strlen(name);
if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) {
/* Strip '.exe' part. */
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index d582664..8df346f 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -852,7 +852,7 @@ TclpFindExecutable(
* create this process.
*/
- if (GetModuleFileNameW(NULL, wName, MAX_PATH) == 0) {
+ if (GetModuleFileNameW(NULL, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
GetModuleFileNameA(NULL, name, sizeof(name));
/*
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 6c34573..2abcd3e 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -342,11 +342,11 @@ InitializeDefaultLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
+ if (GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
+ GetModuleFileNameA(hModule, name, sizeof(name));
} else {
ToUtf(wName, name);
}
@@ -393,11 +393,11 @@ InitializeSourceLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
+ if (GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
+ GetModuleFileNameA(hModule, name, sizeof(name));
} else {
ToUtf(wName, name);
}