Commit 6caf175a authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Commit Bot

media/gpu/v4l2: Do not use auto to deduce a raw pointer

Chromium coding style dictates that one should not use auto to deduce a
raw pointer.

ChromeOS builds are unaffected, but attempts to build media/gpu/v4l2
for desktop Linux will result in an error from the style check plugin:

  ../../media/gpu/v4l2/v4l2_device.cc:377:3: error: [chromium-style]
      auto variable type must not deduce to a raw pointer type.
    const auto& planes = v4l2_buffer_.m.planes;
    ^~~~~~~~~~~
    auto* const

This is part of ongoing work to make V4L2 usable on desktop Linux. It
is currently untestable without a lot of other changes. The type of
`plane` before and after the change are the same, found using the
non-implemented template method [1] which shows the actual type in the
compile error.

In the meantime it doesn't break ChromeOS builds either.

[1] https://stackoverflow.com/a/38820784

Test: build media_unittests simplechrome (chromeos-amd64-generic-rel)
Change-Id: I5d760babc92ff101d8b75aa208cd875259b6e556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895311Reviewed-by: default avatarKuang-che Wu <kcwu@chromium.org>
Commit-Queue: Kuang-che Wu <kcwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711989}
parent 23f8011b
...@@ -374,7 +374,7 @@ bool V4L2BufferRefBase::CheckNumFDsForFormat(const size_t num_fds) const { ...@@ -374,7 +374,7 @@ bool V4L2BufferRefBase::CheckNumFDsForFormat(const size_t num_fds) const {
return false; return false;
} }
const auto& planes = v4l2_buffer_.m.planes; const auto* planes = v4l2_buffer_.m.planes;
for (size_t i = v4l2_buffer_.length - 1; i >= num_fds; --i) { for (size_t i = v4l2_buffer_.length - 1; i >= num_fds; --i) {
// Assume that an fd is a duplicate of a previous plane's fd if offset != 0. // Assume that an fd is a duplicate of a previous plane's fd if offset != 0.
// Otherwise, if offset == 0, return error as it is likely pointing to // Otherwise, if offset == 0, return error as it is likely pointing to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment