31 #include "snappy-sinksource.h" 39 char* Sink::GetAppendBuffer(
size_t length,
char* scratch) {
43 char* Sink::GetAppendBufferVariable(
44 size_t min_size,
size_t desired_size_hint,
char* scratch,
45 size_t scratch_size,
size_t* allocated_size) {
46 *allocated_size = scratch_size;
50 void Sink::AppendAndTakeOwnership(
51 char* bytes,
size_t n,
52 void (*deleter)(
void*,
const char*,
size_t),
55 (*deleter)(deleter_arg, bytes, n);
58 ByteArraySource::~ByteArraySource() { }
60 size_t ByteArraySource::Available()
const {
return left_; }
62 const char* ByteArraySource::Peek(
size_t* len) {
67 void ByteArraySource::Skip(
size_t n) {
72 UncheckedByteArraySink::~UncheckedByteArraySink() { }
74 void UncheckedByteArraySink::Append(
const char* data,
size_t n) {
77 memcpy(dest_, data, n);
82 char* UncheckedByteArraySink::GetAppendBuffer(
size_t len,
char* scratch) {
86 void UncheckedByteArraySink::AppendAndTakeOwnership(
88 void (*deleter)(
void*,
const char*,
size_t),
91 memcpy(dest_, data, n);
92 (*deleter)(deleter_arg, data, n);
97 char* UncheckedByteArraySink::GetAppendBufferVariable(
98 size_t min_size,
size_t desired_size_hint,
char* scratch,
99 size_t scratch_size,
size_t* allocated_size) {
100 *allocated_size = desired_size_hint;