projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documenting WX_MONOLITHIC build option.
[wxWidgets.git]
/
src
/
common
/
file.cpp
diff --git
a/src/common/file.cpp
b/src/common/file.cpp
index 1e6f0e41e1a70f3bbd42ce17265dea3ee7a669cb..b44087c38b4725a910b5013b6a36c6783a882cd8 100644
(file)
--- a/
src/common/file.cpp
+++ b/
src/common/file.cpp
@@
-14,10
+14,6
@@
// headers
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "file.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
@@
-217,11
+213,9
@@
bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
wxLogSysError(_("can't create file '%s'"), szFileName);
return false;
}
wxLogSysError(_("can't create file '%s'"), szFileName);
return false;
}
- else
- {
- Attach(fd);
- return true;
- }
+
+ Attach(fd);
+ return true;
}
// open the file
}
// open the file
@@
-271,10
+265,9
@@
bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
wxLogSysError(_("can't open file '%s'"), szFileName);
return false;
}
wxLogSysError(_("can't open file '%s'"), szFileName);
return false;
}
- else {
- Attach(fd);
- return true;
- }
+
+ Attach(fd);
+ return true;
}
// close
}
// close
@@
-334,17
+327,18
@@
size_t wxFile::Write(const void *pBuf, size_t nCount)
// flush
bool wxFile::Flush()
{
// flush
bool wxFile::Flush()
{
- if ( IsOpened() ) {
-#if defined(__VISUALC__) || HAVE_FSYNC
+#if defined(__VISUALC__) || defined(HAVE_FSYNC)
+ // fsync() only works on disk files and returns errors for pipes, don't
+ // call it then
+ if ( IsOpened() && GetKind() == wxFILE_KIND_DISK )
+ {
if ( wxFsync(m_fd) == -1 )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
return false;
}
if ( wxFsync(m_fd) == -1 )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
return false;
}
-#else // no fsync
- // just do nothing
-#endif // fsync
}
}
+#endif // fsync
return true;
}
return true;
}