clang-fixes

This commit is contained in:
Philipp Moritz
2016-11-19 14:27:08 -08:00
parent 9d6da1281e
commit 05e0226047
14 changed files with 239 additions and 243 deletions
+16 -17
View File
@@ -5,16 +5,18 @@
namespace numbuf {
class FixedBufferStream : public arrow::io::OutputStream, public arrow::io::ReadableFileInterface {
class FixedBufferStream : public arrow::io::OutputStream,
public arrow::io::ReadableFileInterface {
public:
virtual ~FixedBufferStream() {}
explicit FixedBufferStream(uint8_t* data, int64_t nbytes)
: data_(data), position_(0), size_(nbytes) {}
: data_(data), position_(0), size_(nbytes) {}
arrow::Status Read(int64_t nbytes, std::shared_ptr<arrow::Buffer>* out) override {
DCHECK(out);
DCHECK(position_ + nbytes <= size_) << "position: " << position_ << " nbytes: " << nbytes << "size: " << size_;
DCHECK(position_ + nbytes <= size_) << "position: " << position_
<< " nbytes: " << nbytes << "size: " << size_;
*out = std::make_shared<arrow::Buffer>(data_ + position_, nbytes);
position_ += nbytes;
return arrow::Status::OK();
@@ -30,9 +32,7 @@ class FixedBufferStream : public arrow::io::OutputStream, public arrow::io::Read
return arrow::Status::OK();
}
arrow::Status Close() override {
return arrow::Status::OK();
}
arrow::Status Close() override { return arrow::Status::OK(); }
arrow::Status Tell(int64_t* position) override {
*position = position_;
@@ -41,28 +41,27 @@ class FixedBufferStream : public arrow::io::OutputStream, public arrow::io::Read
arrow::Status Write(const uint8_t* data, int64_t nbytes) override {
DCHECK(position_ >= 0 && position_ < size_);
DCHECK(position_ + nbytes <= size_) << "position: " << position_ << " nbytes: " << nbytes << "size: " << size_;
DCHECK(position_ + nbytes <= size_) << "position: " << position_
<< " nbytes: " << nbytes << "size: " << size_;
uint8_t* dst = data_ + position_;
memcpy(dst, data, nbytes);
position_ += nbytes;
return arrow::Status::OK();
}
arrow::Status GetSize(int64_t *size) override {
arrow::Status GetSize(int64_t* size) override {
*size = size_;
return arrow::Status::OK();
}
bool supports_zero_copy() const override {
return true;
}
bool supports_zero_copy() const override { return true; }
private:
uint8_t* data_;
int64_t position_;
int64_t size_;
private:
uint8_t* data_;
int64_t position_;
int64_t size_;
};
} // namespace numbuf
} // namespace numbuf
#endif // PYNUMBUF_MEMORY_H
#endif // PYNUMBUF_MEMORY_H