Skip to content

Commit 444f4d7

Browse files
committed
Fix gint formatting
1 parent 63e6e88 commit 444f4d7

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

src/dunst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static gboolean run(void *data)
164164
gint64 sleep = timeout_at - now;
165165
sleep = MAX(sleep, 1000); // Sleep at least 1ms
166166

167-
LOG_D("Sleeping for %li ms", sleep/1000);
167+
LOG_D("Sleeping for %"G_GINT64_FORMAT" ms", sleep/1000);
168168

169169
next_timeout_id = g_timeout_add(sleep/1000, run, NULL);
170170
}

src/notification.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ void notification_print(const struct notification *n)
6161
printf("\ticon_id: '%s'\n", STR_NN(n->icon_id));
6262
printf("\tdesktop_entry: '%s'\n", n->desktop_entry ? n->desktop_entry : "");
6363
printf("\tcategory: %s\n", STR_NN(n->category));
64-
printf("\ttimeout: %ld\n", n->timeout/1000);
65-
printf("\tstart: %ld\n", n->start);
66-
printf("\ttimestamp: %ld\n", n->timestamp);
64+
printf("\ttimeout: %"G_GINT64_FORMAT"\n", n->timeout/1000);
65+
printf("\tstart: %"G_GINT64_FORMAT"\n", n->start);
66+
printf("\ttimestamp: %"G_GINT64_FORMAT"\n", n->timestamp);
6767
printf("\turgency: %s\n", notification_urgency_to_string(n->urgency));
6868
printf("\ttransient: %d\n", n->transient);
6969
printf("\tformatted: '%s'\n", STR_NN(n->msg));
@@ -148,8 +148,8 @@ void notification_run_script(struct notification *n)
148148
// Set environment variables
149149
gchar *n_id_str = g_strdup_printf("%i", n->id);
150150
gchar *n_progress_str = g_strdup_printf("%i", n->progress);
151-
gchar *n_timeout_str = g_strdup_printf("%li", n->timeout/1000);
152-
gchar *n_timestamp_str = g_strdup_printf("%li", n->timestamp / 1000);
151+
gchar *n_timeout_str = g_strdup_printf("%"G_GINT64_FORMAT, n->timeout/1000);
152+
gchar *n_timestamp_str = g_strdup_printf("%"G_GINT64_FORMAT, n->timestamp / 1000);
153153
safe_setenv("DUNST_APP_NAME", appname);
154154
safe_setenv("DUNST_SUMMARY", summary);
155155
safe_setenv("DUNST_BODY", body);
@@ -725,15 +725,14 @@ void notification_update_text_to_render(struct notification *n)
725725

726726
char *new_buf;
727727
if (hours > 0) {
728-
new_buf =
729-
g_strdup_printf("%s (%ldh %ldm %lds old)", buf, hours,
730-
minutes, seconds);
728+
new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"h %"G_GINT64_FORMAT"m %"G_GINT64_FORMAT"s old)",
729+
buf, hours, minutes, seconds);
731730
} else if (minutes > 0) {
732-
new_buf =
733-
g_strdup_printf("%s (%ldm %lds old)", buf, minutes,
734-
seconds);
731+
new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"m %"G_GINT64_FORMAT"s old)",
732+
buf, minutes, seconds);
735733
} else {
736-
new_buf = g_strdup_printf("%s (%lds old)", buf, seconds);
734+
new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"s old)",
735+
buf, seconds);
737736
}
738737

739738
g_free(buf);

src/notification.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct notification_colors {
4747

4848
struct notification {
4949
NotificationPrivate *priv;
50-
int id;
50+
gint id;
5151
char *dbus_client;
5252
bool dbus_valid;
5353

src/rules.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ void rule_print(const struct rule *r)
150150
if (r->msg_urgency != URG_NONE) printf("\tmsg_urgency: '%s'\n", notification_urgency_to_string(r->msg_urgency));
151151
if (r->stack_tag != NULL) printf("\tstack_tag: '%s'\n", r->stack_tag);
152152
if (r->desktop_entry != NULL) printf("\tdesktop_entry: '%s'\n", r->desktop_entry);
153-
if (r->match_dbus_timeout != -1) printf("\tmatch_dbus_timeout: %ld\n", r->match_dbus_timeout);
153+
if (r->match_dbus_timeout != -1) printf("\tmatch_dbus_timeout: %"G_GINT64_FORMAT"\n", r->match_dbus_timeout);
154154
if (r->match_transient != -1) printf("\tmatch_transient: %d\n", r->match_transient);
155155

156156
// modifiers
157-
if (r->timeout != -1) printf("\ttimeout: %ld\n", r->timeout);
158-
if (r->override_dbus_timeout != -1) printf("\toverride_dbus_timeout: %ld\n", r->override_dbus_timeout);
157+
if (r->timeout != -1) printf("\ttimeout: %"G_GINT64_FORMAT"\n", r->timeout);
158+
if (r->override_dbus_timeout != -1) printf("\toverride_dbus_timeout: %"G_GINT64_FORMAT"\n", r->override_dbus_timeout);
159159
if (r->markup != -1) printf("\tmarkup: %d\n", r->markup);
160160
if (r->action_name != NULL) printf("\taction_name: '%s'\n", r->action_name);
161161
if (r->urgency != URG_NONE) printf("\turgency: '%s'\n", notification_urgency_to_string(r->urgency));

src/settings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static GPtrArray* get_conf_files(void) {
115115
GPtrArray *config_locations = get_xdg_conf_basedirs();
116116
GPtrArray *config_files = g_ptr_array_new_full(3, g_free);
117117
char *dunstrc_location = NULL;
118-
for (int i = 0; i < config_locations->len; i++) {
118+
for (size_t i = 0; i < config_locations->len; i++) {
119119
dunstrc_location = g_build_filename(config_locations->pdata[i],
120120
"dunstrc", NULL);
121121
LOG_D("Trying config location: %s", dunstrc_location);

test/dbus.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ TEST test_hint_transient(void)
812812
ASSERT(dbus_notification_fire(n_dbus, &id));
813813
ASSERT(id != 0);
814814

815-
snprintf(msg, sizeof(msg), "In round %ld", i);
815+
snprintf(msg, sizeof(msg), "In round %zu", i);
816816
ASSERT_EQm(msg, queues_length_waiting(), len+1);
817817

818818
n = queues_debug_find_notification_by_id(id);
@@ -857,12 +857,12 @@ TEST test_hint_progress(void)
857857
ASSERT(dbus_notification_fire(n_dbus, &id));
858858
ASSERT(id != 0);
859859

860-
snprintf(msg, sizeof(msg), "In round %ld", i);
860+
snprintf(msg, sizeof(msg), "In round %zu", i);
861861
ASSERT_EQm(msg, queues_length_waiting(), len+1);
862862

863863
n = queues_debug_find_notification_by_id(id);
864864

865-
snprintf(msg, sizeof(msg), "In round %ld progress should be %i, but is %i", i, n->progress, values[i]);
865+
snprintf(msg, sizeof(msg), "In round %zu progress should be %i, but is %i", i, n->progress, values[i]);
866866
ASSERT_EQm(msg, values[i], n->progress);
867867
}
868868

@@ -1004,7 +1004,7 @@ TEST test_hint_urgency(void)
10041004

10051005
n = queues_debug_find_notification_by_id(id);
10061006

1007-
snprintf(msg, sizeof(msg), "In round %ld", i);
1007+
snprintf(msg, sizeof(msg), "In round %zu", i);
10081008
ASSERT_EQm(msg, values[i], n->urgency);
10091009

10101010
queues_notification_close_id(id, REASON_UNDEF);

0 commit comments

Comments
 (0)