Skip to content

Commit

Permalink
Fix compile with -Wformat-signedness
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsie committed Jul 27, 2016
1 parent 4fc7521 commit 2b0f49c
Show file tree
Hide file tree
Showing 42 changed files with 375 additions and 205 deletions.
10 changes: 5 additions & 5 deletions client/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ colormgr_LDFLAGS = \
$(PIE_LDFLAGS)

colormgr_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

cd_fix_profile_SOURCES = \
cd-fix-profile.c
Expand All @@ -53,7 +53,7 @@ cd_fix_profile_LDADD = \
-lm

cd_fix_profile_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

cd_fix_profile_LDFLAGS = \
$(PIE_LDFLAGS)
Expand All @@ -71,7 +71,7 @@ cd_iccdump_LDFLAGS = \
$(PIE_LDFLAGS)

cd_iccdump_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

cd_it8_SOURCES = \
cd-it8.c
Expand All @@ -86,7 +86,7 @@ cd_it8_LDFLAGS = \
$(PIE_LDFLAGS)

cd_it8_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

cd_create_profile_SOURCES = \
cd-create-profile.c
Expand All @@ -101,7 +101,7 @@ cd_create_profile_LDFLAGS = \
$(PIE_LDFLAGS)

cd_create_profile_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

MAINTAINERCLEANFILES = *.a

Expand Down
4 changes: 2 additions & 2 deletions client/cd-fix-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ cd_util_extract_vcgt (CdUtilPrivate *priv, gchar **values, GError **error)
g_print ("idx,red,green,blue\n");
for (i = 0; i < size; i++) {
in = (gdouble) i / (gdouble) (size - 1);
g_print ("%i,", i);
g_print ("%u,", i);
g_print ("%f,", cmsEvalToneCurveFloat(vcgt[0], in));
g_print ("%f,", cmsEvalToneCurveFloat(vcgt[1], in));
g_print ("%f\n", cmsEvalToneCurveFloat(vcgt[2], in));
Expand Down Expand Up @@ -622,7 +622,7 @@ cd_util_lcms_error_cb (cmsContext ContextID,
cmsUInt32Number errorcode,
const char *text)
{
g_warning ("LCMS error %i: %s", errorcode, text);
g_warning ("LCMS error %" G_GUINT32_FORMAT ": %s", errorcode, text);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion client/cd-iccdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cd_fix_profile_error_cb (cmsContext ContextID,
cmsUInt32Number errorcode,
const char *text)
{
g_warning ("LCMS error %i: %s", errorcode, text);
g_warning ("LCMS error %" G_GUINT32_FORMAT ": %s", errorcode, text);

/* copy this sytemwide */
lcms_error_code = errorcode;
Expand Down
22 changes: 11 additions & 11 deletions client/cd-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ cd_util_show_device (CdUtilPrivate *priv, CdDevice *device)
for (i = 0; i < profiles->len; i++) {
profile_tmp = g_ptr_array_index (profiles, i);
/* TRANSLATORS: the profile for the device */
str_tmp = g_strdup_printf ("%s %i", _("Profile"), i+1);
str_tmp = g_strdup_printf ("%s %u", _("Profile"), i+1);
ret = cd_profile_connect_sync (profile_tmp, NULL, &error);
if (!ret) {
cd_util_print_field (str_tmp,
Expand Down Expand Up @@ -847,19 +847,19 @@ cd_util_dump (CdUtilPrivate *priv, gchar **values, GError **error)
ret = FALSE;
goto out;
}
g_string_append_printf (str, "no-profile\t%i\n", profiles->len);
g_string_append_printf (str, "no-profile\t%u\n", profiles->len);
for (i = 0; i < profiles->len; i++) {
profile = g_ptr_array_index (profiles, i);
ret = cd_profile_connect_sync (profile, NULL, &error_local);
if (!ret) {
g_string_append_printf (str, "profile-%02i\t%s\tERROR: %s\n",
i,
g_string_append_printf (str, "profile-%02u\t%s\tERROR: %s\n",
(guint) i,
cd_profile_get_object_path (profile),
error_local->message);
g_clear_error (&error_local);
}
g_string_append_printf (str, "profile-%02i\t%s\t%s\n",
i,
g_string_append_printf (str, "profile-%02u\t%s\t%s\n",
(guint) i,
cd_profile_get_id (profile),
cd_profile_get_filename (profile));
}
Expand All @@ -870,13 +870,13 @@ cd_util_dump (CdUtilPrivate *priv, gchar **values, GError **error)
ret = FALSE;
goto out;
}
g_string_append_printf (str, "no-devices\t%i\n", devices->len);
g_string_append_printf (str, "no-devices\t%u\n", devices->len);
for (i = 0; i < devices->len; i++) {
device = g_ptr_array_index (devices, i);
ret = cd_device_connect_sync (device, NULL, &error_local);
if (!ret) {
g_string_append_printf (str, "device-%02i\t%s\tERROR: %s\n",
i,
g_string_append_printf (str, "device-%02u\t%s\tERROR: %s\n",
(guint) i,
cd_device_get_object_path (device),
error_local->message);
g_clear_error (&error_local);
Expand All @@ -887,8 +887,8 @@ cd_util_dump (CdUtilPrivate *priv, gchar **values, GError **error)
if (!ret)
goto out;
}
g_string_append_printf (str, "device-%02i\t%s\t%s\n",
i,
g_string_append_printf (str, "device-%02u\t%s\t%s\n",
(guint) i,
profile != NULL ?
cd_profile_get_id (profile) :
" ",
Expand Down
76 changes: 23 additions & 53 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -56,59 +56,29 @@ AM_PROG_CC_C_O
IT_PROG_INTLTOOL([0.35.0])
AC_PATH_PROG(XSLTPROC, xsltproc)

dnl ---------------------------------------------------------------------------
dnl - Use strict options (default enabled for devs, disabled in releases)
dnl ---------------------------------------------------------------------------
if test -d ".git"; then
default_strict=yes
else
default_strict=no
fi

AC_ARG_ENABLE(strict, AS_HELP_STRING([--enable-strict],
[Enable strict compilation options]),
enable_strict=$enableval,
enable_strict=$default_strict)
if test x$enable_strict != xno; then
CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES"
CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED"
CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE"
fi

dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------

if test "$GCC" = "yes"; then
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
else
WARNINGFLAGS_C=""
fi
AC_SUBST(WARNINGFLAGS_C)
GNOME_COMPILE_WARNINGS([maximum],[
-Wmissing-declarations
-Wcast-align
-Wwrite-strings
-Wreturn-type
-Wformat-nonliteral
-Wmissing-format-attribute
-Wclobbered
-Wempty-body
-Wignored-qualifiers
-Wsign-compare
-Wtype-limits
-Wuninitialized
-Waggregate-return
-Wdeclaration-after-statement
-Wshadow
-Wno-strict-aliasing
-Winline
-Wmissing-parameter-type
-Woverride-init
-Wno-discarded-qualifiers
-Wformat-signedness
])

dnl ---------------------------------------------------------------------------
dnl - gettext stuff
Expand Down
2 changes: 1 addition & 1 deletion contrib/colord-sane/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ colord_sane_LDFLAGS = \
$(PIE_LDFLAGS)

colord_sane_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

DISTCLEANFILES = \
$(dist_profile_DATA)
Expand Down
4 changes: 2 additions & 2 deletions contrib/session-helper/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ colord_session_LDFLAGS = \
$(PIE_LDFLAGS)

colord_session_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

dbusservicemaindir = $(datadir)/dbus-1/services
dbusservicemain_in_files = org.freedesktop.ColorHelper.service.in
Expand All @@ -80,7 +80,7 @@ colord_session_example_LDADD = \
$(GNOME_DESKTOP_LIBS) \
$(LCMS_LIBS) -lm
colord_session_example_CFLAGS = \
$(WARNINGFLAGS_C)
$(WARN_CFLAGS)

test: colord-session-example
./colord-session-example \
Expand Down
4 changes: 2 additions & 2 deletions contrib/session-helper/cd-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ cd_example_signal_cb (GDBusProxy *proxy,
g_debug ("calibration succeeded with profile %s created at %s",
profile_id, profile_path);
} else {
g_warning ("calibration failed with code %i: %s",
g_warning ("calibration failed with code %u: %s",
code, str);
}
g_main_loop_quit (priv->loop);
Expand Down Expand Up @@ -299,7 +299,7 @@ cd_example_signal_cb (GDBusProxy *proxy,
&code,
&message,
&image);
g_print ("Interaction required type %i: %s\n",
g_print ("Interaction required type %u: %s\n",
code, message);
cd_example_interaction_required (priv,
code,
Expand Down
14 changes: 7 additions & 7 deletions contrib/session-helper/cd-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ cd_main_emit_interaction_required (CdMainPrivate *priv,
message = "";
break;
}
g_debug ("CdMain: Emitting InteractionRequired(%i,%s,%s)",
g_debug ("CdMain: Emitting InteractionRequired(%u,%s,%s)",
code, message, image);
g_dbus_connection_emit_signal (priv->connection,
NULL,
Expand All @@ -280,7 +280,7 @@ cd_main_emit_update_gamma (CdMainPrivate *priv,
CdColorRGB *color;

/* emit signal */
g_debug ("CdMain: Emitting UpdateGamma(%i elements)",
g_debug ("CdMain: Emitting UpdateGamma(%u elements)",
array->len);

/* build the dict */
Expand Down Expand Up @@ -1667,7 +1667,7 @@ cd_main_daemon_method_call (GDBusConnection *connection,
cd_profile_quality_to_string (priv->quality));
} else if (g_strcmp0 (prop_key, "Whitepoint") == 0) {
priv->target_whitepoint = g_variant_get_uint32 (prop_value);
g_debug ("Whitepoint: %iK",
g_debug ("Whitepoint: %uK",
priv->target_whitepoint);
} else if (g_strcmp0 (prop_key, "Title") == 0) {
priv->title = g_variant_dup_string (prop_value, NULL);
Expand All @@ -1678,7 +1678,7 @@ cd_main_daemon_method_call (GDBusConnection *connection,
cd_sensor_cap_to_string (priv->device_kind));
} else if (g_strcmp0 (prop_key, "Brightness") == 0) {
priv->screen_brightness = g_variant_get_uint32 (prop_value);
g_debug ("Device brightness: %i", priv->screen_brightness);
g_debug ("Device brightness: %u", priv->screen_brightness);
} else if (g_strcmp0 (prop_key, "Gamma") == 0) {
priv->target_gamma = g_variant_get_double (prop_value);
g_debug ("Gamma: %.2f", priv->target_gamma);
Expand Down Expand Up @@ -1706,7 +1706,7 @@ cd_main_daemon_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_error (invocation,
CD_SESSION_ERROR,
CD_SESSION_ERROR_INVALID_VALUE,
"invalid quality value %i",
"invalid quality value %u",
priv->quality);
return;
}
Expand All @@ -1728,7 +1728,7 @@ cd_main_daemon_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_error (invocation,
CD_SESSION_ERROR,
CD_SESSION_ERROR_INVALID_VALUE,
"invalid target whitepoint value %i",
"invalid target whitepoint value %u",
priv->target_whitepoint);
return;
}
Expand Down Expand Up @@ -1970,7 +1970,7 @@ cd_main_percentage_changed_cb (CdState *state,
guint value,
CdMainPrivate *priv)
{
g_debug ("CdMain: Emitting PropertiesChanged(Progress) %i", value);
g_debug ("CdMain: Emitting PropertiesChanged(Progress) %u", value);
cd_main_emit_property_changed (priv,
"Progress",
g_variant_new_uint32 (value));
Expand Down
Loading

0 comments on commit 2b0f49c

Please sign in to comment.