libcamera: controls: Catch type mismatch in ControlInfoMap
ControlInfoMap requires the ControlId and ControlRange of each entry to have identical types. Check for this and log an error if a mismatch is detected. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -573,8 +573,19 @@ ControlInfoMap::const_iterator ControlInfoMap::find(unsigned int id) const
|
||||
void ControlInfoMap::generateIdmap()
|
||||
{
|
||||
idmap_.clear();
|
||||
for (const auto &ctrl : *this)
|
||||
|
||||
for (const auto &ctrl : *this) {
|
||||
if (ctrl.first->type() != ctrl.second.min().type()) {
|
||||
LOG(Controls, Error)
|
||||
<< "Control " << utils::hex(ctrl.first->id())
|
||||
<< " type and range type mismatch";
|
||||
idmap_.clear();
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
idmap_[ctrl.first->id()] = ctrl.first;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user