Commit f65cb09e authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac404] Cleanup some getBuffer()s

They are not needed on many places, so remove them.
parent cf05a54b
...@@ -244,7 +244,7 @@ MessageRenderer::writeName(const Name& name, const bool compress) { ...@@ -244,7 +244,7 @@ MessageRenderer::writeName(const Name& name, const bool compress) {
} }
// Record the current offset before extending the buffer. // Record the current offset before extending the buffer.
const size_t offset = getBuffer().getLength(); const size_t offset = getLength();
// Write uncompress part... // Write uncompress part...
writeData(impl_->nbuffer_.getData(), writeData(impl_->nbuffer_.getData(),
compress ? i : impl_->nbuffer_.getLength()); compress ? i : impl_->nbuffer_.getLength());
......
...@@ -74,8 +74,6 @@ public: ...@@ -74,8 +74,6 @@ public:
mode_(CASE_INSENSITIVE), last_data_pos_(0) mode_(CASE_INSENSITIVE), last_data_pos_(0)
{} {}
virtual ~RdataFieldComposer() {} virtual ~RdataFieldComposer() {}
virtual const void* getData() const { return (getBuffer().getData()); }
virtual size_t getLength() const { return (getBuffer().getLength()); }
virtual bool isTruncated() const { return (truncated_); } virtual bool isTruncated() const { return (truncated_); }
virtual size_t getLengthLimit() const { return (length_limit_); } virtual size_t getLengthLimit() const { return (length_limit_); }
virtual CompressMode getCompressMode() const { return (mode_); } virtual CompressMode getCompressMode() const { return (mode_); }
...@@ -87,10 +85,12 @@ public: ...@@ -87,10 +85,12 @@ public:
const RdataFields::Type field_type = const RdataFields::Type field_type =
compress ? RdataFields::COMPRESSIBLE_NAME : compress ? RdataFields::COMPRESSIBLE_NAME :
RdataFields::INCOMPRESSIBLE_NAME; RdataFields::INCOMPRESSIBLE_NAME;
// TODO: When we get rid of need for getBuffer, we can output the name
// to a buffer and then write the buffer inside
name.toWire(getBuffer()); name.toWire(getBuffer());
fields_.push_back(RdataFields::FieldSpec(field_type, fields_.push_back(RdataFields::FieldSpec(field_type,
name.getLength())); name.getLength()));
last_data_pos_ = getBuffer().getLength(); last_data_pos_ = getLength();
} }
virtual void clear() { virtual void clear() {
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
size_t last_data_pos_; size_t last_data_pos_;
void extendData() { void extendData() {
// No news, return to work // No news, return to work
if (getBuffer().getLength() == last_data_pos_) { if (getLength() == last_data_pos_) {
return; return;
} }
// The new bytes are just ordinary uninteresting data // The new bytes are just ordinary uninteresting data
...@@ -118,8 +118,8 @@ public: ...@@ -118,8 +118,8 @@ public:
fields_.push_back(RdataFields::FieldSpec(RdataFields::DATA, 0)); fields_.push_back(RdataFields::FieldSpec(RdataFields::DATA, 0));
} }
// We added this much data from last time // We added this much data from last time
fields_.back().len += getBuffer().getLength() - last_data_pos_; fields_.back().len += getLength() - last_data_pos_;
last_data_pos_ = getBuffer().getLength(); last_data_pos_ = getLength();
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment