libcamera: libcamera: Formatting improvements

The LSP autoformatter doesn't like some of the current formatting, let's
make it happier.  Note that not all of its suggestions were accepted
because readability is preferred and adjusting .clang-format may not be
easy or possible.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Milan Zamazal 2024-09-02 17:42:08 +02:00 committed by Laurent Pinchart
parent 61a1d1694c
commit 6d0bf44c32
8 changed files with 20 additions and 19 deletions

View file

@ -8,8 +8,8 @@
#include <libcamera/controls.h>
#include <sstream>
#include <string>
#include <string.h>
#include <string>
#include <libcamera/base/log.h>
#include <libcamera/base/utils.h>

View file

@ -539,7 +539,6 @@ IPADataSerializer<SharedFD>::serialize(const SharedFD &data,
if (data.isValid())
fdVec.push_back(data);
return { dataVec, fdVec };
}
@ -606,7 +605,7 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_i
FrameBuffer::Plane ret;
ret.fd = IPADataSerializer<SharedFD>::deserialize(dataBegin, dataBegin + 4,
fdsBegin, fdsBegin + 1);
fdsBegin, fdsBegin + 1);
ret.offset = readPOD<uint32_t>(dataBegin, 4, dataEnd);
ret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd);

View file

@ -50,8 +50,8 @@ typename std::remove_extent_t<T> *elfPointer(Span<const uint8_t> elf,
if (size > elf.size() || size < objSize)
return nullptr;
return reinterpret_cast<typename std::remove_extent_t<T> *>
(reinterpret_cast<const char *>(elf.data()) + offset);
return reinterpret_cast<typename std::remove_extent_t<T> *>(
reinterpret_cast<const char *>(elf.data()) + offset);
}
template<typename T>

View file

@ -101,10 +101,14 @@ std::ostream &operator<<(std::ostream &out, const Orientation &orientation)
{
constexpr std::array<const char *, 9> orientationNames = {
"", /* Orientation starts counting from 1. */
"Rotate0", "Rotate0Mirror",
"Rotate180", "Rotate180Mirror",
"Rotate90Mirror", "Rotate270",
"Rotate270Mirror", "Rotate90",
"Rotate0",
"Rotate0Mirror",
"Rotate180",
"Rotate180Mirror",
"Rotate90Mirror",
"Rotate270",
"Rotate270Mirror",
"Rotate90",
};
out << orientationNames[static_cast<unsigned int>(orientation)];

View file

@ -188,7 +188,6 @@ const struct sigaction &ProcessManager::oldsa() const
return oldsa_;
}
/**
* \class Process
* \brief Process object
@ -270,8 +269,8 @@ int Process::start(const std::string &path,
unsigned int len = args.size();
argv[0] = path.c_str();
for (unsigned int i = 0; i < len; i++)
argv[i+1] = args[i].c_str();
argv[len+1] = nullptr;
argv[i + 1] = args[i].c_str();
argv[len + 1] = nullptr;
execv(path.c_str(), (char **)argv);

View file

@ -6,7 +6,6 @@
*/
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/media_device.h"
#include <algorithm>
#include <float.h>
@ -14,15 +13,16 @@
#include <math.h>
#include <string.h>
#include <libcamera/base/utils.h>
#include <libcamera/camera.h>
#include <libcamera/orientation.h>
#include <libcamera/property_ids.h>
#include <libcamera/base/utils.h>
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/camera_lens.h"
#include "libcamera/internal/camera_sensor_properties.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/sysfs.h"
/**

View file

@ -57,8 +57,8 @@ SharedMem::SharedMem() = default;
*/
SharedMem::SharedMem(const std::string &name, std::size_t size)
{
UniqueFD memfd = MemFd::create(name.c_str(), size, MemFd::Seal::Shrink |
MemFd::Seal::Grow);
UniqueFD memfd = MemFd::create(name.c_str(), size,
MemFd::Seal::Shrink | MemFd::Seal::Grow);
if (!memfd.isValid())
return;

View file

@ -14,11 +14,10 @@
#include <string>
#include <vector>
#include <libcamera/request.h>
#include <libcamera/base/log.h>
#include <libcamera/base/utils.h>
#include <libcamera/request.h>
/**
* \file stream.h