diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-08-23 10:35:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-08-23 10:35:16 (GMT) |
commit | a5448b6c8bdb4aeac833b411b94637047889cbd8 (patch) | |
tree | 9da79a1212b4bfa12b0316e72aa202b10b15d54f /unix | |
parent | aee8e4fe5628042e7a8988e57af696f73f8039b9 (diff) | |
parent | 4c3b4b2a2b133094b98d27616e7728d99097a57f (diff) | |
download | tcl-a5448b6c8bdb4aeac833b411b94637047889cbd8.zip tcl-a5448b6c8bdb4aeac833b411b94637047889cbd8.tar.gz tcl-a5448b6c8bdb4aeac833b411b94637047889cbd8.tar.bz2 |
Merge 8.5
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixFile.c | 33 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 17 |
2 files changed, 32 insertions, 18 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 2023789..a75ae22 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -42,9 +42,10 @@ TclpFindExecutable( Tcl_Encoding encoding; #ifdef __CYGWIN__ int length; - char buf[PATH_MAX * 2]; + wchar_t buf[PATH_MAX] = L""; char name[PATH_MAX * 3 + 1]; - GetModuleFileNameW(NULL, buf, sizeof(buf)/2); + + GetModuleFileNameW(NULL, buf, PATH_MAX); cygwin_conv_path(3, buf, name, sizeof(name)); length = strlen(name); if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { @@ -249,9 +250,9 @@ TclpMatchInDirectory( Tcl_Obj *tailPtr; const char *nativeTail; - native = Tcl_FSGetNativePath(pathPtr); + native = (const char *)Tcl_FSGetNativePath(pathPtr); tailPtr = TclPathPart(interp, pathPtr, TCL_PATH_TAIL); - nativeTail = Tcl_FSGetNativePath(tailPtr); + nativeTail = (const char *)Tcl_FSGetNativePath(tailPtr); matchResult = NativeMatchType(interp, native, nativeTail, types); if (matchResult == 1) { Tcl_ListObjAppendElement(interp, resultPtr, pathPtr); @@ -649,7 +650,7 @@ int TclpObjChdir( Tcl_Obj *pathPtr) /* Path to new working directory */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -678,7 +679,7 @@ TclpObjLstat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - return TclOSlstat(Tcl_FSGetNativePath(pathPtr), bufPtr); + return TclOSlstat((const char *)Tcl_FSGetNativePath(pathPtr), bufPtr); } /* @@ -719,7 +720,7 @@ TclpGetNativeCwd( #endif /* USEGETWD */ if ((clientData == NULL) || strcmp(buffer, (const char *) clientData)) { - char *newCd = ckalloc(strlen(buffer) + 1); + char *newCd = (char*)ckalloc(strlen(buffer) + 1); strcpy(newCd, buffer); return newCd; @@ -846,7 +847,7 @@ TclpObjStat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -863,7 +864,7 @@ TclpObjLink( int linkAction) { if (toPtr != NULL) { - const char *src = Tcl_FSGetNativePath(pathPtr); + const char *src = (const char *)Tcl_FSGetNativePath(pathPtr); const char *target = NULL; if (src == NULL) { @@ -909,7 +910,7 @@ TclpObjLink( Tcl_DecrRefCount(absPtr); Tcl_DecrRefCount(dirPtr); } else { - target = Tcl_FSGetNativePath(toPtr); + target = (const char*)Tcl_FSGetNativePath(toPtr); if (target == NULL) { return NULL; } @@ -982,7 +983,7 @@ TclpObjLink( } Tcl_DecrRefCount(transPtr); - length = readlink(Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); + length = readlink((const char *)Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); if (length < 0) { return NULL; } @@ -1115,7 +1116,7 @@ TclNativeCreateNativeRep( return NULL; } Tcl_DecrRefCount(validPathPtr); - nativePathPtr = ckalloc(len); + nativePathPtr = (char *)ckalloc(len); memcpy(nativePathPtr, Tcl_DStringValue(&ds), len); Tcl_DStringFree(&ds); @@ -1156,7 +1157,7 @@ TclNativeDupInternalRep( len = (strlen((const char*) clientData) + 1) * sizeof(char); - copy = ckalloc(len); + copy = (char *)ckalloc(len); memcpy(copy, clientData, len); return copy; } @@ -1182,7 +1183,7 @@ TclpUtime( Tcl_Obj *pathPtr, /* File to modify */ struct utimbuf *tval) /* New modification date structure */ { - return utime(Tcl_FSGetNativePath(pathPtr), tval); + return utime((const char *)Tcl_FSGetNativePath(pathPtr), tval); } #ifdef __CYGWIN__ @@ -1193,7 +1194,7 @@ TclOSstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = stat(name, &buf); statBuf->st_mode = buf.st_mode; @@ -1216,7 +1217,7 @@ TclOSlstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = lstat(name, &buf); statBuf->st_mode = buf.st_mode; diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 0ae4f25..ab2f55e 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -86,6 +86,9 @@ typedef off_t Tcl_SeekOffset; #endif #ifdef __CYGWIN__ +#ifdef __cplusplus +extern "C" { +#endif /* Make some symbols available without including <windows.h> */ # define DWORD unsigned int # define CP_UTF8 65001 @@ -95,8 +98,12 @@ typedef off_t Tcl_SeekOffset; # define SOCKET unsigned int # define WSAEWOULDBLOCK 10035 typedef unsigned short WCHAR; - __declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const char *, void *); - __declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const char *, int); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wignored-attributes" +#endif + __declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const void *, void *); + __declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const void *, int); __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int, char *, int, const char *, void *); __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int, @@ -107,9 +114,15 @@ typedef off_t Tcl_SeekOffset; __declspec(dllimport) extern __stdcall int GetFileAttributesW(const WCHAR *); __declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int); __declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif # define timezone _timezone extern int TclOSstat(const char *name, void *statBuf); extern int TclOSlstat(const char *name, void *statBuf); +#ifdef __cplusplus +} +#endif #elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) # define TclOSstat(name, buf) stat64(name, (struct stat64 *)buf) # define TclOSlstat(name,buf) lstat64(name, (struct stat64 *)buf) |