[gnome-software] Add two new GCC warnings and fix up signed/unsigned issues
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add two new GCC warnings and fix up signed/unsigned issues
- Date: Mon, 25 Jul 2016 09:43:41 +0000 (UTC)
commit a908881f5f5ceec36740d383ba18b7e4c55d800a
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 25 10:43:12 2016 +0100
Add two new GCC warnings and fix up signed/unsigned issues
configure.ac | 2 +
src/gs-app-list.c | 8 +-
src/gs-app.c | 26 ++++----
src/gs-category.c | 10 ++--
src/gs-cmd.c | 8 +-
src/gs-common.c | 4 +-
src/gs-debug.c | 2 +-
src/gs-hiding-box.c | 9 +--
src/gs-history-dialog.c | 6 +-
src/gs-plugin-loader.c | 25 ++++----
src/gs-plugin-loader.h | 4 +-
src/gs-plugin.c | 12 ++--
src/gs-plugin.h | 72 +++++++++++-------------
src/gs-progress-button.c | 2 +-
src/gs-removal-dialog.c | 2 +-
src/gs-review-histogram.c | 4 +-
src/gs-screenshot-image.c | 24 ++++----
src/gs-self-test.c | 9 ++-
src/gs-shell-details.c | 12 ++--
src/gs-shell-extras.c | 8 +-
src/gs-shell-installed.c | 2 +-
src/gs-shell-loading.c | 2 +-
src/gs-shell-overview.c | 10 ++--
src/gs-shell-search.c | 4 +-
src/gs-shell-updates.c | 4 +-
src/gs-shell.c | 2 +-
src/gs-sources-dialog.c | 16 +++---
src/gs-star-widget.c | 2 +-
src/gs-update-dialog.c | 2 +-
src/gs-update-monitor.c | 6 +-
src/gs-utils.c | 4 +-
src/plugins/gs-appstream.c | 6 +-
src/plugins/gs-flatpak.c | 13 ++--
src/plugins/gs-markdown.c | 8 +-
src/plugins/gs-plugin-appstream.c | 6 +-
src/plugins/gs-plugin-dpkg.c | 2 +-
src/plugins/gs-plugin-epiphany.c | 2 +-
src/plugins/gs-plugin-fedora-distro-upgrades.c | 16 +++---
src/plugins/gs-plugin-fwupd.c | 4 +-
src/plugins/gs-plugin-hardcoded-featured.c | 2 +-
src/plugins/gs-plugin-hardcoded-popular.c | 2 +-
src/plugins/gs-plugin-icons.c | 10 ++-
src/plugins/gs-plugin-key-colors.c | 6 +-
src/plugins/gs-plugin-odrs.c | 26 ++++----
src/plugins/gs-plugin-packagekit-history.c | 2 +-
src/plugins/gs-plugin-packagekit-local.c | 4 +-
src/plugins/gs-plugin-packagekit-proxy.c | 4 +-
src/plugins/gs-plugin-packagekit-refine.c | 2 +-
src/plugins/gs-plugin-packagekit-upgrade.c | 2 +-
src/plugins/gs-plugin-packagekit.c | 2 +-
src/plugins/gs-plugin-shell-extensions.c | 22 ++++----
src/plugins/gs-plugin-snap.c | 16 +++---
src/plugins/gs-plugin-steam.c | 26 +++++----
src/plugins/gs-plugin-ubuntu-reviews.c | 12 ++--
src/plugins/gs-snapd.c | 14 +++--
55 files changed, 260 insertions(+), 252 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d474b31..7448c90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,8 @@ GNOME_COMPILE_WARNINGS([maximum],[
-Wmissing-parameter-type
-Woverride-init
-Wno-discarded-qualifiers
+ -Wconversion
+ -Wformat-signedness
])
dnl ---------------------------------------------------------------------------
diff --git a/src/gs-app-list.c b/src/gs-app-list.c
index e7b9169..da3d851 100644
--- a/src/gs-app-list.c
+++ b/src/gs-app-list.c
@@ -226,12 +226,12 @@ gs_app_list_randomize (GsAppList *list)
key = g_strdup_printf ("Plugin::sort-key[%p]", list);
rand = g_rand_new ();
date = g_date_time_new_now_utc ();
- g_rand_set_seed (rand, g_date_time_get_day_of_year (date));
+ g_rand_set_seed (rand, (guint32) g_date_time_get_day_of_year (date));
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
- sort_key[0] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
- sort_key[1] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
- sort_key[2] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ sort_key[0] = (gchar) g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ sort_key[1] = (gchar) g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ sort_key[2] = (gchar) g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
gs_app_set_metadata (app, key, sort_key);
}
g_ptr_array_sort_with_data (list->array, gs_app_list_randomize_cb, list);
diff --git a/src/gs-app.c b/src/gs-app.c
index 2f750ba..1484dba 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -137,7 +137,7 @@ G_DEFINE_TYPE (GsApp, gs_app, G_TYPE_OBJECT)
static void
gs_app_kv_lpad (GString *str, const gchar *key, const gchar *value)
{
- guint i;
+ gsize i;
g_string_append_printf (str, " %s:", key);
for (i = strlen (key); i < 18; i++)
g_string_append (str, " ");
@@ -251,7 +251,7 @@ gs_app_to_string (GsApp *app)
gs_app_kv_lpad (str, "quirk", qstr);
}
if (app->progress > 0)
- gs_app_kv_printf (str, "progress", "%i%%", app->progress);
+ gs_app_kv_printf (str, "progress", "%u%%", app->progress);
if (app->id != NULL)
gs_app_kv_lpad (str, "id", app->id);
if ((app->kudos & GS_APP_KUDO_MY_LANGUAGE) > 0)
@@ -286,7 +286,7 @@ gs_app_to_string (GsApp *app)
gs_app_kv_lpad (str, "kudo", "sandboxed");
if ((app->kudos & GS_APP_KUDO_SANDBOXED_SECURE) > 0)
gs_app_kv_lpad (str, "kudo", "sandboxed-secure");
- gs_app_kv_printf (str, "kudo-percentage", "%i",
+ gs_app_kv_printf (str, "kudo-percentage", "%u",
gs_app_get_kudos_percentage (app));
if (app->name != NULL)
gs_app_kv_lpad (str, "name", app->name);
@@ -310,7 +310,7 @@ gs_app_to_string (GsApp *app)
if (app->match_value != 0)
gs_app_kv_printf (str, "match-value", "%05x", app->match_value);
if (app->priority != 0)
- gs_app_kv_printf (str, "priority", "%i", app->priority);
+ gs_app_kv_printf (str, "priority", "%u", app->priority);
if (app->version != NULL)
gs_app_kv_lpad (str, "version", app->version);
if (app->version_ui != NULL)
@@ -322,7 +322,7 @@ gs_app_to_string (GsApp *app)
if (app->update_details != NULL)
gs_app_kv_lpad (str, "update-details", app->update_details);
if (app->update_urgency != AS_URGENCY_KIND_UNKNOWN) {
- gs_app_kv_printf (str, "update-urgency", "%i",
+ gs_app_kv_printf (str, "update-urgency", "%u",
app->update_urgency);
}
if (app->summary != NULL)
@@ -336,7 +336,7 @@ gs_app_to_string (GsApp *app)
im = as_screenshot_get_image (ss, 0, 0);
if (im == NULL)
continue;
- key = g_strdup_printf ("screenshot-%02i", i);
+ key = g_strdup_printf ("screenshot-%02u", i);
gs_app_kv_printf (str, key, "%s [%s]",
as_image_get_url (im),
tmp != NULL ? tmp : "<none>");
@@ -344,13 +344,13 @@ gs_app_to_string (GsApp *app)
for (i = 0; i < app->sources->len; i++) {
g_autofree gchar *key = NULL;
tmp = g_ptr_array_index (app->sources, i);
- key = g_strdup_printf ("source-%02i", i);
+ key = g_strdup_printf ("source-%02u", i);
gs_app_kv_lpad (str, key, tmp);
}
for (i = 0; i < app->source_ids->len; i++) {
g_autofree gchar *key = NULL;
tmp = g_ptr_array_index (app->source_ids, i);
- key = g_strdup_printf ("source-id-%02i", i);
+ key = g_strdup_printf ("source-id-%02u", i);
gs_app_kv_lpad (str, key, tmp);
}
if (app->local_file != NULL) {
@@ -386,12 +386,12 @@ gs_app_to_string (GsApp *app)
if (app->review_ratings != NULL) {
for (i = 0; i < app->review_ratings->len; i++) {
gint rat = g_array_index (app->review_ratings, gint, i);
- gs_app_kv_printf (str, "review-rating", "[%i:%i]",
+ gs_app_kv_printf (str, "review-rating", "[%u:%i]",
i, rat);
}
}
if (app->reviews != NULL)
- gs_app_kv_printf (str, "reviews", "%i", app->reviews->len);
+ gs_app_kv_printf (str, "reviews", "%u", app->reviews->len);
if (app->install_date != 0) {
gs_app_kv_printf (str, "install-date", "%"
G_GUINT64_FORMAT "",
@@ -408,9 +408,9 @@ gs_app_to_string (GsApp *app)
app->size_download / 1024);
}
if (app->related->len > 0)
- gs_app_kv_printf (str, "related", "%i", app->related->len);
+ gs_app_kv_printf (str, "related", "%u", app->related->len);
if (app->history->len > 0)
- gs_app_kv_printf (str, "history", "%i", app->history->len);
+ gs_app_kv_printf (str, "history", "%u", app->history->len);
for (i = 0; i < app->categories->len; i++) {
tmp = g_ptr_array_index (app->categories, i);
gs_app_kv_lpad (str, "category", tmp);
@@ -418,7 +418,7 @@ gs_app_to_string (GsApp *app)
for (i = 0; i < app->key_colors->len; i++) {
GdkRGBA *color = g_ptr_array_index (app->key_colors, i);
g_autofree gchar *key = NULL;
- key = g_strdup_printf ("key-color-%02i", i);
+ key = g_strdup_printf ("key-color-%02u", i);
gs_app_kv_printf (str, key, "%.0f,%.0f,%.0f",
color->red * 255.f,
color->green * 255.f,
diff --git a/src/gs-category.c b/src/gs-category.c
index d6816d1..5018b56 100644
--- a/src/gs-category.c
+++ b/src/gs-category.c
@@ -75,11 +75,11 @@ gs_category_to_string (GsCategory *category)
g_string_append_printf (str, " icon: %s\n",
category->icon);
}
- g_string_append_printf (str, " size: %i\n",
+ g_string_append_printf (str, " size: %u\n",
category->size);
- g_string_append_printf (str, " key-colors: %i\n",
+ g_string_append_printf (str, " key-colors: %u\n",
category->key_colors->len);
- g_string_append_printf (str, " desktop-groups: %i\n",
+ g_string_append_printf (str, " desktop-groups: %u\n",
category->desktop_groups->len);
if (category->parent != NULL) {
g_string_append_printf (str, " parent: %s\n",
@@ -87,7 +87,7 @@ gs_category_to_string (GsCategory *category)
}
g_string_append_printf (str, " score: %i\n", category->score);
if (category->children->len == 0) {
- g_string_append_printf (str, " children: %i\n",
+ g_string_append_printf (str, " children: %u\n",
category->children->len);
} else {
g_string_append (str, " children:\n");
@@ -455,7 +455,7 @@ gs_category_get_sort_key (GsCategory *category)
sort_order = 2;
else if (g_strcmp0 (gs_category_get_id (category), "other") == 0)
sort_order = 9;
- return g_strdup_printf ("%i:%s",
+ return g_strdup_printf ("%u:%s",
sort_order,
gs_category_get_name (category));
}
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 48d34f6..795fb38 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -57,11 +57,11 @@ gs_cmd_show_results_apps (GsAppList *list)
static gchar *
gs_cmd_pad_spaces (const gchar *text, guint length)
{
- guint i;
+ gsize i;
GString *str;
str = g_string_sized_new (length + 1);
g_string_append (str, text);
- for (i = strlen(text); i < length; i++)
+ for (i = strlen (text); i < length; i++)
g_string_append_c (str, ' ');
return g_string_free (str, FALSE);
}
@@ -80,7 +80,7 @@ gs_cmd_show_results_categories (GPtrArray *list)
parent = gs_category_get_parent (cat);
if (parent != NULL){
g_autofree gchar *id = NULL;
- id = g_strdup_printf ("%s/%s [%i]",
+ id = g_strdup_printf ("%s/%s [%u]",
gs_category_get_id (parent),
gs_category_get_id (cat),
gs_category_get_size (cat));
@@ -194,7 +194,7 @@ main (int argc, char **argv)
gboolean verbose = FALSE;
guint64 refine_flags = GS_PLUGIN_REFINE_FLAGS_DEFAULT;
gint i;
- gint cache_age = 0;
+ guint cache_age = 0;
gint repeat = 1;
int status = 0;
g_auto(GStrv) plugin_blacklist = NULL;
diff --git a/src/gs-common.c b/src/gs-common.c
index 9e7c026..5fb5371 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -620,7 +620,7 @@ gs_utils_widget_css_parsing_error_cb (GtkCssProvider *provider,
GError *error,
gpointer user_data)
{
- g_warning ("CSS parse error %i:%i: %s",
+ g_warning ("CSS parse error %u:%u: %s",
gtk_css_section_get_start_line (section),
gtk_css_section_get_start_position (section),
error->message);
@@ -694,7 +694,7 @@ gs_utils_widget_set_css_app (GsApp *app,
GdkRGBA *color = g_ptr_array_index (key_colors, 1);
g_autofree gchar *key = NULL;
g_autofree gchar *value = NULL;
- key = g_strdup_printf ("@keycolor-%02i@", i);
+ key = g_strdup_printf ("@keycolor-%02u@", i);
value = g_strdup_printf ("rgb(%.0f,%.0f,%.0f)",
color->red * 255.f,
color->green * 255.f,
diff --git a/src/gs-debug.c b/src/gs-debug.c
index c220ea8..22b2b84 100644
--- a/src/gs-debug.c
+++ b/src/gs-debug.c
@@ -44,7 +44,7 @@ gs_debug_handler_cb (const gchar *log_domain,
gpointer user_data)
{
GsDebug *debug = (GsDebug *) user_data;
- guint i;
+ gsize i;
g_autofree gchar *tmp = NULL;
g_autoptr(GString) domain = NULL;
g_autoptr(GMutexLocker) locker = NULL;
diff --git a/src/gs-hiding-box.c b/src/gs-hiding-box.c
index 0822be4..1e8d47d 100644
--- a/src/gs-hiding-box.c
+++ b/src/gs-hiding-box.c
@@ -36,7 +36,7 @@ struct _GsHidingBox
GtkContainer parent_instance;
GList *children;
- gint16 spacing;
+ gint spacing;
};
static void
@@ -150,7 +150,7 @@ static void
gs_hiding_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
GsHidingBox *box = GS_HIDING_BOX (widget);
- gint nvis_children;
+ gint nvis_children = 0;
GtkTextDirection direction;
GtkAllocation child_allocation;
@@ -168,14 +168,13 @@ gs_hiding_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gtk_widget_set_allocation (widget, allocation);
- nvis_children = 0;
for (child = box->children; child != NULL; child = child->next) {
if (gtk_widget_get_visible (child->data))
++nvis_children;
}
/* If there is no visible child, simply return. */
- if (nvis_children <= 0)
+ if (nvis_children == 0)
return;
direction = gtk_widget_get_direction (widget);
@@ -219,7 +218,7 @@ gs_hiding_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
nvis_children = i;
/* Bring children up to size first */
- size = gtk_distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
+ size = gtk_distribute_natural_allocation (MAX (0, size), (guint) nvis_children, sizes);
/* Only now we can subtract the spacings */
size -= (nvis_children - 1) * spacing;
diff --git a/src/gs-history-dialog.c b/src/gs-history-dialog.c
index 287dbd1..9b4a66f 100644
--- a/src/gs-history-dialog.c
+++ b/src/gs-history-dialog.c
@@ -44,8 +44,8 @@ G_DEFINE_TYPE (GsHistoryDialog, gs_history_dialog, GTK_TYPE_DIALOG)
static gint
history_sort_cb (gconstpointer a, gconstpointer b)
{
- gint64 timestamp_a = gs_app_get_install_date (*(GsApp **) a);
- gint64 timestamp_b = gs_app_get_install_date (*(GsApp **) b);
+ guint64 timestamp_a = gs_app_get_install_date (*(GsApp **) a);
+ guint64 timestamp_b = gs_app_get_install_date (*(GsApp **) b);
if (timestamp_a < timestamp_b)
return 1;
if (timestamp_a > timestamp_b)
@@ -114,7 +114,7 @@ gs_history_dialog_set_app (GsHistoryDialog *dialog, GsApp *app)
/* add the timestamp */
timestamp = gs_app_get_install_date (app);
- datetime = g_date_time_new_from_unix_utc (timestamp);
+ datetime = g_date_time_new_from_unix_utc ((gint) timestamp);
if (timestamp == GS_APP_INSTALL_DATE_UNKNOWN) {
date_str = g_strdup ("");
} else {
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index b44284d..c5a05c7 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -53,7 +53,7 @@ typedef struct
GSettings *settings;
gchar **compatible_projects;
- gint scale;
+ guint scale;
guint updates_changed_id;
guint reload_id;
@@ -2899,7 +2899,7 @@ save_install_queue (GsPluginLoader *plugin_loader)
s = g_string_new ("");
pending_apps = priv->pending_apps;
g_mutex_lock (&priv->pending_apps_mutex);
- for (i = pending_apps->len - 1; i >= 0; i--) {
+ for (i = (gint) pending_apps->len - 1; i >= 0; i--) {
GsApp *app;
app = g_ptr_array_index (pending_apps, i);
if (gs_app_get_state (app) == AS_APP_STATE_QUEUED_FOR_INSTALL) {
@@ -2915,7 +2915,7 @@ save_install_queue (GsPluginLoader *plugin_loader)
"install-queue",
NULL);
g_debug ("saving install queue to %s", file);
- ret = g_file_set_contents (file, s->str, s->len, &error);
+ ret = g_file_set_contents (file, s->str, (gssize) s->len, &error);
if (!ret)
g_warning ("failed to save install queue: %s", error->message);
}
@@ -3456,7 +3456,7 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
}
void
-gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader, gint scale)
+gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader, guint scale)
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
GsPlugin *plugin;
@@ -3470,7 +3470,7 @@ gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader, gint scale)
}
}
-gint
+guint
gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader)
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
@@ -3628,8 +3628,8 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
if (!gs_plugin_get_enabled (dep))
continue;
if (gs_plugin_get_order (plugin) <= gs_plugin_get_order (dep)) {
- g_debug ("%s [%i] to be ordered after %s [%i] "
- "so promoting to [%i]",
+ g_debug ("%s [%u] to be ordered after %s [%u] "
+ "so promoting to [%u]",
gs_plugin_get_name (plugin),
gs_plugin_get_order (plugin),
gs_plugin_get_name (dep),
@@ -3657,8 +3657,8 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
if (!gs_plugin_get_enabled (dep))
continue;
if (gs_plugin_get_order (plugin) >= gs_plugin_get_order (dep)) {
- g_debug ("%s [%i] to be ordered before %s [%i] "
- "so promoting to [%i]",
+ g_debug ("%s [%u] to be ordered before %s [%u] "
+ "so promoting to [%u]",
gs_plugin_get_name (plugin),
gs_plugin_get_order (plugin),
gs_plugin_get_name (dep),
@@ -3725,8 +3725,8 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
if (!gs_plugin_get_enabled (dep))
continue;
if (gs_plugin_get_priority (plugin) <= gs_plugin_get_priority (dep)) {
- g_debug ("%s [%i] is better than %s [%i] "
- "so promoting to [%i]",
+ g_debug ("%s [%u] is better than %s [%u] "
+ "so promoting to [%u]",
gs_plugin_get_name (plugin),
gs_plugin_get_priority (plugin),
gs_plugin_get_name (dep),
@@ -3804,7 +3804,7 @@ gs_plugin_loader_dump_state (GsPluginLoader *plugin_loader)
/* print what the priorities are */
for (i = 0; i < priv->plugins->len; i++) {
plugin = g_ptr_array_index (priv->plugins, i);
- g_debug ("[%s]\t%i\t->\t%s",
+ g_debug ("[%s]\t%u\t->\t%s",
gs_plugin_get_enabled (plugin) ? "enabled" : "disabld",
gs_plugin_get_order (plugin),
gs_plugin_get_name (plugin));
@@ -4118,6 +4118,7 @@ gs_plugin_loader_refresh_thread_cb (GTask *task,
/**
* gs_plugin_loader_refresh_async:
+ * @cache_age, the age in seconds, or %G_MAXUINT for "any"
*
* This method calls all plugins that implement the gs_plugin_refresh()
* function.
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 1214d53..3b07f7a 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -194,9 +194,9 @@ void gs_plugin_loader_set_location (GsPluginLoader
*plugin_loader,
const gchar *location);
GsAuth *gs_plugin_loader_get_auth_by_id (GsPluginLoader *plugin_loader,
const gchar *provider_id);
-gint gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader);
+guint gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader);
void gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader,
- gint scale);
+ guint scale);
void gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginRefineFlags flags,
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index fe1fb3f..a596089 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -68,7 +68,7 @@ typedef struct
gchar *locale; /* allow-none */
gchar *language; /* allow-none */
gchar *name;
- gint scale;
+ guint scale;
guint order;
guint priority;
guint timer_id;
@@ -264,7 +264,7 @@ gs_plugin_action_delay_cb (gpointer user_data)
g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->timer_mutex);
g_debug ("plugin no longer recently active: %s", priv->name);
- priv->flags &= ~GS_PLUGIN_FLAGS_RECENT;
+ priv->flags &= ~(guint64) GS_PLUGIN_FLAGS_RECENT;
priv->timer_id = 0;
return FALSE;
}
@@ -899,7 +899,7 @@ gs_plugin_download_chunk_cb (SoupMessage *msg, SoupBuffer *chunk,
/* if it's returning "Found" or an error, ignore the percentage */
if (msg->status_code != SOUP_STATUS_OK) {
- g_debug ("ignoring status code %i (%s)",
+ g_debug ("ignoring status code %u (%s)",
msg->status_code, msg->reason_phrase);
return;
}
@@ -913,8 +913,8 @@ gs_plugin_download_chunk_cb (SoupMessage *msg, SoupBuffer *chunk,
return;
/* calulate percentage */
- percentage = (100 * body_length) / header_size;
- g_debug ("%s progress: %i%%", gs_app_get_id (helper->app), percentage);
+ percentage = (guint) ((100 * body_length) / header_size);
+ g_debug ("%s progress: %u%%", gs_app_get_id (helper->app), percentage);
gs_app_set_progress (helper->app, percentage);
gs_plugin_status_update (helper->plugin,
helper->app,
@@ -971,7 +971,7 @@ gs_plugin_download_data (GsPlugin *plugin,
return NULL;
}
return g_bytes_new (msg->response_body->data,
- msg->response_body->length);
+ (gsize) msg->response_body->length);
}
/**
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 61c9966..45b4b9f 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -88,15 +88,12 @@ typedef enum {
*
* The flags for the plugin at this point in time.
**/
-typedef enum {
- GS_PLUGIN_FLAGS_NONE = 0,
- GS_PLUGIN_FLAGS_RUNNING_SELF = 1 << 0,
- GS_PLUGIN_FLAGS_RUNNING_OTHER = 1 << 1,
- GS_PLUGIN_FLAGS_EXCLUSIVE = 1 << 2,
- GS_PLUGIN_FLAGS_RECENT = 1 << 3,
- /*< private >*/
- GS_PLUGIN_FLAGS_LAST
-} GsPluginFlags;
+#define GS_PLUGIN_FLAGS_NONE (0u)
+#define GS_PLUGIN_FLAGS_RUNNING_SELF (1u << 0)
+#define GS_PLUGIN_FLAGS_RUNNING_OTHER (1u << 1)
+#define GS_PLUGIN_FLAGS_EXCLUSIVE (1u << 2)
+#define GS_PLUGIN_FLAGS_RECENT (1u << 3)
+typedef guint64 GsPluginFlags;
/**
* GsPluginError:
@@ -161,36 +158,33 @@ typedef enum {
*
* The refine flags.
**/
-typedef enum {
- GS_PLUGIN_REFINE_FLAGS_DEFAULT = 0,
- GS_PLUGIN_REFINE_FLAGS_USE_HISTORY = 1 << 0,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE = 1 << 1,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL = 1 << 2,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION = 1 << 3,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE = 1 << 4,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING = 1 << 5,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION = 1 << 6,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY = 1 << 7,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION = 1 << 8,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS = 1 << 9,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN = 1 << 10,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED = 1 << 11,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH = 1 << 12,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS = 1 << 13,
- GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES = 1 << 14,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_SEVERITY = 1 << 15,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPGRADE_REMOVED = 1 << 16,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE = 1 << 17,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS = 1 << 18,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS = 1 << 19,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS = 1 << 20,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON = 1 << 21,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS = 1 << 22,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME = 1 << 23,
- GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI = 1 << 24,
- /*< private >*/
- GS_PLUGIN_REFINE_FLAGS_LAST
-} GsPluginRefineFlags;
+#define GS_PLUGIN_REFINE_FLAGS_DEFAULT (0u)
+#define GS_PLUGIN_REFINE_FLAGS_USE_HISTORY (1u << 0)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE (1u << 1)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL (1u << 2)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION (1u << 3)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE (1u << 4)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING (1u << 5)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION (1u << 6)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY (1u << 7)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION (1u << 8)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS (1u << 9)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN (1u << 10)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED (1u << 11)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH (1u << 12)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS (1u << 13)
+#define GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES (1u << 14)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_SEVERITY (1u << 15)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPGRADE_REMOVED (1u << 16)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE (1u << 17)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS (1u << 18)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS (1u << 19)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS (1u << 20)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON (1u << 21)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS (1u << 22)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME (1u << 23)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI (1u << 24)
+typedef guint64 GsPluginRefineFlags;
/**
* GsPluginRefreshFlags:
diff --git a/src/gs-progress-button.c b/src/gs-progress-button.c
index 3b025ab..ad55d6a 100644
--- a/src/gs-progress-button.c
+++ b/src/gs-progress-button.c
@@ -42,7 +42,7 @@ gs_progress_button_set_progress (GsProgressButton *button, guint percentage)
else if (percentage == 100)
css = g_strdup (".install-progress { background-size: 100%; }");
else
- css = g_strdup_printf (".install-progress { background-size: %d%%; }", percentage);
+ css = g_strdup_printf (".install-progress { background-size: %u%%; }", percentage);
gtk_css_provider_load_from_data (button->css_provider, css, -1, NULL);
}
diff --git a/src/gs-removal-dialog.c b/src/gs-removal-dialog.c
index 9afa6c0..5685a75 100644
--- a/src/gs-removal-dialog.c
+++ b/src/gs-removal-dialog.c
@@ -137,7 +137,7 @@ gs_removal_dialog_show_upgrade_removals (GsRemovalDialog *self,
if (gs_app_get_state (app) != AS_APP_STATE_UNAVAILABLE)
continue;
tmp = gs_app_to_string (app);
- g_debug ("removal %d: %s", i, tmp);
+ g_debug ("removal %u: %s", i, tmp);
add_app (GTK_LIST_BOX (self->listbox), app);
}
}
diff --git a/src/gs-review-histogram.c b/src/gs-review-histogram.c
index 3f54d96..eda238d 100644
--- a/src/gs-review-histogram.c
+++ b/src/gs-review-histogram.c
@@ -45,10 +45,10 @@ typedef struct
G_DEFINE_TYPE_WITH_PRIVATE (GsReviewHistogram, gs_review_histogram, GTK_TYPE_BIN)
static void
-set_label (GtkWidget *label, guint value)
+set_label (GtkWidget *label, gint value)
{
g_autofree gchar *text = NULL;
- text = g_strdup_printf ("%u", value);
+ text = g_strdup_printf ("%i", value);
gtk_label_set_text (GTK_LABEL (label), text);
}
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index bb34bed..267baa5 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -52,7 +52,7 @@ struct _GsScreenshotImage
gboolean use_desktop_background;
guint width;
guint height;
- gint scale;
+ guint scale;
};
G_DEFINE_TYPE (GsScreenshotImage, gs_screenshot_image, GTK_TYPE_BIN)
@@ -92,7 +92,8 @@ gs_screenshot_image_get_desktop_pixbuf (GsScreenshotImage *ssimg)
gnome_bg_load_from_preferences (bg, settings);
return gnome_bg_create_thumbnail (bg, factory,
gdk_screen_get_default (),
- ssimg->width, ssimg->height);
+ (gint) ssimg->width,
+ (gint) ssimg->height);
#else
return NULL;
#endif
@@ -128,8 +129,8 @@ as_screenshot_show_image (GsScreenshotImage *ssimg)
} else {
/* this is always going to have alpha */
pixbuf = gdk_pixbuf_new_from_file_at_scale (ssimg->filename,
- ssimg->width * ssimg->scale,
- ssimg->height * ssimg->scale,
+ (gint) (ssimg->width * ssimg->scale),
+ (gint) (ssimg->height * ssimg->scale),
FALSE, NULL);
if (pixbuf != NULL) {
if (gs_screenshot_image_use_desktop_background (ssimg, pixbuf)) {
@@ -139,7 +140,8 @@ as_screenshot_show_image (GsScreenshotImage *ssimg)
} else {
gdk_pixbuf_composite (pixbuf, pixbuf_bg,
0, 0,
- ssimg->width, ssimg->height,
+ (gint) ssimg->width,
+ (gint) ssimg->height,
0, 0, 1.0f, 1.0f,
GDK_INTERP_NEAREST, 255);
}
@@ -153,14 +155,14 @@ as_screenshot_show_image (GsScreenshotImage *ssimg)
if (g_strcmp0 (ssimg->current_image, "image1") == 0) {
if (pixbuf_bg != NULL) {
gs_image_set_from_pixbuf_with_scale (GTK_IMAGE (ssimg->image2),
- pixbuf_bg, ssimg->scale);
+ pixbuf_bg, (gint) ssimg->scale);
}
gtk_stack_set_visible_child_name (GTK_STACK (ssimg->stack), "image2");
ssimg->current_image = "image2";
} else {
if (pixbuf_bg != NULL) {
gs_image_set_from_pixbuf_with_scale (GTK_IMAGE (ssimg->image1),
- pixbuf_bg, ssimg->scale);
+ pixbuf_bg, (gint) ssimg->scale);
}
gtk_stack_set_visible_child_name (GTK_STACK (ssimg->stack), "image1");
ssimg->current_image = "image1";
@@ -189,10 +191,10 @@ gs_screenshot_image_show_blurred (GsScreenshotImage *ssimg,
if (g_strcmp0 (ssimg->current_image, "image1") == 0) {
gs_image_set_from_pixbuf_with_scale (GTK_IMAGE (ssimg->image1),
- pb, ssimg->scale);
+ pb, (gint) ssimg->scale);
} else {
gs_image_set_from_pixbuf_with_scale (GTK_IMAGE (ssimg->image2),
- pb, ssimg->scale);
+ pb, (gint) ssimg->scale);
}
}
@@ -290,7 +292,7 @@ gs_screenshot_image_set_size (GsScreenshotImage *ssimg,
ssimg->width = width;
ssimg->height = height;
- gtk_widget_set_size_request (ssimg->stack, width, height);
+ gtk_widget_set_size_request (ssimg->stack, (gint) width, (gint) height);
}
void
@@ -330,7 +332,7 @@ gs_screenshot_image_load_async (GsScreenshotImage *ssimg,
g_return_if_fail (ssimg->height != 0);
/* load an image according to the scale factor */
- ssimg->scale = gtk_widget_get_scale_factor (GTK_WIDGET (ssimg));
+ ssimg->scale = (guint) gtk_widget_get_scale_factor (GTK_WIDGET (ssimg));
im = as_screenshot_get_image (ssimg->screenshot,
ssimg->width * ssimg->scale,
ssimg->height * ssimg->scale);
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 56ab380..bae2461 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -636,7 +636,7 @@ gs_plugin_loader_fwupd_func (GsPluginLoader *plugin_loader)
g_assert_cmpstr (gs_app_get_name (app), ==, "Chiron");
g_assert_cmpstr (gs_app_get_summary (app), ==, "Single line synopsis");
g_assert_cmpstr (gs_app_get_version (app), ==, "0.2");
- g_assert_cmpint (gs_app_get_size_download (app), ==, 32784);
+ g_assert_cmpint ((gint64) gs_app_get_size_download (app), ==, 32784);
g_assert_cmpstr (gs_app_get_description (app), ==,
"This is the first paragraph in the example "
"cab file.\n\nThis is the second paragraph.");
@@ -770,9 +770,10 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
g_assert_cmpstr (gs_app_get_id (app), ==, "org.test.Chiron.desktop");
g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
- g_assert_cmpint (gs_app_get_kudos (app), ==, GS_APP_KUDO_HAS_KEYWORDS |
- GS_APP_KUDO_SANDBOXED_SECURE |
- GS_APP_KUDO_SANDBOXED);
+ g_assert_cmpint ((gint64) gs_app_get_kudos (app), ==,
+ GS_APP_KUDO_HAS_KEYWORDS |
+ GS_APP_KUDO_SANDBOXED_SECURE |
+ GS_APP_KUDO_SANDBOXED);
g_assert_cmpstr (gs_app_get_origin_hostname (app), ==, "");
/* install, also installing runtime */
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 178875e..8c50189 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -422,7 +422,7 @@ gs_shell_details_refresh_progress (GsShellDetails *self)
gtk_widget_set_visible (self->label_progress_percentage, FALSE);
gtk_widget_set_visible (self->progressbar_top, FALSE);
} else {
- g_autofree gchar *str = g_strdup_printf ("%i%%", percentage);
+ g_autofree gchar *str = g_strdup_printf ("%u%%", percentage);
gtk_label_set_label (GTK_LABEL (self->label_progress_percentage), str);
gtk_widget_set_visible (self->label_progress_percentage, TRUE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (self->progressbar_top),
@@ -844,7 +844,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
} else {
g_autoptr(GDateTime) dt = NULL;
g_autofree gchar *updated_str = NULL;
- dt = g_date_time_new_from_unix_utc (updated);
+ dt = g_date_time_new_from_unix_utc ((gint64) updated);
updated_str = g_date_time_format (dt, "%x");
history = gs_app_get_history (self->app);
@@ -1171,7 +1171,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
GPtrArray *reviews;
gboolean show_review_button = TRUE;
gboolean show_reviews = FALSE;
- gint n_reviews = 0;
+ guint n_reviews = 0;
guint64 possible_actions = 0;
guint i;
struct {
@@ -1219,7 +1219,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
}
if (review_ratings != NULL) {
for (i = 0; i < review_ratings->len; i++)
- n_reviews += g_array_index (review_ratings, gint, i);
+ n_reviews += (guint) g_array_index (review_ratings, gint, i);
} else if (gs_app_get_reviews (self->app) != NULL) {
n_reviews = gs_app_get_reviews (self->app)->len;
}
@@ -1247,7 +1247,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
for (i = 0; plugin_vfuncs[i].action != GS_REVIEW_ACTION_LAST; i++) {
if (gs_plugin_loader_get_plugin_supported (self->plugin_loader,
plugin_vfuncs[i].plugin_func)) {
- possible_actions |= 1 << plugin_vfuncs[i].action;
+ possible_actions |= 1u << plugin_vfuncs[i].action;
}
}
@@ -1269,7 +1269,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
actions = possible_actions & 1 << GS_REVIEW_ACTION_REMOVE;
show_review_button = FALSE;
} else {
- actions = possible_actions & ~(1 << GS_REVIEW_ACTION_REMOVE);
+ actions = possible_actions & ~(1u << GS_REVIEW_ACTION_REMOVE);
}
gs_review_row_set_actions (GS_REVIEW_ROW (row), actions);
gtk_container_add (GTK_CONTAINER (self->list_box_reviews), row);
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index df17424..b379ffb 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -268,7 +268,7 @@ app_row_button_clicked_cb (GsAppRow *app_row,
else if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED)
gs_page_remove_app (GS_PAGE (self), app, self->search_cancellable);
else
- g_critical ("extras: app in unexpected state %d", gs_app_get_state (app));
+ g_critical ("extras: app in unexpected state %u", gs_app_get_state (app));
}
static void
@@ -490,7 +490,7 @@ show_search_results (GsShellExtras *self)
g_autofree gchar *str = NULL;
/* no results */
- g_debug ("extras: failed to find any results, %d", n_missing);
+ g_debug ("extras: failed to find any results, %u", n_missing);
str = build_no_results_label (self);
gtk_label_set_label (GTK_LABEL (self->label_no_results), str);
gs_shell_extras_set_state (self,
@@ -503,7 +503,7 @@ show_search_results (GsShellExtras *self)
gs_shell_change_mode (self->shell, GS_SHELL_MODE_DETAILS, app, TRUE);
} else {
/* show what we got */
- g_debug ("extras: got %d search results, showing", n_children);
+ g_debug ("extras: got %u search results, showing", n_children);
gs_shell_extras_set_state (self,
GS_SHELL_EXTRAS_STATE_READY);
}
@@ -1077,7 +1077,7 @@ get_app_sort_key (GsApp *app)
/* finally, sort by short name */
g_string_append (key, gs_app_get_name (app));
- return g_utf8_casefold (key->str, key->len);
+ return g_utf8_casefold (key->str, (gssize) key->len);
}
static gint
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 804c8d7..2736ef4 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -487,7 +487,7 @@ gs_shell_installed_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
gtk_widget_hide (widget);
} else {
g_autofree gchar *label = NULL;
- label = g_strdup_printf ("%d", cnt);
+ label = g_strdup_printf ("%u", cnt);
gtk_label_set_label (GTK_LABEL (widget), label);
gtk_widget_show (widget);
}
diff --git a/src/gs-shell-loading.c b/src/gs-shell-loading.c
index ddee4c7..d9e4fb8 100644
--- a/src/gs-shell-loading.c
+++ b/src/gs-shell-loading.c
@@ -103,7 +103,7 @@ gs_shell_loading_load (GsShellLoading *self)
/* ensure that at least some metadata of any age is present, and also
* spin up the plugins enough as to prime caches */
- gs_plugin_loader_refresh_async (priv->plugin_loader, -1,
+ gs_plugin_loader_refresh_async (priv->plugin_loader, G_MAXUINT,
GS_PLUGIN_REFRESH_FLAGS_METADATA,
priv->cancellable,
gs_shell_loading_refresh_cb,
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 4b8980b..57b4920 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -214,7 +214,7 @@ gs_shell_overview_get_category_apps_cb (GObject *source_object,
goto out;
} else if (gs_app_list_length (list) < N_TILES) {
g_warning ("hiding category %s featured applications: "
- "found only %d to show, need at least %d",
+ "found only %u to show, need at least %d",
gs_category_get_id (load_data->category),
gs_app_list_length (list), N_TILES);
goto out;
@@ -450,14 +450,14 @@ gs_shell_overview_get_random_categories (void)
NULL };
date = g_date_time_new_now_utc ();
- rand = g_rand_new_with_seed (g_date_time_get_day_of_year (date));
+ rand = g_rand_new_with_seed ((guint32) g_date_time_get_day_of_year (date));
cats = g_ptr_array_new_with_free_func (g_free);
for (i = 0; ids[i] != NULL; i++)
g_ptr_array_add (cats, g_strdup (ids[i]));
for (i = 0; i < powl (cats->len + 1, 2); i++) {
gpointer tmp;
- guint rnd1 = g_rand_int_range (rand, 0, cats->len);
- guint rnd2 = g_rand_int_range (rand, 0, cats->len);
+ guint rnd1 = (guint) g_rand_int_range (rand, 0, (gint32) cats->len);
+ guint rnd2 = (guint) g_rand_int_range (rand, 0, (gint32) cats->len);
if (rnd1 == rnd2)
continue;
tmp = cats->pdata[rnd1];
@@ -466,7 +466,7 @@ gs_shell_overview_get_random_categories (void)
}
for (i = 0; i < cats->len; i++) {
const gchar *tmp = g_ptr_array_index (cats, i);
- g_debug ("%i = %s", i + 1, tmp);
+ g_debug ("%u = %s", i + 1, tmp);
}
return cats;
}
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 07c9c53..995782f 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -338,7 +338,7 @@ gs_shell_search_get_app_sort_key (GsApp *app)
g_string_append_printf (key, "%05x:", gs_app_get_match_value (app));
/* sort by kudos */
- g_string_append_printf (key, "%03i:", gs_app_get_kudos_percentage (app));
+ g_string_append_printf (key, "%03u:", gs_app_get_kudos_percentage (app));
/* sort by length of description */
g_string_append_printf (key, "%03" G_GSIZE_FORMAT ":",
@@ -346,7 +346,7 @@ gs_shell_search_get_app_sort_key (GsApp *app)
/* sort by number of screenshots */
ss = gs_app_get_screenshots (app);
- g_string_append_printf (key, "%02i:", ss->len);
+ g_string_append_printf (key, "%02u:", ss->len);
/* sort by install date */
g_string_append_printf (key, "%09" G_GUINT64_FORMAT ":",
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 1693bc9..0dd03f7 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -184,7 +184,7 @@ gs_shell_updates_last_checked_time_string (GsShellUpdates *self)
last_checked = g_date_time_new_from_unix_local (tmp);
midnight = time_next_midnight ();
- days_ago = g_date_time_difference (midnight, last_checked) / G_TIME_SPAN_DAY;
+ days_ago = (gint) (g_date_time_difference (midnight, last_checked) / G_TIME_SPAN_DAY);
#ifdef HAVE_GNOME_DESKTOP
clock_format = g_settings_get_enum (self->desktop_settings, "clock-format");
@@ -506,7 +506,7 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
"button_updates_counter"));
if (gs_app_list_length (list) > 0 && !gs_update_monitor_is_managed ()) {
g_autofree gchar *text = NULL;
- text = g_strdup_printf ("%d", gs_app_list_length (list));
+ text = g_strdup_printf ("%u", gs_app_list_length (list));
gtk_label_set_label (GTK_LABEL (widget), text);
gtk_widget_show (widget);
} else {
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 347b4e8..26437ab 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -578,7 +578,7 @@ gs_shell_main_window_mapped_cb (GtkWidget *widget, GsShell *shell)
{
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
gs_plugin_loader_set_scale (priv->plugin_loader,
- gtk_widget_get_scale_factor (widget));
+ (guint) gtk_widget_get_scale_factor (widget));
}
static void
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 9c6a188..0ed26d8 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -95,27 +95,27 @@ add_source (GtkListBox *listbox, GsApp *app)
} else if (cnt_addon == 0) {
/* TRANSLATORS: This string is used to construct the 'X applications
installed' sentence, describing a software source. */
- text = g_strdup_printf (ngettext ("%i application installed",
- "%i applications installed",
+ text = g_strdup_printf (ngettext ("%u application installed",
+ "%u applications installed",
cnt_apps), cnt_apps);
} else if (cnt_apps == 0) {
/* TRANSLATORS: This string is used to construct the 'X add-ons
installed' sentence, describing a software source. */
- text = g_strdup_printf (ngettext ("%i add-on installed",
- "%i add-ons installed",
+ text = g_strdup_printf (ngettext ("%u add-on installed",
+ "%u add-ons installed",
cnt_addon), cnt_addon);
} else {
/* TRANSLATORS: This string is used to construct the 'X applications
and y add-ons installed' sentence, describing a software source.
The correct form here depends on the number of applications. */
- apps_text = g_strdup_printf (ngettext ("%i application",
- "%i applications",
+ apps_text = g_strdup_printf (ngettext ("%u application",
+ "%u applications",
cnt_apps), cnt_apps);
/* TRANSLATORS: This string is used to construct the 'X applications
and y add-ons installed' sentence, describing a software source.
The correct form here depends on the number of add-ons. */
- addons_text = g_strdup_printf (ngettext ("%i add-on",
- "%i add-ons",
+ addons_text = g_strdup_printf (ngettext ("%u add-on",
+ "%u add-ons",
cnt_addon), cnt_addon);
/* TRANSLATORS: This string is used to construct the 'X applications
and y add-ons installed' sentence, describing a software source.
diff --git a/src/gs-star-widget.c b/src/gs-star-widget.c
index cde9e60..e0f9fb1 100644
--- a/src/gs-star-widget.c
+++ b/src/gs-star-widget.c
@@ -100,7 +100,7 @@ gs_star_widget_refresh (GsStarWidget *star)
/* create image */
im = gtk_image_new_from_icon_name ("starred-symbolic",
GTK_ICON_SIZE_DIALOG);
- gtk_image_set_pixel_size (GTK_IMAGE (im), priv->icon_size);
+ gtk_image_set_pixel_size (GTK_IMAGE (im), (gint) priv->icon_size);
/* create button */
if (priv->interactive) {
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index d4f51b1..f8ce342 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -206,7 +206,7 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
g_autofree gchar *date_str = NULL;
g_autofree gchar *subtitle = NULL;
- date = g_date_time_new_from_unix_utc (install_date);
+ date = g_date_time_new_from_unix_utc ((gint64) install_date);
date_str = g_date_time_format (date, "%x");
/* TRANSLATORS: this is the subtitle of the installed updates dialog window.
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 9dd0bc3..f106a6b 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -79,7 +79,7 @@ notify_offline_update_available (GsUpdateMonitor *monitor)
g_settings_get (monitor->settings,
"security-timestamp", "x", &security_timestamp);
if (security_timestamp > 0) {
- elapsed_security = g_get_monotonic_time () - security_timestamp;
+ elapsed_security = (guint64) g_get_monotonic_time () - security_timestamp;
elapsed_security /= G_USEC_PER_SEC;
elapsed_security /= 60 * 60 * 24;
}
@@ -183,7 +183,7 @@ get_updates_finished_cb (GObject *object,
for (i = 0; i < gs_app_list_length (apps); i++) {
app = gs_app_list_index (apps, i);
if (gs_app_get_metadata_item (app, "is-security") != NULL) {
- security_timestamp = g_get_monotonic_time ();
+ security_timestamp = (guint64) g_get_monotonic_time ();
break;
}
}
@@ -192,7 +192,7 @@ get_updates_finished_cb (GObject *object,
"security-timestamp", "x", security_timestamp);
}
- g_debug ("Got %d updates", gs_app_list_length (apps));
+ g_debug ("got %u updates", gs_app_list_length (apps));
if (has_important_updates (apps) ||
no_updates_for_a_week (monitor)) {
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 865c04a..74de1d0 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -96,7 +96,9 @@ gs_utils_get_file_age (GFile *file)
now = (guint64) g_get_real_time () / G_USEC_PER_SEC;
if (mtime > now)
return G_MAXUINT;
- return now - mtime;
+ if (now - mtime > G_MAXUINT)
+ return G_MAXUINT;
+ return (guint) (now - mtime);
}
/**
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index aa26b55..f5f29da 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -178,7 +178,7 @@ gs_appstream_is_recent_release (AsApp *app)
{
AsRelease *release;
GPtrArray *releases;
- guint secs;
+ guint64 secs;
/* get newest release */
releases = as_app_get_releases (app);
@@ -187,7 +187,7 @@ gs_appstream_is_recent_release (AsApp *app)
release = g_ptr_array_index (releases, 0);
/* is last build less than one year ago? */
- secs = (g_get_real_time () / G_USEC_PER_SEC) -
+ secs = ((guint64) g_get_real_time () / G_USEC_PER_SEC) -
as_release_get_timestamp (release);
return secs / (60 * 60 * 24) < 365;
}
@@ -362,7 +362,7 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
rel = g_ptr_array_index (releases, i);
/* is newer than what's installed */
- g_debug ("installed %s update is %s [%i]",
+ g_debug ("installed %s update is %s [%u]",
gs_app_get_version (app),
as_release_get_version (rel),
as_release_get_state (rel));
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index c389c44..970b393 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -164,13 +164,13 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
tmp = gs_utils_get_file_age (file_timestamp);
if (tmp < cache_age) {
g_autofree gchar *fn = g_file_get_path (file_timestamp);
- g_debug ("%s is only %i seconds old, so ignoring refresh",
+ g_debug ("%s is only %u seconds old, so ignoring refresh",
fn, tmp);
continue;
}
/* download new data */
- g_debug ("%s is %i seconds old, so downloading new data",
+ g_debug ("%s is %u seconds old, so downloading new data",
remote_name, tmp);
ret = flatpak_installation_update_appstream_sync (self->installation,
remote_name,
@@ -1101,7 +1101,7 @@ gs_plugin_refine_item_metadata (GsFlatpak *self,
GError **error)
{
const gchar *str;
- gsize len = -1;
+ gsize len = 0;
g_autofree gchar *contents = NULL;
g_autofree gchar *installation_path_str = NULL;
g_autofree gchar *install_path = NULL;
@@ -1499,6 +1499,7 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
GCancellable *cancellable,
GError **error)
{
+ gint size;
g_autofree gchar *content_type = NULL;
g_autofree gchar *id_prefixed = NULL;
g_autoptr(GBytes) appstream_gz = NULL;
@@ -1577,7 +1578,7 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
"no apps found in AppStream data");
return FALSE;
}
- g_debug ("%i applications found in AppStream data",
+ g_debug ("%u applications found in AppStream data",
as_store_get_size (store));
/* find app */
@@ -1598,8 +1599,8 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
}
/* load icon */
- icon_data = flatpak_bundle_ref_get_icon (xref_bundle,
- 64 * gs_plugin_get_scale (self->plugin));
+ size = 64 * (gint) gs_plugin_get_scale (self->plugin);
+ icon_data = flatpak_bundle_ref_get_icon (xref_bundle, size);
if (icon_data == NULL)
icon_data = flatpak_bundle_ref_get_icon (xref_bundle, 64);
if (icon_data != NULL) {
diff --git a/src/plugins/gs-markdown.c b/src/plugins/gs-markdown.c
index 22cddc9..0a3f4e4 100644
--- a/src/plugins/gs-markdown.c
+++ b/src/plugins/gs-markdown.c
@@ -106,7 +106,7 @@ gs_markdown_to_text_line_is_rule (const gchar *line)
guint count = 0;
g_autofree gchar *copy = NULL;
- len = strlen (line);
+ len = (guint) strlen (line);
if (len == 0)
return FALSE;
@@ -183,7 +183,7 @@ gs_markdown_to_text_line_is_blank (const gchar *line)
guint len;
/* a line with no characters is blank by definition */
- len = strlen (line);
+ len = (guint) strlen (line);
if (len == 0)
return TRUE;
@@ -246,7 +246,7 @@ gs_markdown_to_text_line_formatter (const gchar *line,
g_autofree gchar *copy = NULL;
/* needed to know for shifts */
- len = strlen (formatter);
+ len = (guint) strlen (formatter);
if (len == 0)
return NULL;
@@ -401,7 +401,7 @@ gs_markdown_count_chars_in_word (const gchar *text, gchar find)
guint count = 0;
/* get length */
- len = strlen (text);
+ len = (guint) strlen (text);
if (len == 0)
return 0;
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index d39d716..ac91f96 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -113,7 +113,7 @@ gs_plugin_detect_reload_apps (GsPlugin *plugin)
/* invalidate all if a large number of apps changed */
if (cnt > GS_PLUGIN_NUMBER_CHANGED_RELOAD) {
- g_debug ("%i is more than %i AsApps changed",
+ g_debug ("%u is more than %i AsApps changed",
cnt, GS_PLUGIN_NUMBER_CHANGED_RELOAD);
gs_plugin_reload (plugin);
}
@@ -193,8 +193,8 @@ gs_plugin_appstream_get_origins_hash (GPtrArray *array)
continue;
cnt = g_hash_table_lookup (origins, tmp);
perc = (100.f / (gdouble) array->len) * (gdouble) (*cnt);
- g_debug ("origin %s provides %i apps (%.0f%%)", tmp, *cnt, perc);
- *cnt = perc;
+ g_debug ("origin %s provides %u apps (%.0f%%)", tmp, *cnt, perc);
+ *cnt = (guint) perc;
}
return origins;
diff --git a/src/plugins/gs-plugin-dpkg.c b/src/plugins/gs-plugin-dpkg.c
index b0c1004..b4836aa 100644
--- a/src/plugins/gs-plugin-dpkg.c
+++ b/src/plugins/gs-plugin-dpkg.c
@@ -92,7 +92,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
gs_app_add_source (app, tokens[0]);
gs_app_set_name (app, GS_APP_QUALITY_LOWEST, tokens[0]);
gs_app_set_version (app, tokens[1]);
- gs_app_set_size_installed (app, 1024 * atoi (tokens[2]));
+ gs_app_set_size_installed (app, 1024 * g_ascii_strtoull (tokens[2], NULL, 10));
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, tokens[3]);
gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, tokens[4]);
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 69b4700..0c8ffaf 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -185,7 +185,7 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
if (kf_data == NULL)
return FALSE;
epi_desktop = g_strdup_printf ("%s/%s.desktop", epi_dir, wmclass);
- if (!g_file_set_contents (epi_desktop, kf_data, kf_length, error))
+ if (!g_file_set_contents (epi_desktop, kf_data, (gssize) kf_length, error))
return FALSE;
/* symlink it to somewhere the shell will notice */
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 83dc1c3..92040b8 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -144,7 +144,7 @@ gs_plugin_fedora_distro_upgrades_refresh (GsPlugin *plugin,
g_autoptr(GFile) file = g_file_new_for_path (priv->cachefn);
tmp = gs_utils_get_file_age (file);
if (tmp < cache_age) {
- g_debug ("%s is only %i seconds old",
+ g_debug ("%s is only %u seconds old",
priv->cachefn, tmp);
return TRUE;
}
@@ -287,11 +287,11 @@ get_upgrade_css_background (guint version)
g_autofree gchar *filename1 = NULL;
g_autofree gchar *filename2 = NULL;
- filename1 = g_strdup_printf ("/usr/share/backgrounds/f%d/default/standard/f%d.png", version, version);
+ filename1 = g_strdup_printf ("/usr/share/backgrounds/f%u/default/standard/f%u.png", version, version);
if (g_file_test (filename1, G_FILE_TEST_EXISTS))
return g_strdup_printf ("url('%s')", filename1);
- filename2 = g_strdup_printf ("/usr/share/gnome-software/backgrounds/f%d.png", version);
+ filename2 = g_strdup_printf ("/usr/share/gnome-software/backgrounds/f%u.png", version);
if (g_file_test (filename2, G_FILE_TEST_EXISTS))
return g_strdup_printf ("url('%s')", filename2);
@@ -325,7 +325,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
/* parse data */
settings = g_settings_new ("org.gnome.software");
- distros = parse_pkgdb_collections_data (data, len, error);
+ distros = parse_pkgdb_collections_data (data, (gssize) len, error);
if (distros == NULL)
return FALSE;
for (i = 0; i < distros->len; i++) {
@@ -354,16 +354,16 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
}
/* search in the cache */
- cache_key = g_strdup_printf ("release-%d", distro_info->version);
+ cache_key = g_strdup_printf ("release-%u", distro_info->version);
app = gs_plugin_cache_lookup (plugin, cache_key);
if (app != NULL) {
gs_app_list_add (list, app);
continue;
}
- app_id = g_strdup_printf ("org.fedoraproject.release-%d.upgrade",
+ app_id = g_strdup_printf ("org.fedoraproject.release-%u.upgrade",
distro_info->version);
- app_version = g_strdup_printf ("%d", distro_info->version);
+ app_version = g_strdup_printf ("%u", distro_info->version);
/* icon from disk */
ic = as_icon_new ();
@@ -396,7 +396,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
gs_app_set_management_plugin (app, "packagekit");
/* show a Fedora magazine article for the release */
- url = g_strdup_printf ("https://fedoramagazine.org/whats-new-fedora-%d-workstation",
+ url = g_strdup_printf ("https://fedoramagazine.org/whats-new-fedora-%u-workstation",
distro_info->version);
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 53c947c..0ee3fac 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -510,7 +510,7 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
file = g_file_new_for_path (priv->lvfs_sig_fn);
tmp = gs_utils_get_file_age (file);
if (tmp < cache_age) {
- g_debug ("%s is only %i seconds old, so ignoring refresh",
+ g_debug ("%s is only %u seconds old, so ignoring refresh",
priv->lvfs_sig_fn, tmp);
return TRUE;
}
@@ -544,7 +544,7 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
g_debug ("saving new LVFS signature to %s:", priv->lvfs_sig_fn);
if (!g_file_set_contents (priv->lvfs_sig_fn,
g_bytes_get_data (data, NULL),
- g_bytes_get_size (data),
+ (guint) g_bytes_get_size (data),
&error_local)) {
g_set_error (error,
GS_PLUGIN_ERROR,
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 0ad85e5..66c8721 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -199,7 +199,7 @@ gs_plugin_add_featured (GsPlugin *plugin,
return TRUE;
/* just add all */
- g_debug ("using hardcoded as only %i apps", gs_app_list_length (list));
+ g_debug ("using hardcoded as only %u apps", gs_app_list_length (list));
for (i = 0; myapps[i].id != NULL; i++) {
g_autoptr(GsApp) app = NULL;
diff --git a/src/plugins/gs-plugin-hardcoded-popular.c b/src/plugins/gs-plugin-hardcoded-popular.c
index eaec448..e0f864e 100644
--- a/src/plugins/gs-plugin-hardcoded-popular.c
+++ b/src/plugins/gs-plugin-hardcoded-popular.c
@@ -54,7 +54,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
return TRUE;
/* just add all */
- g_debug ("using hardcoded as only %i apps", gs_app_list_length (list));
+ g_debug ("using hardcoded as only %u apps", gs_app_list_length (list));
for (i = 0; apps[i] != NULL; i++) {
g_autoptr(GsApp) app = NULL;
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index 16d47cb..8c1fe4c 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -117,6 +117,7 @@ gs_plugin_icons_download (GsPlugin *plugin,
static GdkPixbuf *
gs_plugin_icons_load_local (GsPlugin *plugin, AsIcon *icon, GError **error)
{
+ gint size;
if (as_icon_get_filename (icon) == NULL) {
g_set_error_literal (error,
GS_PLUGIN_ERROR,
@@ -124,10 +125,9 @@ gs_plugin_icons_load_local (GsPlugin *plugin, AsIcon *icon, GError **error)
"icon has no filename");
return NULL;
}
+ size = (gint) (64 * gs_plugin_get_scale (plugin));
return gdk_pixbuf_new_from_file_at_size (as_icon_get_filename (icon),
- 64 * gs_plugin_get_scale (plugin),
- 64 * gs_plugin_get_scale (plugin),
- error);
+ size, size, error);
}
static GdkPixbuf *
@@ -187,6 +187,7 @@ static GdkPixbuf *
gs_plugin_icons_load_stock (GsPlugin *plugin, AsIcon *icon, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
+ gint size;
g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->icon_theme_lock);
/* required */
@@ -198,9 +199,10 @@ gs_plugin_icons_load_stock (GsPlugin *plugin, AsIcon *icon, GError **error)
return NULL;
}
gs_plugin_icons_add_theme_path (plugin, as_icon_get_prefix (icon));
+ size = (gint) (64 * gs_plugin_get_scale (plugin));
return gtk_icon_theme_load_icon (priv->icon_theme,
as_icon_get_name (icon),
- 64 * gs_plugin_get_scale (plugin),
+ size,
GTK_ICON_LOOKUP_USE_BUILTIN |
GTK_ICON_LOOKUP_FORCE_SIZE,
error);
diff --git a/src/plugins/gs-plugin-key-colors.c b/src/plugins/gs-plugin-key-colors.c
index af17913..b3b32d1 100644
--- a/src/plugins/gs-plugin-key-colors.c
+++ b/src/plugins/gs-plugin-key-colors.c
@@ -100,9 +100,9 @@ gs_plugin_key_colors_set_for_pixbuf (GsApp *app, GdkPixbuf *pb, guint number)
continue;
/* find in cache */
- tmp.R = p[0] / bin_size;
- tmp.G = p[1] / bin_size;
- tmp.B = p[2] / bin_size;
+ tmp.R = (guint8) (p[0] / bin_size);
+ tmp.G = (guint8) (p[1] / bin_size);
+ tmp.B = (guint8) (p[2] / bin_size);
key = GUINT_TO_POINTER (cd_color_rgb8_to_uint32 (&tmp));
s = g_hash_table_lookup (hash, key);
if (s != NULL) {
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 8e508fd..99da43e 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -93,7 +93,7 @@ gs_plugin_odrs_load_ratings_for_app (JsonObject *json_app)
for (i = 0; names[i] != NULL; i++) {
if (!json_object_has_member (json_app, names[i]))
continue;
- tmp = json_object_get_int_member (json_app, names[i]);
+ tmp = (guint64) json_object_get_int_member (json_app, names[i]);
g_array_append_val (ratings, tmp);
}
@@ -172,7 +172,7 @@ gs_plugin_odrs_refresh_ratings (GsPlugin *plugin,
file = g_file_new_for_path (fn);
tmp = gs_utils_get_file_age (file);
if (tmp < cache_age) {
- g_debug ("%s is only %i seconds old, so ignoring refresh",
+ g_debug ("%s is only %u seconds old, so ignoring refresh",
fn, tmp);
if (!gs_plugin_odrs_load_ratings (plugin, fn, error))
g_error ("MOO: %s", (*error)->message);
@@ -231,7 +231,7 @@ gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
/* date */
if (json_object_has_member (item, "date_created")) {
- guint64 timestamp;
+ gint64 timestamp;
g_autoptr(GDateTime) dt = NULL;
timestamp = json_object_get_int_member (item, "date_created");
dt = g_date_time_new_from_unix_utc (timestamp);
@@ -240,9 +240,9 @@ gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
/* assemble review */
if (json_object_has_member (item, "rating"))
- gs_review_set_rating (rev, json_object_get_int_member (item, "rating"));
+ gs_review_set_rating (rev, (gint) json_object_get_int_member (item, "rating"));
if (json_object_has_member (item, "score"))
- gs_review_set_score (rev, json_object_get_int_member (item, "score"));
+ gs_review_set_score (rev, (gint) json_object_get_int_member (item, "score"));
if (json_object_has_member (item, "user_display"))
gs_review_set_reviewer (rev, json_object_get_string_member (item, "user_display"));
if (json_object_has_member (item, "summary"))
@@ -252,7 +252,7 @@ gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
if (json_object_has_member (item, "version"))
gs_review_set_version (rev, json_object_get_string_member (item, "version"));
if (json_object_has_member (item, "karma"))
- gs_review_set_karma (rev, json_object_get_int_member (item, "karma"));
+ gs_review_set_karma (rev, (gint) json_object_get_int_member (item, "karma"));
/* add extra metadata for the plugin */
if (json_object_has_member (item, "user_hash")) {
@@ -284,7 +284,7 @@ gs_plugin_odrs_parse_review_object (GsPlugin *plugin, JsonObject *item)
static GPtrArray *
gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
const gchar *data,
- gsize data_len,
+ gssize data_len,
GError **error)
{
JsonArray *json_reviews;
@@ -357,7 +357,7 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
}
static gboolean
-gs_plugin_odrs_parse_success (const gchar *data, gsize data_len, GError **error)
+gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error)
{
JsonNode *json_root;
JsonObject *json_item;
@@ -474,9 +474,9 @@ gs_plugin_refine_ratings (GsPlugin *plugin,
cnt += tmp;
}
if (cnt == 0)
- gs_app_set_rating (app, cnt);
+ gs_app_set_rating (app, (gint) cnt);
else
- gs_app_set_rating (app, acc / cnt);
+ gs_app_set_rating (app, (gint) (acc / cnt));
return TRUE;
}
@@ -486,7 +486,7 @@ gs_plugin_odrs_fetch_for_app (GsPlugin *plugin, GsApp *app, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
const gchar *version;
- guint karma_min;
+ gint karma_min;
guint status_code;
g_autofree gchar *cachefn_basename = NULL;
g_autofree gchar *cachefn = NULL;
@@ -805,9 +805,9 @@ gs_plugin_odrs_vote (GsPlugin *plugin, GsReview *review,
gs_review_get_metadata_item (review, "app_id"));
tmp = gs_review_get_metadata_item (review, "review_id");
if (tmp != NULL) {
- guint64 review_id;
+ gint64 review_id;
json_builder_set_member_name (builder, "review_id");
- review_id = g_ascii_strtoull (tmp, NULL, 10);
+ review_id = g_ascii_strtoll (tmp, NULL, 10);
json_builder_add_int_value (builder, review_id);
}
json_builder_end_object (builder);
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index 36f7382..267d41d 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -140,7 +140,7 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
package_names[i++] = gs_app_get_source_default (app);
}
- g_debug ("getting history for %i packages", gs_app_list_length (list));
+ g_debug ("getting history for %u packages", gs_app_list_length (list));
result = g_dbus_connection_call_sync (priv->connection,
"org.freedesktop.PackageKit",
"/org/freedesktop/PackageKit",
diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c
index 3a5aad8..749825f 100644
--- a/src/plugins/gs-plugin-packagekit-local.c
+++ b/src/plugins/gs-plugin-packagekit-local.c
@@ -71,7 +71,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
gint percentage = pk_progress_get_percentage (progress);
if (percentage >= 0 && percentage <= 100) {
if (data->app != NULL)
- gs_app_set_progress (data->app, percentage);
+ gs_app_set_progress (data->app, (guint) percentage);
}
}
}
@@ -230,7 +230,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "too many details [%i] for %s",
+ "too many details [%u] for %s",
array->len, filename);
return FALSE;
}
diff --git a/src/plugins/gs-plugin-packagekit-proxy.c b/src/plugins/gs-plugin-packagekit-proxy.c
index 90053d3..b751248 100644
--- a/src/plugins/gs-plugin-packagekit-proxy.c
+++ b/src/plugins/gs-plugin-packagekit-proxy.c
@@ -46,7 +46,7 @@ get_proxy_http (GsPlugin *plugin)
GsPluginData *priv = gs_plugin_get_data (plugin);
gboolean ret;
GString *string = NULL;
- guint port;
+ gint port;
GDesktopProxyMode proxy_mode;
g_autofree gchar *host = NULL;
g_autofree gchar *password = NULL;
@@ -89,7 +89,7 @@ get_proxy_ftp (GsPlugin *plugin)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
GString *string = NULL;
- guint port;
+ gint port;
GDesktopProxyMode proxy_mode;
g_autofree gchar *host = NULL;
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index a57dc49..e983e46 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -323,7 +323,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
package = g_ptr_array_index (packages, 0);
gs_plugin_packagekit_set_metadata_from_package (plugin, app, package);
} else {
- g_warning ("Failed to find one package for %s, %s, [%d]",
+ g_warning ("Failed to find one package for %s, %s, [%u]",
gs_app_get_id (app), filename, packages->len);
}
return TRUE;
diff --git a/src/plugins/gs-plugin-packagekit-upgrade.c b/src/plugins/gs-plugin-packagekit-upgrade.c
index 255e584..b50c413 100644
--- a/src/plugins/gs-plugin-packagekit-upgrade.c
+++ b/src/plugins/gs-plugin-packagekit-upgrade.c
@@ -71,7 +71,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
} else if (type == PK_PROGRESS_TYPE_PERCENTAGE) {
gint percentage = pk_progress_get_percentage (progress);
if (percentage >= 0 && percentage <= 100)
- gs_app_set_progress (data->app, percentage);
+ gs_app_set_progress (data->app, (guint) percentage);
}
}
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 7db657b..6ebf11b 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -94,7 +94,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
} else if (type == PK_PROGRESS_TYPE_PERCENTAGE) {
gint percentage = pk_progress_get_percentage (progress);
if (data->app != NULL && percentage >= 0 && percentage <= 100)
- gs_app_set_progress (data->app, percentage);
+ gs_app_set_progress (data->app, (guint) percentage);
}
}
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index c043acc..e0c6557 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -104,7 +104,7 @@ gs_plugin_shell_extensions_convert_state (guint value)
case GS_PLUGIN_SHELL_EXTENSION_STATE_UNINSTALLED:
return AS_APP_STATE_AVAILABLE;
default:
- g_warning ("unknown state %i", value);
+ g_warning ("unknown state %u", value);
}
return AS_APP_STATE_UNKNOWN;
}
@@ -157,21 +157,21 @@ gs_plugin_shell_extensions_add_app (GsPlugin *plugin,
continue;
}
if (g_strcmp0 (str, "type") == 0) {
- guint val_int = g_variant_get_double (val);
+ guint val_int = (guint) g_variant_get_double (val);
switch (val_int) {
case GS_PLUGIN_SHELL_EXTENSION_KIND_SYSTEM:
case GS_PLUGIN_SHELL_EXTENSION_KIND_PER_USER:
gs_app_set_kind (app, AS_APP_KIND_SHELL_EXTENSION);
break;
default:
- g_warning ("%s unknown type %i", uuid, val_int);
+ g_warning ("%s unknown type %u", uuid, val_int);
break;
}
continue;
}
if (g_strcmp0 (str, "state") == 0) {
AsAppState st;
- guint val_int = g_variant_get_double (val);
+ guint val_int = (guint) g_variant_get_double (val);
st = gs_plugin_shell_extensions_convert_state (val_int);
gs_app_set_state (app, st);
continue;
@@ -439,7 +439,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
AsApp *app;
JsonObject *json_ver_map;
const gchar *tmp;
- guint64 pk;
+ gint64 pk;
app = as_app_new ();
as_app_set_kind (app, AS_APP_KIND_SHELL_EXTENSION);
@@ -498,7 +498,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
g_autofree gchar *uri = NULL;
uri = g_strdup_printf ("%s/static/extension-data/"
"screenshots/"
- "screenshot_%" G_GUINT64_FORMAT ".png",
+ "screenshot_%" G_GINT64_FORMAT ".png",
SHELL_EXTENSIONS_API_URI, pk);
im = as_image_new ();
as_image_set_kind (im, AS_IMAGE_KIND_SOURCE);
@@ -526,7 +526,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
static GPtrArray *
gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
const gchar *data,
- gsize data_len,
+ gssize data_len,
GError **error)
{
GPtrArray *apps;
@@ -654,10 +654,10 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
return NULL;
apps = gs_plugin_shell_extensions_parse_apps (plugin,
g_bytes_get_data (data, NULL),
- g_bytes_get_size (data),
+ (gssize) g_bytes_get_size (data),
error);
if (apps == NULL) {
- guint len = g_bytes_get_size (data);
+ gsize len = g_bytes_get_size (data);
g_autofree gchar *tmp = NULL;
/* truncate the string if long */
@@ -671,7 +671,7 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
/* save to the cache */
if (!g_file_set_contents (cachefn,
g_bytes_get_data (data, NULL),
- g_bytes_get_size (data),
+ (guint) g_bytes_get_size (data),
error))
return NULL;
@@ -706,7 +706,7 @@ gs_plugin_shell_extensions_refresh (GsPlugin *plugin,
if (g_file_query_exists (file, NULL)) {
guint age = gs_utils_get_file_age (file);
if (age < cache_age) {
- g_debug ("%s is only %i seconds old, ignoring", fn, age);
+ g_debug ("%s is only %u seconds old, ignoring", fn, age);
return TRUE;
}
}
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 0104104..0d6cb7a 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -173,12 +173,12 @@ refine_app (GsPlugin *plugin, GsApp *app, JsonObject *package, gboolean from_sea
if (json_object_has_member (package, "installed-size")) {
size = json_object_get_int_member (package, "installed-size");
if (size > 0)
- gs_app_set_size_installed (app, size);
+ gs_app_set_size_installed (app, (guint64) size);
}
if (json_object_has_member (package, "download-size")) {
size = json_object_get_int_member (package, "download-size");
if (size > 0)
- gs_app_set_size_download (app, size);
+ gs_app_set_size_download (app, (guint64) size);
}
gs_app_add_quirk (app, AS_APP_QUIRK_PROVENANCE);
icon_url = json_object_get_string_member (package, "icon");
@@ -214,7 +214,7 @@ refine_app (GsPlugin *plugin, GsApp *app, JsonObject *package, gboolean from_sea
loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (loader,
(guint8 *) message->response_body->data,
- message->response_body->length,
+ (gsize) message->response_body->length,
NULL);
gdk_pixbuf_loader_close (loader, NULL);
icon_pixbuf = g_object_ref (gdk_pixbuf_loader_get_pixbuf (loader));
@@ -311,7 +311,7 @@ get_apps (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "snapd returned status code %d: %s",
+ "snapd returned status code %u: %s",
status_code, reason_phrase);
return FALSE;
}
@@ -378,7 +378,7 @@ get_app (GsPlugin *plugin, GsApp *app, GCancellable *cancellable, GError **error
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "snapd returned status code %d: %s",
+ "snapd returned status code %u: %s",
status_code, reason_phrase);
return FALSE;
}
@@ -497,7 +497,7 @@ send_package_action (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "snapd returned status code %d: %s",
+ "snapd returned status code %u: %s",
status_code, reason_phrase);
return FALSE;
}
@@ -534,7 +534,7 @@ send_package_action (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "snapd returned status code %d: %s",
+ "snapd returned status code %u: %s",
status_code, status_reason_phrase);
return FALSE;
}
@@ -569,7 +569,7 @@ send_package_action (GsPlugin *plugin,
}
if (total > 0)
- gs_app_set_progress (app, 100 * done / total);
+ gs_app_set_progress (app, (guint) (100 * done / total));
g_list_free (task_list);
}
diff --git a/src/plugins/gs-plugin-steam.c b/src/plugins/gs-plugin-steam.c
index dc17d26..ad1ebfd 100644
--- a/src/plugins/gs-plugin-steam.c
+++ b/src/plugins/gs-plugin-steam.c
@@ -71,7 +71,7 @@ gs_plugin_steam_token_kind_to_str (guint8 data)
/* printable */
if (g_ascii_isprint (data)) {
- tmp[0] = data;
+ tmp[0] = (gchar) data;
return tmp;
}
return "[?]";
@@ -96,7 +96,7 @@ gs_plugin_steam_consume_string (guint8 *data, gsize data_len, guint *idx)
(*idx)++;
return NULL;
}
- *idx += strlen (tmp) + 1;
+ *idx += (guint) strlen (tmp) + 1;
return tmp;
}
@@ -195,7 +195,7 @@ gs_plugin_steam_parse_appinfo_file (const gchar *filename, GError **error)
tmp = gs_plugin_steam_consume_string (data, data_len, &i);
value = gs_plugin_steam_consume_uint32 (data, data_len, &i);
if (debug)
- g_debug ("\t%s=%i", tmp, value);
+ g_debug ("\t%s=%u", tmp, value);
if (tmp != NULL) {
if (g_hash_table_lookup (app, tmp) != NULL)
continue;
@@ -256,12 +256,12 @@ gs_plugin_steam_capture (const gchar *html,
return NULL;
/* find @start */
- start_len = strlen (start);
+ start_len = (guint) strlen (start);
for (i = *offset; html[i] != '\0'; i++) {
if (memcmp (&html[i], start, start_len) != 0)
continue;
/* find @end */
- end_len = strlen (end);
+ end_len = (guint) strlen (end);
for (j = i + start_len; html[j] != '\0'; j++) {
if (memcmp (&html[j], end, end_len) != 0)
continue;
@@ -459,12 +459,12 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
/* already exists */
if (as_store_get_app_by_id (store, app_id) != NULL) {
- g_debug ("already exists %i, skipping", gameid);
+ g_debug ("already exists %" G_GUINT32_FORMAT ", skipping", gameid);
return TRUE;
}
/* create application with the gameid as the key */
- g_debug ("parsing steam %i", gameid);
+ g_debug ("parsing steam %" G_GUINT32_FORMAT, gameid);
item = as_app_new ();
as_app_set_kind (item, AS_APP_KIND_DESKTOP);
as_app_set_project_license (item, "Steam");
@@ -520,7 +520,7 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
if (tmp != NULL) {
g_autoptr(GError) error_local = NULL;
g_autofree gchar *ic_uri = NULL;
- ic_uri = g_strdup_printf
("https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/%i/%s.icns",
+ ic_uri = g_strdup_printf
("https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/%" G_GUINT32_FORMAT "/%s.icns",
gameid, g_variant_get_string (tmp, NULL));
if (!gs_plugin_steam_download_icon (plugin, item, ic_uri, &error_local)) {
g_warning ("Failed to parse clienticns: %s",
@@ -534,7 +534,7 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
if (tmp != NULL) {
g_autoptr(GError) error_local = NULL;
g_autofree gchar *ic_uri = NULL;
- ic_uri = g_strdup_printf
("http://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/%i/%s.ico",
+ ic_uri = g_strdup_printf
("http://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/%" G_GUINT32_FORMAT "/%s.ico",
gameid, g_variant_get_string (tmp, NULL));
if (!gs_plugin_steam_download_icon (plugin, item, ic_uri, &error_local)) {
g_warning ("Failed to parse clienticon: %s",
@@ -549,7 +549,7 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
if (tmp != NULL) {
AsIcon *icon = NULL;
g_autofree gchar *ic_uri = NULL;
- ic_uri = g_strdup_printf
("http://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/%i/%s.jpg",
+ ic_uri = g_strdup_printf
("http://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/%" G_GUINT32_FORMAT "/%s.jpg",
gameid, g_variant_get_string (tmp, NULL));
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_REMOTE);
@@ -610,6 +610,7 @@ static gboolean
gs_plugin_steam_update_store (GsPlugin *plugin, AsStore *store, GPtrArray *apps, GError **error)
{
guint i;
+ gdouble pc;
GHashTable *app;
g_autoptr(GsApp) dummy = gs_app_new (NULL);
@@ -619,7 +620,8 @@ gs_plugin_steam_update_store (GsPlugin *plugin, AsStore *store, GPtrArray *apps,
return FALSE;
/* update progress */
- gs_app_set_progress (dummy, (gdouble) i * 100.f / (gdouble) apps->len);
+ pc = (gdouble) i * 100.f / (gdouble) apps->len;
+ gs_app_set_progress (dummy, (guint) pc);
gs_plugin_status_update (plugin, dummy, GS_PLUGIN_STATUS_DOWNLOADING);
}
return TRUE;
@@ -653,7 +655,7 @@ gs_plugin_steam_refresh (GsPlugin *plugin,
guint tmp;
tmp = gs_utils_get_file_age (file);
if (tmp < cache_age) {
- g_debug ("%s is only %i seconds old, so ignoring refresh",
+ g_debug ("%s is only %u seconds old, so ignoring refresh",
fn_xml, tmp);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index e0385aa..30e845a 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -495,7 +495,7 @@ download_review_stats (GsPlugin *plugin, GCancellable *cancellable, GError **err
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Failed to download review stats, server returned status code %d",
+ "Failed to download review stats, server returned status code %u",
status_code);
return FALSE;
}
@@ -722,7 +722,7 @@ download_reviews (GsPlugin *plugin, GsApp *app,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Failed to download reviews, server returned status code %d",
+ "Failed to download reviews, server returned status code %u",
status_code);
return FALSE;
}
@@ -898,7 +898,7 @@ gs_plugin_review_submit (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Failed to submit review, server returned status code %d",
+ "Failed to submit review, server returned status code %u",
status_code);
return FALSE;
}
@@ -944,7 +944,7 @@ gs_plugin_review_report (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Failed to report review, server returned status code %d",
+ "Failed to report review, server returned status code %u",
status_code);
return FALSE;
}
@@ -975,7 +975,7 @@ set_review_usefulness (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Got status code %d from reviews.ubuntu.com",
+ "Got status code %u from reviews.ubuntu.com",
status_code);
return FALSE;
}
@@ -1052,7 +1052,7 @@ gs_plugin_review_remove (GsPlugin *plugin,
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
- "Failed to remove review, server returned status code %d",
+ "Failed to remove review, server returned status code %u",
status_code);
return FALSE;
}
diff --git a/src/plugins/gs-snapd.c b/src/plugins/gs-snapd.c
index c591a6e..a7e2cb8 100644
--- a/src/plugins/gs-snapd.c
+++ b/src/plugins/gs-snapd.c
@@ -85,7 +85,7 @@ read_from_snapd (GSocket *socket,
error);
if (n_read < 0)
return FALSE;
- *read_offset += n_read;
+ *read_offset += (gsize) n_read;
buffer[*read_offset] = '\0';
return TRUE;
@@ -134,7 +134,7 @@ gs_snapd_request (const gchar *method,
g_string_append (request, "\r\n");
}
if (content)
- g_string_append_printf (request, "Content-Length: %zi\r\n", strlen (content));
+ g_string_append_printf (request, "Content-Length: %zu\r\n", strlen (content));
g_string_append (request, "\r\n");
if (content)
g_string_append (request, content);
@@ -167,11 +167,11 @@ gs_snapd_request (const gchar *method,
/* body starts after header divider */
body += 4;
- header_length = body - data;
+ header_length = (gsize) (body - data);
/* parse headers */
headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_RESPONSE);
- if (!soup_headers_parse_response (data, header_length, headers,
+ if (!soup_headers_parse_response (data, (gint) header_length, headers,
NULL, &code, reason_phrase)) {
g_set_error_literal (error,
GS_PLUGIN_ERROR,
@@ -238,7 +238,8 @@ gs_snapd_request (const gchar *method,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
"Not enough space for snapd response, "
- "require %zi octets, have %zi",
+ "require %" G_GSIZE_FORMAT " octets, "
+ "have %" G_GSIZE_FORMAT,
n_required, max_data_length);
return FALSE;
}
@@ -262,7 +263,8 @@ gs_snapd_request (const gchar *method,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
"Not enough space for snapd response, "
- "require %zi octets, have %zi",
+ "require %" G_GSIZE_FORMAT " octets, "
+ "have %" G_GSIZE_FORMAT,
n_required, max_data_length);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]