libcamera: controls: initialise control info to ControlTypeNone by default
The default ControlInfo constructor allows partially initialising the min/max/def values. Uninitialised values are assigned to 0 by default. This implicit initialisation makes it impossible to distinguish between an uninitialised and an explicitly 0-initialised ControlValue. Default construct the ControlValue in the ControlInfo default contructor to explicitly represent uninitialised values by the ControlTypeNone type. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
cbc2be34ed
commit
5fd18af233
2 changed files with 5 additions and 5 deletions
|
@ -268,9 +268,9 @@ private:
|
||||||
class ControlInfo
|
class ControlInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ControlInfo(const ControlValue &min = 0,
|
explicit ControlInfo(const ControlValue &min = {},
|
||||||
const ControlValue &max = 0,
|
const ControlValue &max = {},
|
||||||
const ControlValue &def = 0);
|
const ControlValue &def = {});
|
||||||
explicit ControlInfo(Span<const ControlValue> values,
|
explicit ControlInfo(Span<const ControlValue> values,
|
||||||
const ControlValue &def = {});
|
const ControlValue &def = {});
|
||||||
explicit ControlInfo(std::set<bool> values, bool def);
|
explicit ControlInfo(std::set<bool> values, bool def);
|
||||||
|
|
|
@ -26,8 +26,8 @@ protected:
|
||||||
*/
|
*/
|
||||||
ControlInfo brightness;
|
ControlInfo brightness;
|
||||||
|
|
||||||
if (brightness.min().get<int32_t>() != 0 ||
|
if (brightness.min().type() != ControlType::ControlTypeNone ||
|
||||||
brightness.max().get<int32_t>() != 0) {
|
brightness.max().type() != ControlType::ControlTypeNone) {
|
||||||
cout << "Invalid control range for Brightness" << endl;
|
cout << "Invalid control range for Brightness" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue