From 67c20e133ebe01b5b4bc2468661a8bcc4097c5a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 15 Oct 2004 00:34:21 +0000 Subject: [PATCH] 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 --- src/common/imagbmp.cpp | 6 +++--- src/common/image.cpp | 2 +- src/common/intl.cpp | 8 ++++---- src/common/stream.cpp | 6 +++--- src/common/textfile.cpp | 4 ++-- src/common/wfstream.cpp | 6 ++---- src/unix/snglinst.cpp | 2 +- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index e3e9cb67ad..e009bad103 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -843,15 +843,15 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, wxUint16 aWord; wxInt32 dbuf[4]; wxInt8 bbuf[4]; - off_t offset; - offset = 0; // keep gcc quiet + wxFileSize_t offset = 0; // keep gcc quiet if ( IsBmp ) { // read the header off the .BMP format file offset = stream.TellI(); - if (offset == wxInvalidOffset) offset = 0; + if (offset == wxInvalidOffset) + offset = 0; stream.Read(bbuf, 2); stream.Read(dbuf, 16); diff --git a/src/common/image.cpp b/src/common/image.cpp index d5ea5590e7..73dde3ecaf 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1485,7 +1485,7 @@ bool wxImageHandler::CanRead( const wxString& name ) bool wxImageHandler::CallDoCanRead(wxInputStream& stream) { - off_t posOld = stream.TellI(); + wxFileSize_t posOld = stream.TellI(); if ( posOld == wxInvalidOffset ) { // can't test unseekable stream diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 2edc031e31..c4e098da1a 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1120,19 +1120,19 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0, return false; // get the file size - wxFileOffset nSize = fileMsg.Length(); + wxFileSize_t nSize = fileMsg.Length(); if ( nSize == wxInvalidOffset ) return false; // read the whole file in memory 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); return false; } // examine header - bool bValid = (size_t)nSize > sizeof(wxMsgCatalogHeader); + bool bValid = nSize > sizeof(wxMsgCatalogHeader); wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData; if ( bValid ) { @@ -1157,7 +1157,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0, Swap(pHeader->ofsOrigTable)); m_pTransTable = (wxMsgTableEntry *)(m_pData + Swap(pHeader->ofsTransTable)); - m_nSize = (size_t)nSize; + m_nSize = nSize; // now parse catalog's header and try to extract catalog charset and // plural forms formula from it: diff --git a/src/common/stream.cpp b/src/common/stream.cpp index f1d432eb69..b9ccfcd2c3 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -621,7 +621,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode) wxFileOffset wxStreamBuffer::Tell() const { - wxFileOffset pos; + wxFileSize_t pos; // ask the stream for position if we have a real one if ( m_stream ) @@ -889,7 +889,7 @@ wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) wxFileOffset wxInputStream::TellI() const { - wxFileOffset pos = OnSysTell(); + wxFileSize_t pos = OnSysTell(); if (pos != wxInvalidOffset) pos -= (m_wbacksize - m_wbackcur); @@ -1122,7 +1122,7 @@ wxFileOffset wxBufferedInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) wxFileOffset wxBufferedInputStream::TellI() const { - wxFileOffset pos = m_i_streambuf->Tell(); + wxFileSize_t pos = m_i_streambuf->Tell(); if (pos != wxInvalidOffset) pos -= (m_wbacksize - m_wbackcur); diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index 951f54e88d..604bb54c4c 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -97,7 +97,7 @@ bool wxTextFile::OnRead(wxMBConv& conv) char *strBuf, *strPtr, *strEnd; char ch, chLast = '\0'; char buf[1024]; - int n, nRead; + wxFileSize_t nRead; strPtr = strBuf = new char[1024]; strEnd = strBuf + 1024; @@ -112,7 +112,7 @@ bool wxTextFile::OnRead(wxMBConv& conv) return false; } - for (n = 0; n < nRead; n++) + for (wxFileSize_t n = 0; n < nRead; n++) { ch = buf[n]; switch ( ch ) diff --git a/src/common/wfstream.cpp b/src/common/wfstream.cpp index 904a89809f..970f92c296 100644 --- a/src/common/wfstream.cpp +++ b/src/common/wfstream.cpp @@ -69,7 +69,7 @@ size_t wxFileInputStream::GetSize() const 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 // 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) { - wxFileOffset ret; - - ret = m_file->Read(buffer, size); + wxFileSize_t ret = m_file->Read(buffer, size); if (m_file->Eof()) m_lasterror = wxSTREAM_EOF; diff --git a/src/unix/snglinst.cpp b/src/unix/snglinst.cpp index 66d616c32a..d581d39f83 100644 --- a/src/unix/snglinst.cpp +++ b/src/unix/snglinst.cpp @@ -277,7 +277,7 @@ bool wxSingleInstanceCheckerImpl::Create(const wxString& name) } char buf[256]; - off_t count = file.Read(buf, WXSIZEOF(buf)); + wxFileSize_t count = file.Read(buf, WXSIZEOF(buf)); if ( count == wxInvalidOffset ) { wxLogError(_("Failed to read PID from lock file.")); -- 2.45.2