From 26d94709e34ea201a199a2decccac09bc6dfd584 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 5 Jul 2022 09:22:40 +0000 Subject: [PATCH] Fix printf warnings --- device/libcamera/buffer.cc | 6 ++++-- device/libcamera/device.cc | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/device/libcamera/buffer.cc b/device/libcamera/buffer.cc index bf23b93..44678c6 100644 --- a/device/libcamera/buffer.cc +++ b/device/libcamera/buffer.cc @@ -1,6 +1,8 @@ #ifdef USE_LIBCAMERA #include "libcamera.hh" +#include + int libcamera_buffer_open(buffer_t *buf) { buf->libcamera = new buffer_libcamera_t{}; @@ -37,7 +39,7 @@ int libcamera_buffer_open(buffer_t *buf) } if (offset + length != plane.offset) { - LOG_ERROR(buf, "Plane is not continuous: offset=%u, expected=%lu", plane.offset, offset + length); + LOG_ERROR(buf, "Plane is not continuous: offset=%u, expected=%" PRIu64, plane.offset, offset + length); } length += plane.length; @@ -51,7 +53,7 @@ int libcamera_buffer_open(buffer_t *buf) buf->dma_fd = dma_fd.get(); buf->length = length; - LOG_DEBUG(buf, "Mapped buffer: start=%p, length=%zu, fd=%d, planes=%lu", + LOG_DEBUG(buf, "Mapped buffer: start=%p, length=%zu, fd=%d, planes=%zu", buf->start, buf->length, buf->dma_fd, buffer->planes().size()); } diff --git a/device/libcamera/device.cc b/device/libcamera/device.cc index 0d6acea..667f38d 100644 --- a/device/libcamera/device.cc +++ b/device/libcamera/device.cc @@ -7,6 +7,11 @@ std::string libcamera_device_option_normalize(std::string key) return key; } +libcamera::ControlInfoMap libcamera_control_list(device_t *dev) +{ + return dev->libcamera->camera->controls(); +} + int libcamera_device_open(device_t *dev) { dev->libcamera = new device_libcamera_t{}; @@ -35,7 +40,7 @@ int libcamera_device_open(device_t *dev) LOG_INFO(dev, "Device path=%s opened", dev->path); - for (auto const &control : dev->libcamera->camera->controls()) { + for (auto const &control : libcamera_control_list(dev)) { if (!control.first) continue; @@ -74,7 +79,7 @@ int libcamera_device_set_option(device_t *dev, const char *keyp, const char *val { auto key = libcamera_device_option_normalize(keyp); - for (auto const &control : dev->libcamera->camera->controls()) { + for (auto const &control : libcamera_control_list(dev)) { if (!control.first) continue;