libcamera: Declare static local variables as const where applicable
We use static local variables to indicate errors in methods that return a const reference. The local variables can thus be const, make them so. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
7216c6a9bb
commit
0228e9c927
4 changed files with 4 additions and 4 deletions
|
@ -752,7 +752,7 @@ bool ControlList::contains(unsigned int id) const
|
||||||
*/
|
*/
|
||||||
const ControlValue &ControlList::get(unsigned int id) const
|
const ControlValue &ControlList::get(unsigned int id) const
|
||||||
{
|
{
|
||||||
static ControlValue zero;
|
static const ControlValue zero;
|
||||||
|
|
||||||
const ControlValue *val = find(id);
|
const ControlValue *val = find(id);
|
||||||
if (!val)
|
if (!val)
|
||||||
|
|
|
@ -86,7 +86,7 @@ std::vector<unsigned int> ImageFormats::formats() const
|
||||||
*/
|
*/
|
||||||
const std::vector<SizeRange> &ImageFormats::sizes(unsigned int format) const
|
const std::vector<SizeRange> &ImageFormats::sizes(unsigned int format) const
|
||||||
{
|
{
|
||||||
static std::vector<SizeRange> empty;
|
static const std::vector<SizeRange> empty;
|
||||||
|
|
||||||
auto const &it = data_.find(format);
|
auto const &it = data_.find(format);
|
||||||
if (it == data_.end())
|
if (it == data_.end())
|
||||||
|
|
|
@ -203,7 +203,7 @@ int FrameBufferAllocator::free(Stream *stream)
|
||||||
const std::vector<std::unique_ptr<FrameBuffer>> &
|
const std::vector<std::unique_ptr<FrameBuffer>> &
|
||||||
FrameBufferAllocator::buffers(Stream *stream) const
|
FrameBufferAllocator::buffers(Stream *stream) const
|
||||||
{
|
{
|
||||||
static std::vector<std::unique_ptr<FrameBuffer>> empty;
|
static const std::vector<std::unique_ptr<FrameBuffer>> empty;
|
||||||
|
|
||||||
auto iter = buffers_.find(stream);
|
auto iter = buffers_.find(stream);
|
||||||
if (iter == buffers_.end())
|
if (iter == buffers_.end())
|
||||||
|
|
|
@ -749,7 +749,7 @@ void LogCategory::setSeverity(LogSeverity severity)
|
||||||
*/
|
*/
|
||||||
const LogCategory &LogCategory::defaultCategory()
|
const LogCategory &LogCategory::defaultCategory()
|
||||||
{
|
{
|
||||||
static LogCategory category("default");
|
static const LogCategory category("default");
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue