From becaa2a43d4732a03edf70e950bda011c456e96f Mon Sep 17 00:00:00 2001 From: "snappy.mirrorbot@gmail.com" Date: Fri, 18 Mar 2011 17:14:15 +0000 Subject: Revision created by MOE tool push_codebase. MOE_MIGRATION= git-svn-id: http://snappy.googlecode.com/svn/trunk@2 03e5f5b5-db94-4691-08a0-1a8bf15f6143 --- snappy-sinksource.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 snappy-sinksource.cc (limited to 'snappy-sinksource.cc') diff --git a/snappy-sinksource.cc b/snappy-sinksource.cc new file mode 100644 index 0000000..7d7ef36 --- /dev/null +++ b/snappy-sinksource.cc @@ -0,0 +1,46 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +#include + +#include "snappy-sinksource.h" + +namespace snappy { + +Source::~Source() { } + +Sink::~Sink() { } + +char* Sink::GetAppendBuffer(size_t length, char* scratch) { + return scratch; +} + +ByteArraySource::~ByteArraySource() { } + +size_t ByteArraySource::Available() const { return left_; } + +const char* ByteArraySource::Peek(size_t* len) { + *len = left_; + return ptr_; +} + +void ByteArraySource::Skip(size_t n) { + left_ -= n; + ptr_ += n; +} + +UncheckedByteArraySink::~UncheckedByteArraySink() { } + +void UncheckedByteArraySink::Append(const char* data, size_t n) { + // Do no copying if the caller filled in the result of GetAppendBuffer() + if (data != dest_) { + memcpy(dest_, data, n); + } + dest_ += n; +} + +char* UncheckedByteArraySink::GetAppendBuffer(size_t len, char* scratch) { + return dest_; +} + + +} -- cgit v1.2.1