added wxFileSize_t, changed types of wxFile methods/parameters once again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -150,10 +150,10 @@ INCOMPATIBLE CHANGES SINCE 2.4.x
|
|||||||
- wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no longer
|
- wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no longer
|
||||||
needed, you can treat wxNotebook as any other control and put it directly
|
needed, you can treat wxNotebook as any other control and put it directly
|
||||||
into the sizer that was wxNotebookSizer's parent sizer in old code.
|
into the sizer that was wxNotebookSizer's parent sizer in old code.
|
||||||
- wxFile methods now return wxFileOffset which may be a 64 bit integer type,
|
- wxFile methods now return either wxFileOffset or wxFileSize_t which may be a
|
||||||
even on 32 bit platforms, instead of off_t and so the return value of
|
64 bit integer type, even on 32 bit platforms, instead of off_t and so the
|
||||||
wxFile::Length(), for example, shouldn't be assigned to off_t variable any
|
return value of wxFile::Length(), for example, shouldn't be assigned to off_t
|
||||||
more (the compiler might warn you about this).
|
variable any more (the compiler might warn you about this)
|
||||||
- wxListItem::m_data is now of type wxUIntPtr, not long, for compatibility
|
- wxListItem::m_data is now of type wxUIntPtr, not long, for compatibility
|
||||||
with 64 bit systems
|
with 64 bit systems
|
||||||
|
|
||||||
|
@@ -95,14 +95,14 @@ public:
|
|||||||
|
|
||||||
// read/write (unbuffered)
|
// read/write (unbuffered)
|
||||||
// returns number of bytes read or ofsInvalid on error
|
// returns number of bytes read or ofsInvalid on error
|
||||||
size_t Read(void *pBuf, size_t nCount);
|
wxFileSize_t Read(void *pBuf, wxFileSize_t nCount);
|
||||||
// returns the number of bytes written
|
// returns the number of bytes written
|
||||||
size_t Write(const void *pBuf, size_t nCount);
|
wxFileSize_t Write(const void *pBuf, wxFileSize_t nCount);
|
||||||
// returns true on success
|
// returns true on success
|
||||||
bool Write(const wxString& s, wxMBConv& conv = wxConvUTF8)
|
bool Write(const wxString& s, wxMBConv& conv = wxConvUTF8)
|
||||||
{
|
{
|
||||||
const wxWX2MBbuf buf = s.mb_str(conv);
|
const wxWX2MBbuf buf = s.mb_str(conv);
|
||||||
size_t size = strlen(buf);
|
wxFileSize_t size = strlen(buf);
|
||||||
return Write((const char *) buf, size) == size;
|
return Write((const char *) buf, size) == size;
|
||||||
}
|
}
|
||||||
// flush data not yet written
|
// flush data not yet written
|
||||||
@@ -164,7 +164,7 @@ public:
|
|||||||
bool IsOpened() const { return m_file.IsOpened(); }
|
bool IsOpened() const { return m_file.IsOpened(); }
|
||||||
|
|
||||||
// I/O (both functions return true on success, false on failure)
|
// I/O (both functions return true on success, false on failure)
|
||||||
bool Write(const void *p, size_t n) { return m_file.Write(p, n) != 0; }
|
bool Write(const void *p, wxFileSize_t n) { return m_file.Write(p, n) == n; }
|
||||||
bool Write(const wxString& str, wxMBConv& conv = wxConvUTF8)
|
bool Write(const wxString& str, wxMBConv& conv = wxConvUTF8)
|
||||||
{ return m_file.Write(str, conv); }
|
{ return m_file.Write(str, conv); }
|
||||||
|
|
||||||
|
@@ -131,6 +131,7 @@ enum wxSeekMode
|
|||||||
// Implemented in filefnwce.cpp
|
// Implemented in filefnwce.cpp
|
||||||
#if defined( __WXWINCE__)
|
#if defined( __WXWINCE__)
|
||||||
typedef __int64 wxFileOffset;
|
typedef __int64 wxFileOffset;
|
||||||
|
typedef unsigned __int64 wxFileSize_t;
|
||||||
#define wxFileOffsetFmtSpec _("I64")
|
#define wxFileOffsetFmtSpec _("I64")
|
||||||
int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode));
|
int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode));
|
||||||
int wxAccess(const wxChar *name, int WXUNUSED(how));
|
int wxAccess(const wxChar *name, int WXUNUSED(how));
|
||||||
@@ -195,9 +196,11 @@ enum wxSeekMode
|
|||||||
|
|
||||||
#if wxHAS_HUGE_FILES
|
#if wxHAS_HUGE_FILES
|
||||||
typedef wxLongLong_t wxFileOffset;
|
typedef wxLongLong_t wxFileOffset;
|
||||||
|
typedef unsigned wxLongLong_t wxFileSize_t;
|
||||||
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
|
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
|
||||||
#else
|
#else
|
||||||
typedef off_t wxFileOffset;
|
typedef off_t wxFileOffset;
|
||||||
|
typedef unsigned off_t wxFileSize_t;
|
||||||
#define wxFileOffsetFmtSpec _("")
|
#define wxFileOffsetFmtSpec _("")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -319,6 +322,7 @@ enum wxSeekMode
|
|||||||
#undef wxHAS_HUGE_FILES
|
#undef wxHAS_HUGE_FILES
|
||||||
#else // Unix platforms using configure
|
#else // Unix platforms using configure
|
||||||
typedef off_t wxFileOffset;
|
typedef off_t wxFileOffset;
|
||||||
|
typedef unsigned off_t wxFileSize_t;
|
||||||
#ifdef _LARGE_FILES
|
#ifdef _LARGE_FILES
|
||||||
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
|
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
|
||||||
#else
|
#else
|
||||||
@@ -360,9 +364,9 @@ enum wxSeekMode
|
|||||||
// VisualAge C++ V4.0 cannot have any external linkage const decs
|
// VisualAge C++ V4.0 cannot have any external linkage const decs
|
||||||
// in headers included by more than one primary source
|
// in headers included by more than one primary source
|
||||||
//
|
//
|
||||||
extern const wxFileOffset wxInvalidOffset;
|
extern const wxFileSize_t wxInvalidOffset;
|
||||||
#else
|
#else
|
||||||
const wxFileOffset wxInvalidOffset = (wxFileOffset)-1;
|
const wxFileSize_t wxInvalidOffset = (wxFileSize_t)-1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -298,22 +298,22 @@ bool wxFile::Close()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// read
|
// read
|
||||||
size_t wxFile::Read(void *pBuf, size_t nCount)
|
wxFileSize_t wxFile::Read(void *pBuf, wxFileSize_t nCount)
|
||||||
{
|
{
|
||||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||||
|
|
||||||
int iRc = wxRead(m_fd, pBuf, nCount);
|
wxFileOffset iRc = wxRead(m_fd, pBuf, nCount);
|
||||||
|
|
||||||
if ( iRc == -1 ) {
|
if ( iRc == -1 ) {
|
||||||
wxLogSysError(_("can't read from file descriptor %d"), m_fd);
|
wxLogSysError(_("can't read from file descriptor %d"), m_fd);
|
||||||
return (size_t)wxInvalidOffset;
|
return wxInvalidOffset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return (size_t)iRc;
|
return (wxFileSize_t)iRc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write
|
// write
|
||||||
size_t wxFile::Write(const void *pBuf, size_t nCount)
|
wxFileSize_t wxFile::Write(const void *pBuf, wxFileSize_t nCount)
|
||||||
{
|
{
|
||||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ size_t wxFile::Write(const void *pBuf, size_t nCount)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return iRc;
|
return (wxFileSize_t)iRc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// flush
|
// flush
|
||||||
|
@@ -104,7 +104,7 @@ static wxChar wxFileFunctionsBuffer[4*_MAXPATHLEN];
|
|||||||
// VisualAge C++ V4.0 cannot have any external linkage const decs
|
// VisualAge C++ V4.0 cannot have any external linkage const decs
|
||||||
// in headers included by more than one primary source
|
// in headers included by more than one primary source
|
||||||
//
|
//
|
||||||
const off_t wxInvalidOffset = (off_t)-1;
|
const wxFileSize_t wxInvalidOffset = (wxFileSize_t)-1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user