summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 23:57:21 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 23:57:21 +0000
commitfdd0082f8c0f02c29089c93e7b00ab4617b62c8a (patch)
tree5129215156c44daede4e044ea20f63022a33d71b /net
parentaa80d6f3701438f0a87b8ebefdde011dbaf2c569 (diff)
downloadchromium_src-fdd0082f8c0f02c29089c93e7b00ab4617b62c8a.zip
chromium_src-fdd0082f8c0f02c29089c93e7b00ab4617b62c8a.tar.gz
chromium_src-fdd0082f8c0f02c29089c93e7b00ab4617b62c8a.tar.bz2
Fix nits: remove unnecessary local variable, check for
null pointer before use, etc. R=mbelshe BUG=none TEST=none Review URL: http://codereview.chromium.org/3294020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/spdy_frame_builder.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/spdy/spdy_frame_builder.cc b/net/spdy/spdy_frame_builder.cc
index 7d21b82..eed6eb2 100644
--- a/net/spdy/spdy_frame_builder.cc
+++ b/net/spdy/spdy_frame_builder.cc
@@ -104,7 +104,6 @@ bool SpdyFrameBuilder::ReadData(void** iter, const char** data,
}
char* SpdyFrameBuilder::BeginWrite(size_t length) {
- size_t offset = length_;
size_t needed_size = length_ + length;
if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
return NULL;
@@ -113,7 +112,7 @@ char* SpdyFrameBuilder::BeginWrite(size_t length) {
DCHECK_LE(length, std::numeric_limits<uint32>::max());
#endif
- return buffer_ + offset;
+ return buffer_ + length_;
}
void SpdyFrameBuilder::EndWrite(char* dest, int length) {
@@ -163,16 +162,16 @@ char* SpdyFrameBuilder::BeginWriteData(uint16 length) {
}
bool SpdyFrameBuilder::Resize(size_t new_capacity) {
- if (new_capacity < capacity_)
+ if (new_capacity <= capacity_)
return true;
char* p = new char[new_capacity];
+ if (!p)
+ return false;
if (buffer_) {
memcpy(p, buffer_, capacity_);
delete[] buffer_;
}
- if (!p && new_capacity > 0)
- return false;
buffer_ = p;
capacity_ = new_capacity;
return true;