Commit 91a0d273 authored by Stephen Morris's avatar Stephen Morris
Browse files

[2837] Fixed omissions from previous review corrections

Added braces to a single-line "if" statement.  Also corrected
some comments and removed trailing spaces from some statements.
parent 2b7e75de
...@@ -30,15 +30,16 @@ HWAddr::HWAddr() ...@@ -30,15 +30,16 @@ HWAddr::HWAddr()
HWAddr::HWAddr(const uint8_t* hwaddr, size_t len, uint8_t htype) HWAddr::HWAddr(const uint8_t* hwaddr, size_t len, uint8_t htype)
:hwaddr_(hwaddr, hwaddr + len), htype_(htype) { :hwaddr_(hwaddr, hwaddr + len), htype_(htype) {
if (len > MAX_HWADDR_LEN) { if (len > MAX_HWADDR_LEN) {
isc_throw(InvalidParameter, "hwaddr length exceeds MAX_HWADDR_LEN"); isc_throw(InvalidParameter, "hwaddr length exceeds MAX_HWADDR_LEN");
} }
} }
HWAddr::HWAddr(const std::vector<uint8_t>& hwaddr, uint8_t htype) HWAddr::HWAddr(const std::vector<uint8_t>& hwaddr, uint8_t htype)
:hwaddr_(hwaddr), htype_(htype) { :hwaddr_(hwaddr), htype_(htype) {
if (hwaddr.size() > MAX_HWADDR_LEN) if (hwaddr.size() > MAX_HWADDR_LEN) {
isc_throw(InvalidParameter, isc_throw(InvalidParameter,
"address vector size exceeds MAX_HWADDR_LEN"); "address vector size exceeds MAX_HWADDR_LEN");
}
} }
std::string HWAddr::toText() const { std::string HWAddr::toText() const {
...@@ -58,7 +59,7 @@ std::string HWAddr::toText() const { ...@@ -58,7 +59,7 @@ std::string HWAddr::toText() const {
} }
bool HWAddr::operator==(const HWAddr& other) const { bool HWAddr::operator==(const HWAddr& other) const {
return ((this->htype_ == other.htype_) && return ((this->htype_ == other.htype_) &&
(this->hwaddr_ == other.hwaddr_)); (this->hwaddr_ == other.hwaddr_));
} }
......
...@@ -42,7 +42,7 @@ TEST(HWAddrTest, constructor) { ...@@ -42,7 +42,7 @@ TEST(HWAddrTest, constructor) {
const uint8_t htype = HTYPE_ETHER; const uint8_t htype = HTYPE_ETHER;
vector<uint8_t> data2(data1, data1 + sizeof(data1)); vector<uint8_t> data2(data1, data1 + sizeof(data1));
// over the limit data // Over the limit data
vector<uint8_t> big_data_vector(HWAddr::MAX_HWADDR_LEN + 1, 0); vector<uint8_t> big_data_vector(HWAddr::MAX_HWADDR_LEN + 1, 0);
scoped_ptr<HWAddr> hwaddr1(new HWAddr(data1, sizeof(data1), htype)); scoped_ptr<HWAddr> hwaddr1(new HWAddr(data1, sizeof(data1), htype));
...@@ -58,11 +58,11 @@ TEST(HWAddrTest, constructor) { ...@@ -58,11 +58,11 @@ TEST(HWAddrTest, constructor) {
EXPECT_EQ(0, hwaddr3->hwaddr_.size()); EXPECT_EQ(0, hwaddr3->hwaddr_.size());
EXPECT_EQ(htype, hwaddr3->htype_); EXPECT_EQ(htype, hwaddr3->htype_);
// check that over the limit data length throws exception // Check that over the limit data length throws exception
EXPECT_THROW(HWAddr(&big_data_vector[0], big_data_vector.size(), HTYPE_ETHER), EXPECT_THROW(HWAddr(&big_data_vector[0], big_data_vector.size(), HTYPE_ETHER),
InvalidParameter); InvalidParameter);
// check that over the limit vector throws exception // Check that over the limit vector throws exception
EXPECT_THROW(HWAddr(big_data_vector, HTYPE_ETHER), InvalidParameter); EXPECT_THROW(HWAddr(big_data_vector, HTYPE_ETHER), InvalidParameter);
} }
......
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