was added.
+2.9.2:
+------
+
+MSW:
+
+- Fix Cygwin 1.7 build (David Gangola).
+
+
2.9.1:
------
wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase);
};
-#if defined(__UNIX__)
+#if defined(__UNIX__) && !defined(__CYGWIN__)
#include "wx/unix/app.h"
#else
// this has to be a class and not a typedef as we forward declare it
#define va_list __gnuc_va_list
#endif /* HP-UX */
+/* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */
+/* when using Windows sockets. */
+#if defined(__CYGWIN__) && (__WXMSW__)
+#define __USE_W32_SOCKETS
+#endif
+
/* ---------------------------------------------------------------------------- */
/* check for native bool type and TRUE/FALSE constants */
/* ---------------------------------------------------------------------------- */
// TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be
// monitored using MsgWaitForMultipleObjects())
-#if defined(__WXOSX__) || defined(__UNIX__)
+#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__CYGWIN__))
#define wxUSE_EVENTLOOP_SOURCE 1
#else
#define wxUSE_EVENTLOOP_SOURCE 0
#endif // wxUSE_GUI
// include the header defining wxConsoleEventLoop for Unix systems
-#if defined(__UNIX__)
+#if defined(__UNIX__) && !defined(__CYGWIN__)
#include "wx/unix/evtloop.h"
#endif
{ return wxCRT_Lstat(path.fn_str(), buf); }
inline int wxRmDir(const wxString& path)
{ return wxCRT_RmDir(path.fn_str()); }
-#if defined(__WINDOWS__) || (defined(__OS2__) && defined(__WATCOMC__))
+#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) \
+ || (defined(__OS2__) && defined(__WATCOMC__))
inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0)
{ return wxCRT_MkDir(path.fn_str()); }
#else
#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__
// 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());
// 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__
}
// access time (see #10567)
m_hFile = ::CreateFile
(
- filename.fn_str(), // name
+ filename.t_str(), // name
mode == ReadAttr ? FILE_READ_ATTRIBUTES // access mask
: FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | // sharing mode
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
// we must use GetFileAttributes() instead of the ANSI C functions because
// it can cope with network (UNC) paths unlike them
- DWORD ret = ::GetFileAttributes(filePath.fn_str());
+ DWORD ret = ::GetFileAttributes(filePath.t_str());
return (ret != INVALID_FILE_ATTRIBUTES) && !(ret & FILE_ATTRIBUTE_DIRECTORY);
#else // !__WIN32__
return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
// stat() can't cope with network paths
- DWORD ret = ::GetFileAttributes(strPath.fn_str());
+ DWORD ret = ::GetFileAttributes(strPath.t_str());
return (ret != INVALID_FILE_ATTRIBUTES) && (ret & FILE_ATTRIBUTE_DIRECTORY);
#elif defined(__OS2__)
}
#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
- if ( !::GetTempFileName(dir.fn_str(), name.fn_str(), 0,
- wxStringBuffer(path, MAX_PATH + 1)) )
+ if (!::GetTempFileName(dir.t_str(), name.t_str(), 0,
+ wxStringBuffer(path, MAX_PATH + 1)))
{
wxLogLastError(wxT("GetTempFileName"));
SHFILEOPSTRUCT fileop;
wxZeroMemory(fileop);
fileop.wFunc = FO_DELETE;
+ #if defined(__CYGWIN__) && defined(wxUSE_UNICODE)
+ fileop.pFrom = path.wc_str();
+ #else
fileop.pFrom = path.fn_str();
+ #endif
fileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION;
#ifndef __WXWINCE__
// FOF_NOERRORUI is not defined in WinCE
wxString path(GetFullPath());
#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
- DWORD sz = ::GetShortPathName(path.fn_str(), NULL, 0);
+ DWORD sz = ::GetShortPathName(path.t_str(), NULL, 0);
if ( sz != 0 )
{
wxString pathOut;
if ( ::GetShortPathName
(
- path.fn_str(),
+ path.t_str(),
wxStringBuffer(pathOut, sz),
sz
) != 0 )
if ( s_pfnGetLongPathName )
{
- DWORD dwSize = (*s_pfnGetLongPathName)(path.fn_str(), NULL, 0);
+ DWORD dwSize = (*s_pfnGetLongPathName)(path.t_str(), NULL, 0);
if ( dwSize > 0 )
{
if ( (*s_pfnGetLongPathName)
(
- path.fn_str(),
+ path.t_str(),
wxStringBuffer(pathOut, dwSize),
dwSize
) != 0 )
continue;
}
- hFind = ::FindFirstFile(tmpPath.fn_str(), &findFileData);
+ hFind = ::FindFirstFile(tmpPath.t_str(), &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
// Error: most likely reason is that path doesn't exist, so
#include <errno.h>
-#ifdef __UNIX__
+#if defined(__UNIX__) && !defined(__CYGWIN__)
#include <netdb.h>
#include <arpa/inet.h>
#endif // __UNIX__
#ifdef __WXMSW__
#define HAVE_INET_ADDR
+ #ifndef HAVE_GETHOSTBYNAME
#define HAVE_GETHOSTBYNAME
+ #endif
+ #ifndef HAVE_GETSERVBYNAME
#define HAVE_GETSERVBYNAME
+ #endif
// under MSW getxxxbyname() functions are MT-safe (but not reentrant) so
// we don't need to serialize calls to them
size_t m_nCopied;
};
-#ifdef __WINDOWS__
+#if defined(__WINDOWS__) && !defined(__CYGWIN__)
// on Windows, we should use %s and %c regardless of the build:
class wxPrintfFormatConverterWchar : public wxFormatConverterBase<wchar_t>
switch ( kind )
{
case wxBITMAP_TYPE_CUR_RESOURCE:
- hcursor = ::LoadCursor(wxGetInstance(), filename.fn_str());
+ hcursor = ::LoadCursor(wxGetInstance(), filename.t_str());
break;
#ifndef __WXWINCE__
case wxBITMAP_TYPE_CUR:
- hcursor = ::LoadCursorFromFile(filename.fn_str());
+ hcursor = ::LoadCursorFromFile(filename.t_str());
break;
#endif
m_handle = (HBITMAP)::LoadImage
(
wxGetInstance(),
- filename.fn_str(),
+ filename.t_str(),
IMAGE_BITMAP,
0, 0, // don't specify the size
LR_CREATEDIBSECTION | LR_LOADFROMFILE
inline FIND_DATA FindFirst(const wxString& spec,
FIND_STRUCT *finddata)
{
- return ::FindFirstFile(spec.fn_str(), finddata);
+ return ::FindFirstFile(spec.t_str(), finddata);
}
inline bool FindNext(FIND_DATA fd, FIND_STRUCT *finddata)
}
else // have valid file name, load metafile from it
{
- m_hMF = (WXHANDLE)::GetEnhMetaFile(m_filename.fn_str());
+ m_hMF = (WXHANDLE)::GetEnhMetaFile(m_filename.t_str());
if ( !m_hMF )
{
wxLogSysError(_("Failed to load metafile from file \"%s\"."),
#include "wx/msw/ole/oleutils.h"
#include <shldisp.h>
-#if defined(__MINGW32__) || defined (__WATCOMC__)
+#if defined(__MINGW32__) || defined (__WATCOMC__) || defined(__CYGWIN__)
// needed for IID_IAutoComplete, IID_IAutoComplete2 and ACO_AUTOSUGGEST
#include <shlguid.h>
#endif
#if defined(__CYGWIN__)
#include <sys/unistd.h>
#include <sys/stat.h>
- #include <sys/cygwin.h> // for cygwin_conv_to_full_win32_path()
+ #include <sys/cygwin.h> // for cygwin_conv_path()
+ // and cygwin_conv_to_full_win32_path()
+ #include <cygwin/version.h>
#endif //GNUWIN32
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
// first branch is for Cygwin
#if defined(__UNIX__) && !defined(__WINE__)
- const wxChar *szHome = wxGetenv("HOME");
+ const wxChar *szHome = wxGetenv(wxT("HOME"));
if ( szHome == NULL ) {
// we're homeless...
wxLogWarning(_("can't find user's HOME, using current directory."));
#ifdef __CYGWIN__
// Cygwin returns unix type path but that does not work well
static wxChar windowsPath[MAX_PATH];
- cygwin_conv_to_full_win32_path(strDir, windowsPath);
+ #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+ cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir, windowsPath, MAX_PATH);
+ #else
+ cygwin_conv_to_full_win32_path(strDir, windowsPath);
+ #endif
strDir = windowsPath;
#endif
#elif defined(__WXWINCE__)
ULARGE_INTEGER bytesFree, bytesTotal;
// may pass the path as is, GetDiskFreeSpaceEx() is smart enough
- if ( !pGetDiskFreeSpaceEx(path.fn_str(),
+ if ( !pGetDiskFreeSpaceEx(path.t_str(),
&bytesFree,
&bytesTotal,
NULL) )
// FIXME: this is wrong, we should extract the root drive from path
// instead, but this is the job for wxFileName...
- if ( !::GetDiskFreeSpace(path.fn_str(),
+ if ( !::GetDiskFreeSpace(path.t_str(),
&lSectorsPerCluster,
&lBytesPerSector,
&lNumberOfFreeClusters,