Browse Source

[2749] Update resize() call arguments to be sizeof instead of literal values

Mukund Sivaraman 11 years ago
parent
commit
1685d98e14
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/lib/dhcp/option.cc

+ 6 - 6
src/lib/dhcp/option.cc

@@ -260,18 +260,18 @@ uint32_t Option::getUint32() {
 }
 
 void Option::setUint8(uint8_t value) {
-  data_.resize(1);
-  data_[0] = value;
+    data_.resize(sizeof(value));
+    data_[0] = value;
 }
 
 void Option::setUint16(uint16_t value) {
-  data_.resize(2);
-  writeUint16(value, &data_[0], data_.size());
+    data_.resize(sizeof(value));
+    writeUint16(value, &data_[0], data_.size());
 }
 
 void Option::setUint32(uint32_t value) {
-  data_.resize(4);
-  writeUint32(value, &data_[0], data_.size());
+    data_.resize(sizeof(value));
+    writeUint32(value, &data_[0], data_.size());
 }
 
 bool Option::equal(const OptionPtr& other) const {