// Not all of the Win32 compilers do have huge file support, for example
// the Digitalmars compiler does not have huge file size support
+ #include "wx/msw/private.h"
+
#undef __HUGEFILES_SUPPORTED
#if _INTEGRAL_MAX_BITS >= 64 && !defined(__DMC__)
#define __HUGEFILES_SUPPORTED 1
typedef wxLongLong_t wxFileOffset;
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
#else
- typedef int wxFileOffset;
+ typedef off_t wxFileOffset;
#define wxFileOffsetFmtSpec _("")
#endif
wxStreamBuffer *m_i_streambuf;
size_t OnSysRead(void *buffer, size_t nbytes);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
private:
size_t m_length;
protected:
size_t OnSysWrite(const void *buffer, size_t nbytes);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
DECLARE_NO_COPY_CLASS(wxMemoryOutputStream)
};
wxSocketOutputStream(wxSocketBase& s);
~wxSocketOutputStream();
- off_t SeekO( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
+ wxFileOffset SeekO( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
{ return -1; }
- off_t TellO() const
+ wxFileOffset TellO() const
{ return -1; }
protected:
wxSocketInputStream(wxSocketBase& s);
~wxSocketInputStream();
- off_t SeekI( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
+ wxFileOffset SeekI( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
{ return -1; }
- off_t TellI() const
+ wxFileOffset TellI() const
{ return -1; }
protected:
virtual size_t GetSize() const { return m_str.length(); }
protected:
- virtual off_t OnSysSeek(off_t ofs, wxSeekMode mode);
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
virtual size_t OnSysRead(void *buffer, size_t size);
private:
const wxString& GetString() const { return *m_str; }
protected:
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysTell() const;
virtual size_t OnSysWrite(const void *buffer, size_t size);
private:
#endif // WXWIN_COMPATIBILITY_2_2
protected:
- virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
size_t m_lastcount;
wxStreamError m_lasterror;
// it)
//
// returns wxInvalidOffset on error
- virtual off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
+ virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
// return the current position of the stream pointer or wxInvalidOffset
- virtual off_t TellI() const;
+ virtual wxFileOffset TellI() const;
// stream-like operators
virtual wxOutputStream& Write(const void *buffer, size_t size);
wxOutputStream& Write(wxInputStream& stream_in);
- virtual off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
- virtual off_t TellO() const;
+ virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ virtual wxFileOffset TellO() const;
virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; }
protected:
virtual size_t OnSysWrite(const void *buffer, size_t size);
- virtual off_t OnSysSeek(off_t pos, wxSeekMode mode);
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
size_t m_currentPos;
virtual char Peek();
virtual char GetChar();
virtual void PutChar(char c);
- virtual off_t Tell() const;
- virtual off_t Seek(off_t pos, wxSeekMode mode);
+ virtual wxFileOffset Tell() const;
+ virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode);
// Buffer control
void ResetBuffer();
wxInputStream& Read(void *buffer, size_t size);
// Position functions
- off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
- off_t TellI() const;
+ wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ wxFileOffset TellI() const;
// the buffer given to the stream will be deleted by it
void SetInputStreamBuffer(wxStreamBuffer *buffer);
protected:
virtual size_t OnSysRead(void *buffer, size_t bufsize);
- virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
wxStreamBuffer *m_i_streambuf;
wxOutputStream& Write(const void *buffer, size_t size);
// Position functions
- off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
- off_t TellO() const;
+ wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+ wxFileOffset TellO() const;
void Sync();
protected:
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
- virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
- virtual off_t OnSysTell() const;
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const;
wxStreamBuffer *m_o_streambuf;
wxFileInputStream();
size_t OnSysRead(void *buffer, size_t size);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
protected:
wxFile *m_file;
wxFileOutputStream();
size_t OnSysWrite(const void *buffer, size_t size);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
protected:
wxFile *m_file;
wxFFileInputStream();
size_t OnSysRead(void *buffer, size_t size);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
protected:
wxFFile *m_file;
wxFFileOutputStream();
size_t OnSysWrite(const void *buffer, size_t size);
- off_t OnSysSeek(off_t pos, wxSeekMode mode);
- off_t OnSysTell() const;
+ wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
+ wxFileOffset OnSysTell() const;
protected:
wxFFile *m_file;
protected:
virtual size_t OnSysRead(void *buffer, size_t bufsize);
- virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
- virtual off_t OnSysTell() const {return m_Pos;}
+ virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
+ virtual wxFileOffset OnSysTell() const {return m_Pos;}
private:
size_t m_Size;
- off_t m_Pos;
+ wxFileOffset m_Pos;
// this void* is handle of archive . I'm sorry it is void and not proper
// type but I don't want to make unzip.h header public.
protected:
size_t OnSysRead(void *buffer, size_t size);
- off_t OnSysTell() const { return m_pos; }
+ wxFileOffset OnSysTell() const { return m_pos; }
protected:
size_t m_z_size;
unsigned char *m_z_buffer;
struct z_stream_s *m_inflate;
- off_t m_pos;
+ wxFileOffset m_pos;
#if WXWIN_COMPATIBILITY_2_4
bool m_24compatibilty;
#endif
protected:
size_t OnSysWrite(const void *buffer, size_t size);
- off_t OnSysTell() const { return m_pos; }
+ wxFileOffset OnSysTell() const { return m_pos; }
virtual void DoFlush(bool final);
size_t m_z_size;
unsigned char *m_z_buffer;
struct z_stream_s *m_deflate;
- off_t m_pos;
+ wxFileOffset m_pos;
DECLARE_NO_COPY_CLASS(wxZlibOutputStream)
};
return m_i_streambuf->GetIntPosition() - pos;
}
-off_t wxMemoryInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxMemoryInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_i_streambuf->Seek(pos, mode);
}
-off_t wxMemoryInputStream::OnSysTell() const
+wxFileOffset wxMemoryInputStream::OnSysTell() const
{
return m_i_streambuf->Tell();
}
return newpos - oldpos;
}
-off_t wxMemoryOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxMemoryOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_o_streambuf->Seek(pos, mode);
}
-off_t wxMemoryOutputStream::OnSysTell() const
+wxFileOffset wxMemoryOutputStream::OnSysTell() const
{
return m_o_streambuf->Tell();
}
// seek/tell
// ----------------------------------------------------------------------------
-off_t wxStringInputStream::OnSysSeek(off_t ofs, wxSeekMode mode)
+wxFileOffset wxStringInputStream::OnSysSeek(wxFileOffset ofs, wxSeekMode mode)
{
const size_t ofsMax = m_str.length()*sizeof(wxChar);
return ofs;
}
-off_t wxStringInputStream::OnSysTell() const
+wxFileOffset wxStringInputStream::OnSysTell() const
{
- return wx_static_cast(off_t, m_pos);
+ return wx_static_cast(wxFileOffset, m_pos);
}
// ----------------------------------------------------------------------------
// seek/tell
// ----------------------------------------------------------------------------
-off_t wxStringOutputStream::OnSysTell() const
+wxFileOffset wxStringOutputStream::OnSysTell() const
{
- return wx_static_cast(off_t, m_pos);
+ return wx_static_cast(wxFileOffset, m_pos);
}
// ----------------------------------------------------------------------------
return total;
}
-off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
+wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
{
- off_t ret_off, diff;
+ wxFileOffset ret_off, diff;
- off_t last_access = GetLastAccess();
+ wxFileOffset last_access = GetLastAccess();
if ( !m_flushable )
{
return wxInvalidOffset;
}
-off_t wxStreamBuffer::Tell() const
+wxFileOffset wxStreamBuffer::Tell() const
{
- off_t pos;
+ wxFileOffset pos;
// ask the stream for position if we have a real one
if ( m_stream )
{
}
-off_t wxStreamBase::OnSysSeek(off_t WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
+wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
{
return wxInvalidOffset;
}
-off_t wxStreamBase::OnSysTell() const
+wxFileOffset wxStreamBase::OnSysTell() const
{
return wxInvalidOffset;
}
return *this;
}
-off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
+wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode)
{
// RR: This code is duplicated in wxBufferedInputStream. This is
// not really a good design, but buffered stream are different
return OnSysSeek(pos, mode);
}
-off_t wxInputStream::TellI() const
+wxFileOffset wxInputStream::TellI() const
{
- off_t pos = OnSysTell();
+ wxFileOffset pos = OnSysTell();
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
return *this;
}
-off_t wxOutputStream::TellO() const
+wxFileOffset wxOutputStream::TellO() const
{
return OnSysTell();
}
-off_t wxOutputStream::SeekO(off_t pos, wxSeekMode mode)
+wxFileOffset wxOutputStream::SeekO(wxFileOffset pos, wxSeekMode mode)
{
return OnSysSeek(pos, mode);
}
return m_currentPos;
}
-off_t wxCountingOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
switch ( mode )
{
return m_currentPos;
}
-off_t wxCountingOutputStream::OnSysTell() const
+wxFileOffset wxCountingOutputStream::OnSysTell() const
{
return m_currentPos;
}
wxBufferedInputStream::~wxBufferedInputStream()
{
- m_parent_i_stream->SeekI(-(off_t)m_i_streambuf->GetBytesLeft(),
+ m_parent_i_stream->SeekI(-(wxFileOffset)m_i_streambuf->GetBytesLeft(),
wxFromCurrent);
delete m_i_streambuf;
return *this;
}
-off_t wxBufferedInputStream::SeekI(off_t pos, wxSeekMode mode)
+wxFileOffset wxBufferedInputStream::SeekI(wxFileOffset pos, wxSeekMode mode)
{
// RR: Look at wxInputStream for comments.
return m_i_streambuf->Seek(pos, mode);
}
-off_t wxBufferedInputStream::TellI() const
+wxFileOffset wxBufferedInputStream::TellI() const
{
- off_t pos = m_i_streambuf->Tell();
+ wxFileOffset pos = m_i_streambuf->Tell();
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
return m_parent_i_stream->Read(buffer, bufsize).LastRead();
}
-off_t wxBufferedInputStream::OnSysSeek(off_t seek, wxSeekMode mode)
+wxFileOffset wxBufferedInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
{
return m_parent_i_stream->SeekI(seek, mode);
}
-off_t wxBufferedInputStream::OnSysTell() const
+wxFileOffset wxBufferedInputStream::OnSysTell() const
{
return m_parent_i_stream->TellI();
}
return *this;
}
-off_t wxBufferedOutputStream::SeekO(off_t pos, wxSeekMode mode)
+wxFileOffset wxBufferedOutputStream::SeekO(wxFileOffset pos, wxSeekMode mode)
{
Sync();
return m_o_streambuf->Seek(pos, mode);
}
-off_t wxBufferedOutputStream::TellO() const
+wxFileOffset wxBufferedOutputStream::TellO() const
{
return m_o_streambuf->Tell();
}
return m_parent_o_stream->Write(buffer, bufsize).LastWrite();
}
-off_t wxBufferedOutputStream::OnSysSeek(off_t seek, wxSeekMode mode)
+wxFileOffset wxBufferedOutputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
{
return m_parent_o_stream->SeekO(seek, mode);
}
-off_t wxBufferedOutputStream::OnSysTell() const
+wxFileOffset wxBufferedOutputStream::OnSysTell() const
{
return m_parent_o_stream->TellO();
}
size_t wxFileInputStream::OnSysRead(void *buffer, size_t size)
{
- off_t ret = m_file->Read(buffer, size);
+ wxFileOffset 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)
return ret;
}
-off_t wxFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxFileInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_file->Seek(pos, mode);
}
-off_t wxFileInputStream::OnSysTell() const
+wxFileOffset wxFileInputStream::OnSysTell() const
{
return m_file->Tell();
}
return ret;
}
-off_t wxFileOutputStream::OnSysTell() const
+wxFileOffset wxFileOutputStream::OnSysTell() const
{
return m_file->Tell();
}
-off_t wxFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxFileOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_file->Seek(pos, mode);
}
size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size)
{
- off_t ret;
+ wxFileOffset ret;
ret = m_file->Read(buffer, size);
return ret;
}
-off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxFFileInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
#ifdef __VMS
#pragma message disable intsignchange
#endif
}
-off_t wxFFileInputStream::OnSysTell() const
+wxFileOffset wxFFileInputStream::OnSysTell() const
{
return m_file->Tell();
}
return ret;
}
-off_t wxFFileOutputStream::OnSysTell() const
+wxFileOffset wxFFileOutputStream::OnSysTell() const
{
return m_file->Tell();
}
-off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+wxFileOffset wxFFileOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
#ifdef __VMS
#pragma message disable intsignchange
bool wxZipInputStream::Eof() const
{
- wxASSERT_MSG( m_Pos <= (off_t)m_Size,
+ wxASSERT_MSG( m_Pos <= (wxFileOffset)m_Size,
_T("wxZipInputStream: invalid current position") );
- return m_Pos >= (off_t)m_Size;
+ return m_Pos >= (wxFileOffset)m_Size;
}
size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
{
- wxASSERT_MSG( m_Pos <= (off_t)m_Size,
+ wxASSERT_MSG( m_Pos <= (wxFileOffset)m_Size,
_T("wxZipInputStream: invalid current position") );
- if ( m_Pos >= (off_t)m_Size )
+ if ( m_Pos >= (wxFileOffset)m_Size )
{
m_lasterror = wxSTREAM_EOF;
return 0;
-off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode)
+wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
{
// NB: since ZIP files don't natively support seeking, we have to
// implement a brute force workaround -- reading all the data
// between current and the new position (or between beginning of
// the file and new position...)
- off_t nextpos;
+ wxFileOffset nextpos;
switch ( mode )
{