Esempio n. 1
0
static void Move_AutoGrownMemIO_to_valvec(AutoGrownMemIO& io, Vec& v) {
	BOOST_STATIC_ASSERT(sizeof(typename Vec::value_type) == 1);
	BOOST_STATIC_ASSERT(sizeof(v[0]) == 1);
	v.clear();
	v.risk_set_size(io.tell());
	v.risk_set_data((typename Vec::value_type*)io.buf());
	v.risk_set_capacity(io.size());
	io.risk_release_ownership();
}
Esempio n. 2
0
int AutoGrownMemIO_FILE_seek(void* cookie, off64_t* offset, int whence)
#endif
{
	AutoGrownMemIO* output = (AutoGrownMemIO*)cookie;
	try {
		output->seek(*offset, whence);
		*offset = output->tell();
		return 0;
	}
	catch (const std::exception& e) {
		errno = EINVAL;
		return -1;
	}
}
Esempio n. 3
0
ssize_t
AutoGrownMemIO_FILE_write(void *cookie, const char *buf, size_t size)
{
	AutoGrownMemIO* output = (AutoGrownMemIO*)cookie;
	return output->write(buf, size);
}
Esempio n. 4
0
void AutoGrownMemIO::clone(const AutoGrownMemIO& src)
{
	AutoGrownMemIO t(src.size());
	memcpy(t.begin(), src.begin(), src.size());
	this->swap(t);
}