diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 13:30:01 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 13:30:01 (GMT) |
commit | 5c8ce61f7963bdd41e0d7c9d18a7b4e5f918eb35 (patch) | |
tree | f6bba9b64f34a1b2b941103e05773ffe545c1e91 | |
parent | 06ea55d820a91810fe57afda632449d0bca2fe52 (diff) | |
parent | 4723df2a35ce7e7a2d460213d01c361be26a1772 (diff) | |
download | tcl-5c8ce61f7963bdd41e0d7c9d18a7b4e5f918eb35.zip tcl-5c8ce61f7963bdd41e0d7c9d18a7b4e5f918eb35.tar.gz tcl-5c8ce61f7963bdd41e0d7c9d18a7b4e5f918eb35.tar.bz2 |
Merge 8.6. Fix Cygwin compile
-rw-r--r-- | generic/tclZipfs.c | 5 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 2 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 2 | ||||
-rw-r--r-- | win/tclWinFile.c | 2 | ||||
-rw-r--r-- | win/tclWinInit.c | 8 |
5 files changed, 9 insertions, 10 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 4c668b0..b45bdfe 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3104,16 +3104,13 @@ ZipFSListObjCmd( *------------------------------------------------------------------------- */ -#ifdef _WIN32 -#define LIBRARY_SIZE 64 -#endif /* _WIN32 */ - Tcl_Obj * TclZipfs_TclLibrary(void) { Tcl_Obj *vfsInitScript; int found; #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(STATIC_BUILD) +# define LIBRARY_SIZE 64 HMODULE hModule; WCHAR wName[MAX_PATH + LIBRARY_SIZE]; char dllName[(MAX_PATH + LIBRARY_SIZE) * 3]; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index d72913b..1ab5d14 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -44,7 +44,7 @@ TclpFindExecutable( wchar_t buf[PATH_MAX]; char name[PATH_MAX * 3 + 1]; - GetModuleFileNameW(NULL, buf, PATH_MAX); + GetModuleFileNameW(NULL, buf, sizeof(buf)/sizeof(wchar_t)); cygwin_conv_path(3, buf, name, sizeof(name)); length = strlen(name); if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index e2f1104..ece0202 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -95,6 +95,8 @@ extern "C" { # define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 # define HANDLE void * # define HINSTANCE void * +# define HMODULE void * +# define MAX_PATH 260 # define SOCKET unsigned int # define WSAEWOULDBLOCK 10035 typedef unsigned short WCHAR; diff --git a/win/tclWinFile.c b/win/tclWinFile.c index f89b522..1e0aca7 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -885,7 +885,7 @@ TclpFindExecutable( Tcl_SetPanicProc(tclWinDebugPanic); } - GetModuleFileNameW(NULL, wName, MAX_PATH); + GetModuleFileNameW(NULL, wName, sizeof(wName)/sizeof(WCHAR)); WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL); TclWinNoBackslash(name); TclSetObjNameOfExecutable(Tcl_NewStringObj(name, -1), NULL); diff --git a/win/tclWinInit.c b/win/tclWinInit.c index a50d9eb..2830a85 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -334,8 +334,8 @@ InitializeDefaultLibraryDir( char name[(MAX_PATH + LIBRARY_SIZE) * 3]; char *end, *p; - GetModuleFileNameW(hModule, wName, MAX_PATH); - WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, MAX_PATH * 3, NULL, NULL); + GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)); + WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL); end = strrchr(name, '\\'); *end = '\0'; @@ -382,8 +382,8 @@ InitializeSourceLibraryDir( char name[(MAX_PATH + LIBRARY_SIZE) * 3]; char *end, *p; - GetModuleFileNameW(hModule, wName, MAX_PATH); - WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, MAX_PATH * 3, NULL, NULL); + GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)); + WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL); end = strrchr(name, '\\'); *end = '\0'; |