use wxFileSize_t instead of wxFileOffset or off_t

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-10-15 00:34:21 +00:00
parent bd3cea7d2c
commit 67c20e133e
7 changed files with 16 additions and 18 deletions

View File

@@ -843,15 +843,15 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
wxUint16 aWord; wxUint16 aWord;
wxInt32 dbuf[4]; wxInt32 dbuf[4];
wxInt8 bbuf[4]; wxInt8 bbuf[4];
off_t offset;
offset = 0; // keep gcc quiet wxFileSize_t offset = 0; // keep gcc quiet
if ( IsBmp ) if ( IsBmp )
{ {
// read the header off the .BMP format file // read the header off the .BMP format file
offset = stream.TellI(); offset = stream.TellI();
if (offset == wxInvalidOffset) offset = 0; if (offset == wxInvalidOffset)
offset = 0;
stream.Read(bbuf, 2); stream.Read(bbuf, 2);
stream.Read(dbuf, 16); stream.Read(dbuf, 16);

View File

@@ -1485,7 +1485,7 @@ bool wxImageHandler::CanRead( const wxString& name )
bool wxImageHandler::CallDoCanRead(wxInputStream& stream) bool wxImageHandler::CallDoCanRead(wxInputStream& stream)
{ {
off_t posOld = stream.TellI(); wxFileSize_t posOld = stream.TellI();
if ( posOld == wxInvalidOffset ) if ( posOld == wxInvalidOffset )
{ {
// can't test unseekable stream // can't test unseekable stream

View File

@@ -1120,19 +1120,19 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
return false; return false;
// get the file size // get the file size
wxFileOffset nSize = fileMsg.Length(); wxFileSize_t nSize = fileMsg.Length();
if ( nSize == wxInvalidOffset ) if ( nSize == wxInvalidOffset )
return false; return false;
// read the whole file in memory // read the whole file in memory
m_pData = new size_t8[nSize]; m_pData = new size_t8[nSize];
if ( fileMsg.Read(m_pData, (size_t)nSize) != (size_t)nSize ) { if ( fileMsg.Read(m_pData, nSize) != nSize ) {
wxDELETEA(m_pData); wxDELETEA(m_pData);
return false; return false;
} }
// examine header // examine header
bool bValid = (size_t)nSize > sizeof(wxMsgCatalogHeader); bool bValid = nSize > sizeof(wxMsgCatalogHeader);
wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData; wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData;
if ( bValid ) { if ( bValid ) {
@@ -1157,7 +1157,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
Swap(pHeader->ofsOrigTable)); Swap(pHeader->ofsOrigTable));
m_pTransTable = (wxMsgTableEntry *)(m_pData + m_pTransTable = (wxMsgTableEntry *)(m_pData +
Swap(pHeader->ofsTransTable)); Swap(pHeader->ofsTransTable));
m_nSize = (size_t)nSize; m_nSize = nSize;
// now parse catalog's header and try to extract catalog charset and // now parse catalog's header and try to extract catalog charset and
// plural forms formula from it: // plural forms formula from it:

View File

@@ -621,7 +621,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
wxFileOffset wxStreamBuffer::Tell() const wxFileOffset wxStreamBuffer::Tell() const
{ {
wxFileOffset pos; wxFileSize_t pos;
// ask the stream for position if we have a real one // ask the stream for position if we have a real one
if ( m_stream ) if ( m_stream )
@@ -889,7 +889,7 @@ wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode)
wxFileOffset wxInputStream::TellI() const wxFileOffset wxInputStream::TellI() const
{ {
wxFileOffset pos = OnSysTell(); wxFileSize_t pos = OnSysTell();
if (pos != wxInvalidOffset) if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur); pos -= (m_wbacksize - m_wbackcur);
@@ -1122,7 +1122,7 @@ wxFileOffset wxBufferedInputStream::SeekI(wxFileOffset pos, wxSeekMode mode)
wxFileOffset wxBufferedInputStream::TellI() const wxFileOffset wxBufferedInputStream::TellI() const
{ {
wxFileOffset pos = m_i_streambuf->Tell(); wxFileSize_t pos = m_i_streambuf->Tell();
if (pos != wxInvalidOffset) if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur); pos -= (m_wbacksize - m_wbackcur);

View File

@@ -97,7 +97,7 @@ bool wxTextFile::OnRead(wxMBConv& conv)
char *strBuf, *strPtr, *strEnd; char *strBuf, *strPtr, *strEnd;
char ch, chLast = '\0'; char ch, chLast = '\0';
char buf[1024]; char buf[1024];
int n, nRead; wxFileSize_t nRead;
strPtr = strBuf = new char[1024]; strPtr = strBuf = new char[1024];
strEnd = strBuf + 1024; strEnd = strBuf + 1024;
@@ -112,7 +112,7 @@ bool wxTextFile::OnRead(wxMBConv& conv)
return false; return false;
} }
for (n = 0; n < nRead; n++) for (wxFileSize_t n = 0; n < nRead; n++)
{ {
ch = buf[n]; ch = buf[n];
switch ( ch ) switch ( ch )

View File

@@ -69,7 +69,7 @@ size_t wxFileInputStream::GetSize() const
size_t wxFileInputStream::OnSysRead(void *buffer, size_t size) size_t wxFileInputStream::OnSysRead(void *buffer, size_t size)
{ {
wxFileOffset ret = m_file->Read(buffer, size); wxFileSize_t ret = m_file->Read(buffer, size);
// NB: we can't use a switch here because HP-UX CC doesn't allow // NB: we can't use a switch here because HP-UX CC doesn't allow
// switching over long long (which off_t is in 64bit mode) // switching over long long (which off_t is in 64bit mode)
@@ -234,9 +234,7 @@ size_t wxFFileInputStream::GetSize() const
size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size) size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size)
{ {
wxFileOffset ret; wxFileSize_t ret = m_file->Read(buffer, size);
ret = m_file->Read(buffer, size);
if (m_file->Eof()) if (m_file->Eof())
m_lasterror = wxSTREAM_EOF; m_lasterror = wxSTREAM_EOF;

View File

@@ -277,7 +277,7 @@ bool wxSingleInstanceCheckerImpl::Create(const wxString& name)
} }
char buf[256]; char buf[256];
off_t count = file.Read(buf, WXSIZEOF(buf)); wxFileSize_t count = file.Read(buf, WXSIZEOF(buf));
if ( count == wxInvalidOffset ) if ( count == wxInvalidOffset )
{ {
wxLogError(_("Failed to read PID from lock file.")); wxLogError(_("Failed to read PID from lock file."));