From de9c47bdb9c52fac078f2165a05507ff6d6a527b Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Tue, 23 Jan 2018 16:30:08 -0800 Subject: [PATCH] camera 3_4: Fix compilation errors Compile Error: hardware/libhardware/modules/camera/3_4/camera.cpp:502:9: error: non-constant-expression cannot be narrowed from type 'std::__1::vector >::size_type' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] request->output_buffers.size(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compile Error: hardware/libhardware/modules/camera/3_4/v4l2_gralloc.cpp:168:15: error: use of undeclared identifier 'EINVAL' return -EINVAL; Test: Add to device.mk USE_CAMERA_V4L2_HAL := true PRODUCT_PACKAGES += camera.v4l2 mma Change-Id: Ia6bbd6bac06540214d2c6167a8826f3f4c946e57 Merged-In: Ia6bbd6bac06540214d2c6167a8826f3f4c946e57 Signed-off-by: Dmitry Shmidt --- modules/camera/3_4/camera.cpp | 2 +- modules/camera/3_4/request_tracker_test.cpp | 2 +- modules/camera/3_4/static_properties_test.cpp | 4 ++-- modules/camera/3_4/v4l2_gralloc.cpp | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp index 7f42eef6..83905ea8 100644 --- a/modules/camera/3_4/camera.cpp +++ b/modules/camera/3_4/camera.cpp @@ -499,7 +499,7 @@ void Camera::sendResult(std::shared_ptr request) { camera3_capture_result_t result { request->frame_number, request->settings.getAndLock(), - request->output_buffers.size(), + static_cast(request->output_buffers.size()), request->output_buffers.data(), request->input_buffer.get(), 1 // Total result; only 1 part. diff --git a/modules/camera/3_4/request_tracker_test.cpp b/modules/camera/3_4/request_tracker_test.cpp index a68ff57f..8b73bd89 100644 --- a/modules/camera/3_4/request_tracker_test.cpp +++ b/modules/camera/3_4/request_tracker_test.cpp @@ -35,7 +35,7 @@ class RequestTrackerTest : public Test { stream2_.max_buffers = 3; dut_.reset(new RequestTracker()); streams_ = {&stream1_, &stream2_}; - camera3_stream_configuration_t config{streams_.size(), streams_.data(), 0}; + camera3_stream_configuration_t config{static_cast(streams_.size()), streams_.data(), 0}; dut_->SetStreamConfiguration(config); } diff --git a/modules/camera/3_4/static_properties_test.cpp b/modules/camera/3_4/static_properties_test.cpp index e78e3437..2cdb9d4d 100644 --- a/modules/camera/3_4/static_properties_test.cpp +++ b/modules/camera/3_4/static_properties_test.cpp @@ -107,7 +107,7 @@ class StaticPropertiesTest : public Test { stream_addresses.push_back(&streams[i]); } camera3_stream_configuration_t config = { - stream_addresses.size(), + static_cast(stream_addresses.size()), stream_addresses.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE}; PrepareDefaultDUT(); @@ -443,7 +443,7 @@ TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) { TEST_F(StaticPropertiesTest, ConfigureNullStreams) { std::vector streams(2, nullptr); camera3_stream_configuration_t config = { - streams.size(), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE}; + static_cast(streams.size()), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE}; PrepareDefaultDUT(); EXPECT_FALSE(dut_->StreamConfigurationSupported(&config)); } diff --git a/modules/camera/3_4/v4l2_gralloc.cpp b/modules/camera/3_4/v4l2_gralloc.cpp index 7da3c4e2..1c8ca48b 100644 --- a/modules/camera/3_4/v4l2_gralloc.cpp +++ b/modules/camera/3_4/v4l2_gralloc.cpp @@ -18,6 +18,7 @@ #include +#include #include #include