Fix Cygwin 1.7 build.

Avoid using Cygwin sockets as our code assumes that we use WinSock API under
Windows currently (this might change in the future) by defining
__USE_W32_SOCKETS.

Use new, safer and more efficient cygwin_conv_path() function.

Use t_str() instead of fn_str() with Windows API taking file names, under
Cygwin they are different and using fn_str() is incorrect.

A few other minor fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-07-23 23:32:46 +00:00
parent 3d4e20dd0b
commit 715e4f7e3e
15 changed files with 67 additions and 28 deletions

View File

@@ -64,11 +64,13 @@
#include "wx/msw/mslu.h"
// sys/cygwin.h is needed for cygwin_conv_to_full_win32_path()
// and for cygwin_conv_path()
//
// note that it must be included after <windows.h>
#ifdef __GNUWIN32__
#ifdef __CYGWIN__
#include <sys/cygwin.h>
#include <cygwin/version.h>
#endif
#endif // __GNUWIN32__
@@ -1062,7 +1064,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
// instead of our code if available
//
// NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite
if ( !::CopyFile(file1.fn_str(), file2.fn_str(), !overwrite) )
if ( !::CopyFile(file1.t_str(), file2.t_str(), !overwrite) )
{
wxLogSysError(_("Failed to copy the file '%s' to '%s'"),
file1.c_str(), file2.c_str());
@@ -1505,11 +1507,19 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz)
// another example of DOS/Unix mix (Cygwin)
wxString pathUnix = buf;
#if wxUSE_UNICODE
#if CYGWIN_VERSION_DLL_MAJOR >= 1007
cygwin_conv_path(CCP_POSIX_TO_WIN_W, pathUnix.mb_str(wxConvFile), buf, sz);
#else
char bufA[_MAXPATHLEN];
cygwin_conv_to_full_win32_path(pathUnix.mb_str(wxConvFile), bufA);
wxConvFile.MB2WC(buf, bufA, sz);
#endif
#else
#if CYGWIN_VERSION_DLL_MAJOR >= 1007
cygwin_conv_path(CCP_POSIX_TO_WIN_A, pathUnix, buf, sz);
#else
cygwin_conv_to_full_win32_path(pathUnix, buf);
#endif
#endif // wxUSE_UNICODE
#endif // __CYGWIN__
}