}
uint16_t Option::getUint16() {
- if (data_.size() < sizeof(uint16_t) ) {
- isc_throw(OutOfRange, "Attempt to read uint16 from option " << type_
- << " that has size " << data_.size());
- }
-
+ // readUint16() checks and throws OutOfRange if data_ is too small.
return (readUint16(&data_[0], data_.size()));
}
uint32_t Option::getUint32() {
- if (data_.size() < sizeof(uint32_t) ) {
- isc_throw(OutOfRange, "Attempt to read uint32 from option " << type_
- << " that has size " << data_.size());
- }
+ // readUint32() checks and throws OutOfRange if data_ is too small.
return (readUint32(&data_[0], data_.size()));
}