Skip to content

Commit

Permalink
(Minor) Fix format specifiers to match types
Browse files Browse the repository at this point in the history
The `size_t` format specifier is `%zu` and the
`gtk_get_*_version()` functions return `guint`,
to be printed with `%u`. The changes reflect this.
  • Loading branch information
createyourpersonalaccount authored and Technius committed Sep 16, 2021
1 parent 466082d commit f59c3c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/control/xml/SizeTAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SizeTAttribute::SizeTAttribute(const char* name, size_t value): XMLAttribute(nam
SizeTAttribute::~SizeTAttribute() = default;

void SizeTAttribute::writeOut(OutputStream* out) {
char* str = g_strdup_printf("%ull", value);
char* str = g_strdup_printf("%zu", value);
out->write(str);
g_free(str);
}
2 changes: 1 addition & 1 deletion src/gui/dialog/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AboutDialog::AboutDialog(GladeSearchpath* gladeSearchPath): GladeGui(gladeSearch
gtk_label_set_markup(GTK_LABEL(get("lbRevId")), GIT_COMMIT_ID);

char gtkVersion[10];
sprintf(gtkVersion, "%d.%d.%d", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());
sprintf(gtkVersion, "%u.%u.%u", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());

gtk_label_set_markup(GTK_LABEL(get("lbGtkVersion")), gtkVersion);

Expand Down
2 changes: 1 addition & 1 deletion src/model/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ auto Document::fillPageLabels(GtkTreeModel* treeModel, GtkTreePath* path, GtkTre

gchar* pageLabel = nullptr;
if (page != npos) {
pageLabel = g_strdup_printf("%lu", page + 1);
pageLabel = g_strdup_printf("%zu", page + 1);
}
gtk_tree_store_set(GTK_TREE_STORE(treeModel), iter, DOCUMENT_LINKS_COLUMN_PAGE_NUMBER, pageLabel, -1);
g_free(pageLabel);
Expand Down

0 comments on commit f59c3c4

Please sign in to comment.