camera: fix `-Wformat` compiler warnings

Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: Ib1d1fc2de98436dd7e9d15ab324789725bb2002e
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp
index 01236f3..35054a0 100644
--- a/modules/camera/3_4/camera.cpp
+++ b/modules/camera/3_4/camera.cpp
@@ -344,7 +344,7 @@
 
     // Pre-process output buffers.
     if (request->output_buffers.size() <= 0) {
-        ALOGE("%s:%d: Invalid number of output buffers: %d", __func__, mId,
+        ALOGE("%s:%d: Invalid number of output buffers: %zu", __func__, mId,
               request->output_buffers.size());
         return -EINVAL;
     }
@@ -434,7 +434,7 @@
         completeRequestWithError(request);
     }
 
-    ALOGV("%s:%d: Flushed %u requests.", __func__, mId, requests.size());
+    ALOGV("%s:%d: Flushed %zu requests.", __func__, mId, requests.size());
 
     // Call down into the device flushing.
     return flushBuffers();
diff --git a/modules/camera/3_4/format_metadata_factory.cpp b/modules/camera/3_4/format_metadata_factory.cpp
index c6e739d..5eed134 100644
--- a/modules/camera/3_4/format_metadata_factory.cpp
+++ b/modules/camera/3_4/format_metadata_factory.cpp
@@ -104,7 +104,7 @@
     return res;
   }
 
-  HAL_LOGI("Supports %d qualified formats.", qualified_formats.size());
+  HAL_LOGI("Supports %zu qualified formats.", qualified_formats.size());
 
   // Find sizes and frame/stall durations for all formats.
   // We also want to find the smallest max frame duration amongst all formats,
diff --git a/modules/camera/3_4/metadata/metadata_common.h b/modules/camera/3_4/metadata/metadata_common.h
index 34b7777..d98bd4d 100644
--- a/modules/camera/3_4/metadata/metadata_common.h
+++ b/modules/camera/3_4/metadata/metadata_common.h
@@ -180,7 +180,7 @@
   } else if (entry.count != 1) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain exactly 1 value "
-        "(had %d).",
+        "(had %zu).",
         tag,
         entry.count);
     return -EINVAL;
@@ -211,7 +211,7 @@
   } else if (entry.count != N) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain a single array of "
-        "exactly %d values (had %d).",
+        "exactly %zu values (had %zu).",
         tag,
         N,
         entry.count);
@@ -284,7 +284,7 @@
   if (entry.count % N != 0) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain a vector of arrays of "
-        "length %d (had %d entries, which is not divisible by %d).",
+        "length %zu (had %zu entries, which is not divisible by %zu).",
         tag,
         N,
         entry.count,
diff --git a/modules/camera/3_4/metadata/metadata_reader.cpp b/modules/camera/3_4/metadata/metadata_reader.cpp
index dfb3ade..6a25127 100644
--- a/modules/camera/3_4/metadata/metadata_reader.cpp
+++ b/modules/camera/3_4/metadata/metadata_reader.cpp
@@ -201,9 +201,9 @@
     }
     // Must have a non-negative stall.
     if (stall.duration < 0) {
-      ALOGE("%s: Invalid stall duration: negative stall %d.",
+      ALOGE("%s: Invalid stall duration: negative stall %lld.",
             __func__,
-            stall.duration);
+            static_cast<long long>(stall.duration));
       return -EINVAL;
     }
     // TODO(b/31384253): YUV_420_888, RAW10, RAW12, RAW_OPAQUE,
diff --git a/modules/camera/3_4/static_properties.cpp b/modules/camera/3_4/static_properties.cpp
index e914567..d41ac92 100644
--- a/modules/camera/3_4/static_properties.cpp
+++ b/modules/camera/3_4/static_properties.cpp
@@ -277,11 +277,11 @@
   for (size_t i = 0; i < stream_config->num_streams; ++i) {
     const camera3_stream_t* stream = stream_config->streams[i];
     if (stream == nullptr) {
-      ALOGE("%s: Stream %d is null", __func__, i);
+      ALOGE("%s: Stream %zu is null", __func__, i);
       return false;
     } else if (!IsInputType(stream->stream_type) &&
                !IsOutputType(stream->stream_type)) {
-      ALOGE("%s: Stream %d type %d is neither an input nor an output type",
+      ALOGE("%s: Stream %zu type %d is neither an input nor an output type",
             __func__,
             i,
             stream->stream_type);
@@ -321,7 +321,7 @@
   // Check the count.
   if (num_input_streams > max_input_streams_) {
     ALOGE(
-        "%s: Requested number of input streams %d is greater than "
+        "%s: Requested number of input streams %zu is greater than "
         "the maximum number supported by the device (%d).",
         __func__,
         num_input_streams,
@@ -406,7 +406,7 @@
   if (num_raw > max_raw_output_streams_) {
     ALOGE(
         "%s: Requested stream configuration exceeds maximum supported "
-        "raw output streams %d (requested %d).",
+        "raw output streams %d (requested %zu).",
         __func__,
         max_raw_output_streams_,
         num_raw);
@@ -414,7 +414,7 @@
   } else if (num_stalling > max_stalling_output_streams_) {
     ALOGE(
         "%s: Requested stream configuration exceeds maximum supported "
-        "stalling output streams %d (requested %d).",
+        "stalling output streams %d (requested %zu).",
         __func__,
         max_stalling_output_streams_,
         num_stalling);
@@ -422,7 +422,7 @@
   } else if (num_non_stalling > max_non_stalling_output_streams_) {
     ALOGE(
         "%s: Requested stream configuration exceeds maximum supported "
-        "non-stalling output streams %d (requested %d).",
+        "non-stalling output streams %d (requested %zu).",
         __func__,
         max_non_stalling_output_streams_,
         num_non_stalling);
diff --git a/modules/camera/3_4/v4l2_camera_hal.cpp b/modules/camera/3_4/v4l2_camera_hal.cpp
index 7ab96ac..8ff8e5d 100644
--- a/modules/camera/3_4/v4l2_camera_hal.cpp
+++ b/modules/camera/3_4/v4l2_camera_hal.cpp
@@ -115,7 +115,7 @@
 }
 
 int V4L2CameraHAL::getNumberOfCameras() {
-  HAL_LOGV("returns %d", mCameras.size());
+  HAL_LOGV("returns %zu", mCameras.size());
   return mCameras.size();
 }