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>
diff --git a/compositor/DrmDisplayCompositor.cpp b/compositor/DrmDisplayCompositor.cpp
index 5331b6d..8d96d0e 100644
--- a/compositor/DrmDisplayCompositor.cpp
+++ b/compositor/DrmDisplayCompositor.cpp
@@ -76,7 +76,7 @@
writeback_fence_(-1),
flattening_state_(FlatteningState::kNone),
frames_flattened_(0) {
- struct timespec ts;
+ struct timespec ts {};
if (clock_gettime(CLOCK_MONOTONIC, &ts))
return;
dump_last_timestamp_ns_ = ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec;
@@ -189,7 +189,7 @@
return -ENOMEM;
}
- int ret;
+ int ret = 0;
std::vector<DrmCompositionPlane> &comp_planes = display_comp
->composition_planes();
for (DrmCompositionPlane &comp_plane : comp_planes) {
@@ -638,8 +638,7 @@
std::tuple<int, uint32_t> DrmDisplayCompositor::CreateModeBlob(
const DrmMode &mode) {
- struct drm_mode_modeinfo drm_mode;
- memset(&drm_mode, 0, sizeof(drm_mode));
+ struct drm_mode_modeinfo drm_mode {};
mode.ToDrmModeModeInfo(&drm_mode);
uint32_t id = 0;
@@ -1138,7 +1137,7 @@
uint64_t num_frames = dump_frames_composited_;
dump_frames_composited_ = 0;
- struct timespec ts;
+ struct timespec ts {};
ret = clock_gettime(CLOCK_MONOTONIC, &ts);
if (ret) {
pthread_mutex_unlock(&lock_);