From c4bd9198b4a0fac809903dd2c09276c2c3c1b22e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 27 Feb 2018 11:32:15 +0100 Subject: Init variables where they are declared when possible (clang-tidy) clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge --- tests/auto/compositor/compositor/mockclient.cpp | 9 --------- tests/auto/compositor/compositor/mockclient.h | 22 +++++++++++----------- .../auto/compositor/compositor/testcompositor.cpp | 3 +-- 3 files changed, 12 insertions(+), 22 deletions(-) (limited to 'tests/auto/compositor/compositor') diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp index 4720b0d9f..e6eac1553 100644 --- a/tests/auto/compositor/compositor/mockclient.cpp +++ b/tests/auto/compositor/compositor/mockclient.cpp @@ -47,14 +47,6 @@ const struct wl_registry_listener MockClient::registryListener = { MockClient::MockClient() : display(wl_display_connect("wayland-qt-test-0")) - , compositor(nullptr) - , registry(nullptr) - , wlshell(nullptr) - , xdgShell(nullptr) - , iviApplication(nullptr) - , refreshRate(-1) - , error(0 /* means no error according to spec */) - , protocolError({0, 0, nullptr}) { if (!display) qFatal("MockClient(): wl_display_connect() failed"); @@ -223,7 +215,6 @@ ivi_surface *MockClient::createIviSurface(wl_surface *surface, uint iviId) } ShmBuffer::ShmBuffer(const QSize &size, wl_shm *shm) - : handle(nullptr) { int stride = size.width() * 4; int alloc = stride * size.height(); diff --git a/tests/auto/compositor/compositor/mockclient.h b/tests/auto/compositor/compositor/mockclient.h index dd50f9a28..8933f8327 100644 --- a/tests/auto/compositor/compositor/mockclient.h +++ b/tests/auto/compositor/compositor/mockclient.h @@ -44,7 +44,7 @@ public: ShmBuffer(const QSize &size, wl_shm *shm); ~ShmBuffer(); - struct wl_buffer *handle; + struct wl_buffer *handle = nullptr; struct wl_shm_pool *shm_pool; QImage image; }; @@ -63,29 +63,29 @@ public: ivi_surface *createIviSurface(wl_surface *surface, uint iviId); wl_display *display; - wl_compositor *compositor; + wl_compositor *compositor = nullptr; QMap m_outputs; wl_shm *shm; - wl_registry *registry; - wl_shell *wlshell; - xdg_shell *xdgShell; - ivi_application *iviApplication; + wl_registry *registry = nullptr; + wl_shell *wlshell = nullptr; + xdg_shell *xdgShell = nullptr; + ivi_application *iviApplication = nullptr; QList m_seats; QRect geometry; QSize resolution; - int refreshRate; + int refreshRate = -1; QWaylandOutputMode currentMode; QWaylandOutputMode preferredMode; QList modes; int fd; - int error; + int error = 0 /* means no error according to spec */; struct { - uint id; - uint code; - const wl_interface *interface; + uint id = 0; + uint code = 0; + const wl_interface *interface = nullptr; } protocolError; private slots: diff --git a/tests/auto/compositor/compositor/testcompositor.cpp b/tests/auto/compositor/compositor/testcompositor.cpp index f91d0d3f1..710bb7b3a 100644 --- a/tests/auto/compositor/compositor/testcompositor.cpp +++ b/tests/auto/compositor/compositor/testcompositor.cpp @@ -33,8 +33,7 @@ #include TestCompositor::TestCompositor(bool createInputDev) - : QWaylandCompositor() - , shell(new QWaylandWlShell(this)) + : shell(new QWaylandWlShell(this)) , m_createSeat(createInputDev) { setSocketName("wayland-qt-test-0"); -- cgit v1.2.3