コード例 #1
0
ファイル: o_string_buffer.c プロジェクト: AVGP/orientdb-c
void o_string_buffer_append(struct o_string_buffer * buff, char * to_append)
{
	int size = strlen(to_append);
	if (buff->cursor + size >= buff->size)
	{
		buff->size = buff->size * 2;
		buff->buffer = o_realloc(buff->buffer, buff->size);
	}
	memcpy(buff->buffer + buff->cursor, to_append, size);
	buff->cursor += size;
}
コード例 #2
0
void o_output_stream_byte_write_bytes(struct o_output_stream * stream, void *bytes, int nbytes)
{
	struct o_output_stream_byte *buff = (struct o_output_stream_byte *) stream;
	if (buff->cursor + nbytes >= buff->size)
	{
		do
		{
			buff->size *= 2;
		} while (buff->cursor + nbytes >= buff->size);

		buff->content = o_realloc(buff->content, buff->size);
	}
	memcpy(buff->content + buff->cursor, bytes, nbytes);
	buff->cursor += nbytes;
}