void ThriftBuffer::write(CStrRef data) { int32 len = data.size(); write(len); if (m_p + len > m_pEnd) { flush(); } if (len > m_size) { flushImpl(data); } else { memcpy(m_p, data.data(), len); if ((m_p += len) > m_pSafe) flush(); } }
bool UserFile::close() { // fclose() should prevent this from being called on a closed stream assert(!m_closed); // PHP's streams layer explicitly flushes on close // Mimick that for user-wrappers by pushing the flush here // without impacting other HPHP stream types. bool ret = flushImpl(false) || !RuntimeOption::CheckFlushOnUserClose; // void stream_close() invoke(m_StreamClose, s_stream_close, Array::Create()); m_closed = true; return ret; }
void ThriftBuffer::flush() { *m_p = '\0'; String data(m_buf, m_p - m_buf, AttachLiteral); m_p = m_buf; flushImpl(data); }
void ThriftBuffer::flush() { *m_p = '\0'; String data(m_buf, m_p - m_buf, CopyString); m_p = m_buf; flushImpl(data); }
bool UserFile::flush() { return flushImpl(true); }