Skip to content

Commit 3d10dde

Browse files
committed
Clang-tidy fixes
1 parent 6a33df9 commit 3d10dde

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

ui/app/Application.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "ui/IBreakWindow.hh"
4040
#include "ui/Plugin.hh"
4141
#include "ui/IToolkitFactory.hh"
42-
#include "commonui/nls.h"
4342
#include "commonui/Locale.hh"
4443
#include "commonui/Text.hh"
4544
#include "utils/Exception.hh"
@@ -593,7 +592,7 @@ Application::get_timers_tooltip()
593592

594593
for (int count = 0; count < BREAK_ID_SIZEOF; count++)
595594
{
596-
auto b = core->get_break(BreakId(count));
595+
auto *b = core->get_break(BreakId(count));
597596
bool on = b->is_enabled();
598597

599598
if (b != nullptr && on)
@@ -648,7 +647,7 @@ Application::on_idle_changed(bool new_idle)
648647
if (new_idle && !is_idle)
649648
{
650649
TRACE_MSG("Now idle");
651-
auto rest_break = core->get_break(BREAK_ID_REST_BREAK);
650+
auto *rest_break = core->get_break(BREAK_ID_REST_BREAK);
652651

653652
taking = rest_break->is_taking();
654653
TRACE_MSG("taking {}", taking);
@@ -666,7 +665,7 @@ Application::on_idle_changed(bool new_idle)
666665
{
667666
TRACE_MSG("Automatic natural break enabled");
668667

669-
auto rest_break = core->get_break(BREAK_ID_REST_BREAK);
668+
auto *rest_break = core->get_break(BREAK_ID_REST_BREAK);
670669

671670
if (core->get_regular_operation_mode() == OperationMode::Normal
672671
&& rest_break->get_elapsed_idle_time() < rest_break->get_auto_reset() && rest_break->is_enabled()

ui/app/toolkits/gtkmm/RestBreakWindow.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Gtk::Widget *
6464
RestBreakWindow::create_gui()
6565
{
6666
// Add other widgets.
67-
Gtk::VBox *vbox = new Gtk::VBox(false, 6);
67+
auto *vbox = new Gtk::VBox(false, 6);
6868

6969
pluggable_panel = Gtk::manage(new Gtk::HBox);
7070

@@ -75,7 +75,7 @@ RestBreakWindow::create_gui()
7575
vbox->pack_start(*timebar, false, false, 6);
7676

7777
Gtk::Box *bottom_box = create_bottom_box(true, GUIConfig::break_enable_shutdown(BREAK_ID_REST_BREAK)());
78-
if (bottom_box)
78+
if (bottom_box != nullptr)
7979
{
8080
vbox->pack_end(*Gtk::manage(bottom_box), Gtk::PACK_SHRINK, 6);
8181
}
@@ -163,7 +163,7 @@ RestBreakWindow::create_info_panel()
163163
Gtk::Label *info_lab = Gtk::manage(new Gtk::Label());
164164
Glib::ustring txt;
165165

166-
if (break_flags & BREAK_FLAGS_NATURAL)
166+
if ((break_flags & BREAK_FLAGS_NATURAL) != 0)
167167
{
168168
txt = HigUtil::create_alert_text(_("Natural rest break"), _("This is your natural rest break."));
169169
}

ui/applets/common/src/timerbox.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ workrave_timerbox_update_time_bars(WorkraveTimerbox *self, cairo_t *cr)
212212

213213
if (priv->enabled)
214214
{
215-
int x = 0, y = 0;
216-
int bar_width, bar_height;
215+
int x = 0;
216+
int y = 0;
217+
int bar_width = 0;
218+
int bar_height = 0;
217219

218220
if (priv->force_icon)
219221
{
@@ -272,7 +274,8 @@ workrave_timerbox_compute_dimensions(WorkraveTimerbox *self, int *width, int *he
272274
{
273275
WorkraveTimerboxPrivate *priv = workrave_timerbox_get_instance_private(self);
274276

275-
int bar_width, bar_height;
277+
int bar_width = 0;
278+
int bar_height = 0;
276279
workrave_timebar_get_dimensions(priv->slot_to_time_bar[0], &bar_width, &bar_height);
277280

278281
int icon_width = gdk_pixbuf_get_width(priv->break_to_icon[0]);
@@ -390,8 +393,8 @@ workrave_timerbox_draw(WorkraveTimerbox *self, cairo_t *cr)
390393
int
391394
workrave_timerbox_get_width(WorkraveTimerbox *self)
392395
{
393-
int width;
394-
int height;
396+
int width = 0;
397+
int height = 0;
395398
workrave_timerbox_compute_dimensions(self, &width, &height);
396399
return width;
397400
}
@@ -406,8 +409,8 @@ workrave_timerbox_get_width(WorkraveTimerbox *self)
406409
int
407410
workrave_timerbox_get_height(WorkraveTimerbox *self)
408411
{
409-
int width;
410-
int height;
412+
int width = 0;
413+
int height = 0;
411414
workrave_timerbox_compute_dimensions(self, &width, &height);
412415
return height;
413416
}

0 commit comments

Comments
 (0)