R=csilvers DELTA=24 (24 added, 0 deleted, 0 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=986 git-svn-id: https://snappy.googlecode.com/svn/trunk@4 03e5f5b5-db94-4691-08a0-1a8bf15f6143
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
// Copyright 2011 Google Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include <string.h>
|
|
|
|
#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_;
|
|
}
|
|
|
|
|
|
}
|