From bfab72e50fe8b94bd3a7dbcf63114002008575ea Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 7 Apr 2014 08:20:09 +0200 Subject: very simple non-working implementation of streambufs for hhvm --- zend/streambuf.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'zend/streambuf.cpp') diff --git a/zend/streambuf.cpp b/zend/streambuf.cpp index e258b4e..86e5f03 100644 --- a/zend/streambuf.cpp +++ b/zend/streambuf.cpp @@ -15,44 +15,6 @@ */ namespace Php { -/** - * Constructor - * @param error - */ -StreamBuf::StreamBuf(int error) : _error(error) -{ - // we reserve one byte, so that when overflow is called, we still have one - // byte extra in the buffer to put the overflowed byte int - setp(_buffer, _buffer+1024-1); -} - - -/** - * Method that is called when the internal buffer overflows - * @param c - * @return int - */ -int StreamBuf::overflow(int c) -{ - // for error buffers, overflow is simply discarded - if (_error) return c; - - // end-of-file has not output, we call EOF directly, and by using the - // comma operator we ensure that EOF is returned - if (c == EOF) return sync(), EOF; - - // because we lied the underlying buffer about the size of the buffer - // by one byte, there is no real overflow, and we can still add the byte - // to the end of the buffer - *pptr() = c; - - // increment buffer size - pbump(1); - - // and now we're going to syn the buffer - return sync() == -1 ? EOF : c; -} - /** * Called when the internal buffer should be synchronized * @return int -- cgit v1.2.3