예제 #1
0
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();
  }
}
예제 #2
0
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;
}
예제 #3
0
void ThriftBuffer::flush() {
  *m_p = '\0';
  String data(m_buf, m_p - m_buf, AttachLiteral);
  m_p = m_buf;
  flushImpl(data);
}
예제 #4
0
void ThriftBuffer::flush() {
  *m_p = '\0';
  String data(m_buf, m_p - m_buf, CopyString);
  m_p = m_buf;
  flushImpl(data);
}
예제 #5
0
bool UserFile::flush() {
  return flushImpl(true);
}