diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2018-02-14 18:46:10 +1100 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2018-02-14 18:46:10 +1100 |
commit | 61cc1fa706af88f1159f5089840b09e2b838d0f4 (patch) | |
tree | 0de9959927f7108c6d6a4c378c641dbf071b13aa /cpputil | |
parent | a63322e39baae7b4c7f1f343891315973006493e (diff) | |
download | nss-hg-61cc1fa706af88f1159f5089840b09e2b838d0f4.tar.gz |
Bug 1309068 - Enable -Wshadow, r=franziskus
Diffstat (limited to 'cpputil')
-rw-r--r-- | cpputil/databuffer.cc | 10 | ||||
-rw-r--r-- | cpputil/databuffer.h | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/cpputil/databuffer.cc b/cpputil/databuffer.cc index d60ebccb3..1420d76b4 100644 --- a/cpputil/databuffer.cc +++ b/cpputil/databuffer.cc @@ -18,12 +18,12 @@ namespace nss_test { -void DataBuffer::Assign(const uint8_t* data, size_t len) { - if (data) { - Allocate(len); - memcpy(static_cast<void*>(data_), static_cast<const void*>(data), len); +void DataBuffer::Assign(const uint8_t* d, size_t l) { + if (d) { + Allocate(l); + memcpy(static_cast<void*>(data_), static_cast<const void*>(d), l); } else { - assert(len == 0); + assert(l == 0); data_ = nullptr; len_ = 0; } diff --git a/cpputil/databuffer.h b/cpputil/databuffer.h index 58e07efe1..5ec035098 100644 --- a/cpputil/databuffer.h +++ b/cpputil/databuffer.h @@ -17,8 +17,8 @@ namespace nss_test { class DataBuffer { public: DataBuffer() : data_(nullptr), len_(0) {} - DataBuffer(const uint8_t* data, size_t len) : data_(nullptr), len_(0) { - Assign(data, len); + DataBuffer(const uint8_t* d, size_t l) : data_(nullptr), len_(0) { + Assign(d, l); } DataBuffer(const DataBuffer& other) : data_(nullptr), len_(0) { Assign(other); @@ -32,17 +32,17 @@ class DataBuffer { return *this; } - void Allocate(size_t len) { + void Allocate(size_t l) { delete[] data_; - data_ = new uint8_t[len ? len : 1]; // Don't depend on new [0]. - len_ = len; + data_ = new uint8_t[l ? l : 1]; // Don't depend on new [0]. + len_ = l; } - void Truncate(size_t len) { len_ = (std::min)(len_, len); } + void Truncate(size_t l) { len_ = (std::min)(len_, l); } void Assign(const DataBuffer& other) { Assign(other.data(), other.len()); } - void Assign(const uint8_t* data, size_t len); + void Assign(const uint8_t* d, size_t l); // Write will do a new allocation and expand the size of the buffer if needed. // Returns the offset of the end of the write. |