aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRoman Stratiienko <r.stratiienko@gmail.com>2021-02-13 10:57:47 +0200
committerRoman Stratiienko <r.stratiienko@gmail.com>2021-03-03 16:07:25 +0200
commite2f2c929243fa52fc1683bc8b22f550446d9535b (patch)
tree7cda265797d40ae88449210b1b3346f1adc44e35 /utils
parentd6659983335082d4b54ee006626a1ebc29423bcc (diff)
downloaddrm_hwcomposer-e2f2c929243fa52fc1683bc8b22f550446d9535b.tar.gz
drm_hwcomposer: enable code analysis using clang-tidy
Drm hwcomposer project has some code-style inconsistencies. This is the initial step to unify code-style of the code. Clang-tidy is a great tool which can not only suggest correct styling, but also allow predicting the errors in the code and suggest correct coding approaches to avoid potential weaknesses. CI was tuned to check clang-tidy recommendation for some part of the code which is ready ATM (can be built outside AOSP tree). For this part a limited set of clang-tidy checks has applied (coarse check). Header files aren't checked at all. Starting from now new code files must be included into the list that is checked by almost all clang-tidy checks (fine checklist). New header files should be also included into this list. See '.gitlab-ci-clang-tidy-fine.sh'. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/Worker.cpp3
-rw-r--r--utils/autolock.cpp4
-rw-r--r--utils/hwcutils.cpp14
3 files changed, 10 insertions, 11 deletions
diff --git a/utils/Worker.cpp b/utils/Worker.cpp
index 1f30588..d2b60c8 100644
--- a/utils/Worker.cpp
+++ b/utils/Worker.cpp
@@ -34,8 +34,7 @@ int Worker::InitWorker() {
if (initialized())
return -EALREADY;
- thread_ = std::unique_ptr<std::thread>(
- new std::thread(&Worker::InternalRoutine, this));
+ thread_ = std::make_unique<std::thread>(&Worker::InternalRoutine, this);
initialized_ = true;
exit_ = false;
diff --git a/utils/autolock.cpp b/utils/autolock.cpp
index 4e9552a..4b5cd7e 100644
--- a/utils/autolock.cpp
+++ b/utils/autolock.cpp
@@ -19,10 +19,10 @@
#include "autolock.h"
-#include <errno.h>
+#include <log/log.h>
#include <pthread.h>
-#include <log/log.h>
+#include <cerrno>
namespace android {
diff --git a/utils/hwcutils.cpp b/utils/hwcutils.cpp
index 322efce..9a49c41 100644
--- a/utils/hwcutils.cpp
+++ b/utils/hwcutils.cpp
@@ -30,18 +30,18 @@
namespace android {
const hwc_drm_bo *DrmHwcBuffer::operator->() const {
- if (importer_ == NULL) {
+ if (importer_ == nullptr) {
ALOGE("Access of non-existent BO");
exit(1);
- return NULL;
+ return nullptr;
}
return &bo_;
}
void DrmHwcBuffer::Clear() {
- if (importer_ != NULL) {
+ if (importer_ != nullptr) {
importer_->ReleaseBuffer(&bo_);
- importer_ = NULL;
+ importer_ = nullptr;
}
}
@@ -60,7 +60,7 @@ int DrmHwcBuffer::ImportBuffer(buffer_handle_t handle, Importer *importer) {
return ret;
}
- if (importer_ != NULL) {
+ if (importer_ != nullptr) {
importer_->ReleaseBuffer(&bo_);
}
@@ -97,13 +97,13 @@ DrmHwcNativeHandle::~DrmHwcNativeHandle() {
}
void DrmHwcNativeHandle::Clear() {
- if (handle_ != NULL) {
+ if (handle_ != nullptr) {
GraphicBufferMapper &gm(GraphicBufferMapper::get());
int ret = gm.freeBuffer(handle_);
if (ret) {
ALOGE("Failed to free buffer handle %d", ret);
}
- handle_ = NULL;
+ handle_ = nullptr;
}
}