+ count = m_stream->OnSysRead(m_buffer_start, m_buffer_size);
+ m_buffer_end = m_buffer_start+count;
+ m_buffer_pos = m_buffer_start;
+
+ if (count == 0)
+ return FALSE;
+ return TRUE;
+}
+
+bool wxStreamBuffer::FlushBuffer()
+{
+ size_t count, current;
+
+ if (m_buffer_pos == m_buffer_start || !m_flushable)
+ return FALSE;
+
+ current = m_buffer_pos-m_buffer_start;
+ count = m_stream->OnSysWrite(m_buffer_start, current);
+ if (count != current)
+ return FALSE;
+ m_buffer_pos = m_buffer_start;
+
+ return TRUE;
+}
+
+void wxStreamBuffer::GetFromBuffer(void *buffer, size_t size)
+{
+ size_t s_toget = m_buffer_end-m_buffer_pos;
+
+ if (size < s_toget)
+ s_toget = size;
+
+ memcpy(buffer, m_buffer_pos, s_toget);
+ m_buffer_pos += s_toget;
+}
+
+void wxStreamBuffer::PutToBuffer(const void *buffer, size_t size)
+{
+ size_t s_toput = m_buffer_end-m_buffer_pos;
+
+ if (s_toput < size && !m_fixed) {
+ m_buffer_start = (char *)realloc(m_buffer_start, m_buffer_size+size);
+ // I round a bit
+ m_buffer_size += size;
+ m_buffer_end = m_buffer_start+m_buffer_size;
+ s_toput = size;
+ }
+ if (s_toput > size)
+ s_toput = size;
+ memcpy(m_buffer_pos, buffer, s_toput);
+ m_buffer_pos += s_toput;
+}
+
+void wxStreamBuffer::PutChar(char c)
+{
+ wxASSERT(m_stream != NULL);