Skip to content

Commit

Permalink
Clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcaelers committed Nov 25, 2023
1 parent 6a33df9 commit 3d10dde
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
7 changes: 3 additions & 4 deletions ui/app/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "ui/IBreakWindow.hh"
#include "ui/Plugin.hh"
#include "ui/IToolkitFactory.hh"
#include "commonui/nls.h"
#include "commonui/Locale.hh"
#include "commonui/Text.hh"
#include "utils/Exception.hh"
Expand Down Expand Up @@ -593,7 +592,7 @@ Application::get_timers_tooltip()

for (int count = 0; count < BREAK_ID_SIZEOF; count++)
{
auto b = core->get_break(BreakId(count));
auto *b = core->get_break(BreakId(count));
bool on = b->is_enabled();

if (b != nullptr && on)
Expand Down Expand Up @@ -648,7 +647,7 @@ Application::on_idle_changed(bool new_idle)
if (new_idle && !is_idle)
{
TRACE_MSG("Now idle");
auto rest_break = core->get_break(BREAK_ID_REST_BREAK);
auto *rest_break = core->get_break(BREAK_ID_REST_BREAK);

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

auto rest_break = core->get_break(BREAK_ID_REST_BREAK);
auto *rest_break = core->get_break(BREAK_ID_REST_BREAK);

if (core->get_regular_operation_mode() == OperationMode::Normal
&& rest_break->get_elapsed_idle_time() < rest_break->get_auto_reset() && rest_break->is_enabled()
Expand Down
6 changes: 3 additions & 3 deletions ui/app/toolkits/gtkmm/RestBreakWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Gtk::Widget *
RestBreakWindow::create_gui()
{
// Add other widgets.
Gtk::VBox *vbox = new Gtk::VBox(false, 6);
auto *vbox = new Gtk::VBox(false, 6);

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

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

Gtk::Box *bottom_box = create_bottom_box(true, GUIConfig::break_enable_shutdown(BREAK_ID_REST_BREAK)());
if (bottom_box)
if (bottom_box != nullptr)
{
vbox->pack_end(*Gtk::manage(bottom_box), Gtk::PACK_SHRINK, 6);
}
Expand Down Expand Up @@ -163,7 +163,7 @@ RestBreakWindow::create_info_panel()
Gtk::Label *info_lab = Gtk::manage(new Gtk::Label());
Glib::ustring txt;

if (break_flags & BREAK_FLAGS_NATURAL)
if ((break_flags & BREAK_FLAGS_NATURAL) != 0)
{
txt = HigUtil::create_alert_text(_("Natural rest break"), _("This is your natural rest break."));
}
Expand Down
17 changes: 10 additions & 7 deletions ui/applets/common/src/timerbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ workrave_timerbox_update_time_bars(WorkraveTimerbox *self, cairo_t *cr)

if (priv->enabled)
{
int x = 0, y = 0;
int bar_width, bar_height;
int x = 0;
int y = 0;
int bar_width = 0;
int bar_height = 0;

if (priv->force_icon)
{
Expand Down Expand Up @@ -272,7 +274,8 @@ workrave_timerbox_compute_dimensions(WorkraveTimerbox *self, int *width, int *he
{
WorkraveTimerboxPrivate *priv = workrave_timerbox_get_instance_private(self);

int bar_width, bar_height;
int bar_width = 0;
int bar_height = 0;
workrave_timebar_get_dimensions(priv->slot_to_time_bar[0], &bar_width, &bar_height);

int icon_width = gdk_pixbuf_get_width(priv->break_to_icon[0]);
Expand Down Expand Up @@ -390,8 +393,8 @@ workrave_timerbox_draw(WorkraveTimerbox *self, cairo_t *cr)
int
workrave_timerbox_get_width(WorkraveTimerbox *self)
{
int width;
int height;
int width = 0;
int height = 0;
workrave_timerbox_compute_dimensions(self, &width, &height);
return width;
}
Expand All @@ -406,8 +409,8 @@ workrave_timerbox_get_width(WorkraveTimerbox *self)
int
workrave_timerbox_get_height(WorkraveTimerbox *self)
{
int width;
int height;
int width = 0;
int height = 0;
workrave_timerbox_compute_dimensions(self, &width, &height);
return height;
}
Expand Down

0 comments on commit 3d10dde

Please sign in to comment.