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:
parent
cdc68bf7f7
commit
7cbd88fec7
1 changed files with 12 additions and 1 deletions
|
@ -573,9 +573,20 @@ ControlInfoMap::const_iterator ControlInfoMap::find(unsigned int id) const
|
||||||
void ControlInfoMap::generateIdmap()
|
void ControlInfoMap::generateIdmap()
|
||||||
{
|
{
|
||||||
idmap_.clear();
|
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;
|
idmap_[ctrl.first->id()] = ctrl.first;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ControlList
|
* \class ControlList
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue