+ char *temp_b;
+
+ m_wbacksize += needed_size;
+
+ if (!m_wback)
+ temp_b = (char *)malloc(m_wbacksize);
+ else
+ temp_b = (char *)realloc(m_wback, m_wbacksize);
+
+ if (!temp_b)
+ return NULL;
+ m_wback = temp_b;
+
+ return (char *)(m_wback+(m_wbacksize-needed_size));
+}
+
+size_t wxInputStream::GetWBack(char *buf, size_t bsize)
+{
+ size_t s_toget = m_wbacksize-m_wbackcur;
+
+ if (!m_wback)
+ return 0;
+
+ if (bsize < s_toget)
+ s_toget = bsize;
+
+ memcpy(buf, (m_wback+m_wbackcur), s_toget);
+
+ m_wbackcur += s_toget;
+ if (m_wbackcur == m_wbacksize) {
+ free(m_wback);
+ m_wback = (char *)NULL;
+ m_wbacksize = 0;
+ m_wbackcur = 0;
+ }
+
+ return s_toget;
+}
+
+size_t wxInputStream::Ungetch(void *buf, size_t bufsize)
+{
+ char *ptrback;
+
+ ptrback = AllocSpaceWBack(bufsize);
+ if (!ptrback)
+ return 0;
+
+ memcpy(ptrback, buf, bufsize);
+ return bufsize;
+}
+
+bool wxInputStream::Ungetch(char c)
+{
+ char *ptrback;
+
+ ptrback = AllocSpaceWBack(1);
+ if (!ptrback)
+ return FALSE;
+
+ *ptrback = c;
+ return TRUE;