inline void Foam::OPstream::writeToBuffer ( const void* data, size_t count, size_t align ) { label oldPos = bufPosition_; if (align > 1) { // Align bufPosition. Pads bufPosition_ - oldPos characters. bufPosition_ = align + ((bufPosition_ - 1) & ~(align - 1)); } if (size_t(buf_.size()) < bufPosition_ + count) { enlargeBuffer(bufPosition_ - oldPos + count); } register char* bufPtr = &buf_[bufPosition_]; register const char* dataPtr = reinterpret_cast<const char*>(data); register size_t i = count; while (i--) *bufPtr++ = *dataPtr++; bufPosition_ += count; }
inline void Foam::OPstream::writeToBuffer(const char& c) { if (size_t(buf_.size()) < bufPosition_ + 1U) { enlargeBuffer(1); } buf_[bufPosition_] = c; bufPosition_ ++; }
static size_t Write(StreamBuffer *b,void *data, size_t siz) { if (b == NULL) { iError.RaiseError("iStreamBuffer.Write",CONTAINER_ERROR_BADARG); return 0; } if ((b->Cursor + siz) >= b->Size) { int r = enlargeBuffer(b,b->Size+siz); if (r < 0) return 0; } memcpy(b->Data+b->Cursor,data,siz); b->Cursor += siz; return siz; }