diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-15 21:14:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-15 21:14:05 (GMT) |
commit | 859cb34d2ddbdd2548004b0e044f759ed55e5ebe (patch) | |
tree | 208a77acdb455c105e739d589128c3dd644af53e /win | |
parent | 2bdb719524ba2e7826cfdf6a82bd80c2bcdd9c75 (diff) | |
parent | 5841a02367f05ffbefe36849606d77718a556cb2 (diff) | |
download | tcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.zip tcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.tar.gz tcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.tar.bz2 |
[Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
Diffstat (limited to 'win')
-rw-r--r-- | win/cat.c | 6 | ||||
-rw-r--r-- | win/tclWinFile.c | 62 | ||||
-rw-r--r-- | win/tclWinPort.h | 51 |
3 files changed, 9 insertions, 110 deletions
@@ -16,11 +16,7 @@ #endif #include <stdio.h> -#ifdef __CYGWIN__ -# include <unistd.h> -#else -# include <io.h> -#endif +#include <io.h> #include <string.h> #include <tchar.h> diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6e7b4c2..dcc05bb 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -1809,27 +1809,10 @@ TclpObjChdir( { int result; const TCHAR *nativePath; -#ifdef __CYGWIN__ - extern int cygwin_conv_to_posix_path(const char *, char *); - char posixPath[MAX_PATH+1]; - const char *path; - Tcl_DString ds; -#endif /* __CYGWIN__ */ nativePath = Tcl_FSGetNativePath(pathPtr); -#ifdef __CYGWIN__ - /* - * Cygwin chdir only groks POSIX path. - */ - - path = Tcl_WinTCharToUtf(nativePath, -1, &ds); - cygwin_conv_to_posix_path(path, posixPath); - result = (chdir(posixPath) == 0 ? 1 : 0); - Tcl_DStringFree(&ds); -#else /* __CYGWIN__ */ result = SetCurrentDirectory(nativePath); -#endif /* __CYGWIN__ */ if (result == 0) { TclWinConvertError(GetLastError()); @@ -1838,51 +1821,6 @@ TclpObjChdir( return 0; } -#ifdef __CYGWIN__ -/* - *--------------------------------------------------------------------------- - * - * TclpReadlink -- - * - * This function replaces the library version of readlink(). - * - * Results: - * The result is a pointer to a string specifying the contents of the - * symbolic link given by 'path', or NULL if the symbolic link could not - * be read. Storage for the result string is allocated in bufferPtr; the - * caller must call Tcl_DStringFree() when the result is no longer - * needed. - * - * Side effects: - * See readlink() documentation. - * - *--------------------------------------------------------------------------- - */ - -char * -TclpReadlink( - const char *path, /* Path of file to readlink (UTF-8). */ - Tcl_DString *linkPtr) /* Uninitialized or free DString filled with - * contents of link (UTF-8). */ -{ - char link[MAXPATHLEN]; - int length; - char *native; - Tcl_DString ds; - - native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); - length = readlink(native, link, sizeof(link)); /* INTL: Native. */ - Tcl_DStringFree(&ds); - - if (length < 0) { - return NULL; - } - - Tcl_ExternalToUtfDString(NULL, link, length, linkPtr); - return Tcl_DStringValue(linkPtr); -} -#endif /* __CYGWIN__ */ - /* *---------------------------------------------------------------------- * diff --git a/win/tclWinPort.h b/win/tclWinPort.h index e5dac8c..e3c5a49 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -92,21 +92,11 @@ typedef DWORD_PTR * PDWORD_PTR; #include <signal.h> #include <limits.h> -#ifdef __CYGWIN__ -# include <unistd.h> -# ifndef _vsnprintf -# define _vsnprintf vsnprintf -# endif -# ifndef _wcsicmp -# define _wcsicmp wcscasecmp -# endif -#else -# ifndef strncasecmp -# define strncasecmp strnicmp -# endif -# ifndef strcasecmp -# define strcasecmp stricmp -# endif +#ifndef strncasecmp +# define strncasecmp strnicmp +#endif +#ifndef strcasecmp +# define strcasecmp stricmp #endif /* @@ -127,25 +117,6 @@ typedef DWORD_PTR * PDWORD_PTR; #include <time.h> /* - * cygwin does not have this struct. - */ -#ifdef __CYGWIN__ - struct _stat32i64 { - dev_t st_dev; - ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - dev_t st_rdev; - __int64 st_size; - struct {long tv_sec;} st_atim; - struct {long tv_sec;} st_mtim; - struct {long tv_sec;} st_ctim; - }; -#endif - -/* * The following defines redefine the Windows Socket errors as * BSD errors so Tcl_PosixError can do the right thing. */ @@ -549,18 +520,12 @@ typedef DWORD_PTR * PDWORD_PTR; * use by tclAlloc.c. */ -#ifdef __CYGWIN__ -# define TclpSysAlloc(size, isBin) malloc((size)) -# define TclpSysFree(ptr) free((ptr)) -# define TclpSysRealloc(ptr, size) realloc((ptr), (size)) -#else -# define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \ +#define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \ (DWORD)0, (DWORD)size)) -# define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \ +#define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \ (DWORD)0, (HGLOBAL)ptr)) -# define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \ +#define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \ (DWORD)0, (LPVOID)ptr, (DWORD)size)) -#endif /* * The following defines map from standard socket names to our internal |