1
0
Fork 0

drm_hwcomposer: clang-tidy: enable cppcoreguidelines-* checks

Our code isn't ready for the following checks therefore keep disabled
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-pro-bounds-constant-array-index
-cppcoreguidelines-pro-bounds-pointer-arithmetic
-cppcoreguidelines-pro-type-cstyle-cast
-cppcoreguidelines-pro-type-vararg
-cppcoreguidelines-avoid-magic-numbers
-cppcoreguidelines-macro-usage
-cppcoreguidelines-avoid-c-arrays

+ fixed existing tidy warnings for these checks.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
This commit is contained in:
Roman Stratiienko 2021-02-15 13:44:19 +02:00
parent 6a10c4ce1f
commit b3b5c1e937
27 changed files with 70 additions and 62 deletions

View file

@ -53,12 +53,12 @@ bool BufferInfoGetter::IsHandleUsable(buffer_handle_t handle) {
hwc_drm_bo_t bo;
memset(&bo, 0, sizeof(hwc_drm_bo_t));
if (ConvertBoInfo(handle, &bo) != 0)
if (ConvertBoInfo(handle, &bo) != 0) {
return false;
if (bo.prime_fds[0] == 0)
}
if (bo.prime_fds[0] == 0) {
return false;
}
return true;
}

View file

@ -84,9 +84,9 @@ static bool is_yuv(int native) {
bool BufferInfoLibdrm::GetYuvPlaneInfo(int num_fds, buffer_handle_t handle,
hwc_drm_bo_t *bo) {
struct android_ycbcr ycbcr;
enum chroma_order chroma_order;
int ret;
struct android_ycbcr ycbcr {};
enum chroma_order chroma_order {};
int ret = 0;
if (!gralloc_->lock_ycbcr) {
static std::once_flag once;

View file

@ -68,9 +68,9 @@ uint64_t BufferInfoMaliHisi::ConvertGrallocFormatToDrmModifiers(
int BufferInfoMaliHisi::ConvertBoInfo(buffer_handle_t handle,
hwc_drm_bo_t *bo) {
bool is_rgb;
bool is_rgb = false;
auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
auto *hnd = (private_handle_t const *)handle;
if (!hnd)
return -EINVAL;

View file

@ -34,7 +34,7 @@ LEGACY_BUFFER_INFO_GETTER(BufferInfoMaliMediatek);
int BufferInfoMaliMediatek::ConvertBoInfo(buffer_handle_t handle,
hwc_drm_bo_t *bo) {
auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
auto *hnd = (private_handle_t const *)handle;
if (!hnd)
return -EINVAL;

View file

@ -63,7 +63,7 @@ uint64_t BufferInfoMaliMeson::ConvertGrallocFormatToDrmModifiers(
int BufferInfoMaliMeson::ConvertBoInfo(buffer_handle_t handle,
hwc_drm_bo_t *bo) {
auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
auto *hnd = (private_handle_t const *)handle;
if (!hnd)
return -EINVAL;