Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!1822
This commit is contained in:
Philip Withnall 2020-12-18 21:59:56 +00:00
commit 2008cb58a4
6 changed files with 30 additions and 30 deletions

View File

@ -661,10 +661,10 @@ g_buffered_input_stream_real_fill (GBufferedInputStream *stream,
in_buffer = priv->end - priv->pos;
/* Never fill more than can fit in the buffer */
count = MIN (count, priv->len - in_buffer);
count = MIN ((gsize) count, priv->len - in_buffer);
/* If requested length does not fit at end, compact */
if (priv->len - priv->end < count)
if (priv->len - priv->end < (gsize) count)
compact_buffer (stream);
base_stream = G_FILTER_INPUT_STREAM (stream)->base_stream;
@ -1072,10 +1072,10 @@ g_buffered_input_stream_real_fill_async (GBufferedInputStream *stream,
in_buffer = priv->end - priv->pos;
/* Never fill more than can fit in the buffer */
count = MIN (count, priv->len - in_buffer);
count = MIN ((gsize) count, priv->len - in_buffer);
/* If requested length does not fit at end, compact */
if (priv->len - priv->end < count)
if (priv->len - priv->end < (gsize) count)
compact_buffer (stream);
task = g_task_new (stream, cancellable, callback, user_data);

View File

@ -208,7 +208,7 @@ g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream,
if (priv->buffer)
{
size = MAX (size, priv->pos);
size = (priv->pos > 0) ? MAX (size, (gsize) priv->pos) : size;
buffer = g_malloc (size);
memcpy (buffer, priv->buffer, priv->pos);

View File

@ -233,18 +233,18 @@ g_credentials_to_string (GCredentials *credentials)
ret = g_string_new ("GCredentials:");
#if G_CREDENTIALS_USE_LINUX_UCRED
g_string_append (ret, "linux-ucred:");
if (credentials->native.pid != -1)
if (credentials->native.pid != (pid_t) -1)
g_string_append_printf (ret, "pid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.pid);
if (credentials->native.uid != -1)
if (credentials->native.uid != (uid_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.uid);
if (credentials->native.gid != -1)
if (credentials->native.gid != (gid_t) -1)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.gid);
if (ret->str[ret->len - 1] == ',')
ret->str[ret->len - 1] = '\0';
#elif G_CREDENTIALS_USE_APPLE_XUCRED
g_string_append (ret, "apple-xucred:");
g_string_append_printf (ret, "version=%u,", credentials->native.cr_version);
if (credentials->native.cr_uid != -1)
if (credentials->native.cr_uid != (uid_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.cr_uid);
for (i = 0; i < credentials->native.cr_ngroups; i++)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.cr_groups[i]);
@ -252,28 +252,28 @@ g_credentials_to_string (GCredentials *credentials)
ret->str[ret->len - 1] = '\0';
#elif G_CREDENTIALS_USE_FREEBSD_CMSGCRED
g_string_append (ret, "freebsd-cmsgcred:");
if (credentials->native.cmcred_pid != -1)
if (credentials->native.cmcred_pid != (pid_t) -1)
g_string_append_printf (ret, "pid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.cmcred_pid);
if (credentials->native.cmcred_euid != -1)
if (credentials->native.cmcred_euid != (uid_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.cmcred_euid);
if (credentials->native.cmcred_gid != -1)
if (credentials->native.cmcred_gid != (gid_t) -1)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.cmcred_gid);
#elif G_CREDENTIALS_USE_NETBSD_UNPCBID
g_string_append (ret, "netbsd-unpcbid:");
if (credentials->native.unp_pid != -1)
if (credentials->native.unp_pid != (pid_t) -1)
g_string_append_printf (ret, "pid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.unp_pid);
if (credentials->native.unp_euid != -1)
if (credentials->native.unp_euid != (uid_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.unp_euid);
if (credentials->native.unp_egid != -1)
if (credentials->native.unp_egid != (gid_t) -1)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.unp_egid);
ret->str[ret->len - 1] = '\0';
#elif G_CREDENTIALS_USE_OPENBSD_SOCKPEERCRED
g_string_append (ret, "openbsd-sockpeercred:");
if (credentials->native.pid != -1)
if (credentials->native.pid != (pid_t) -1)
g_string_append_printf (ret, "pid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.pid);
if (credentials->native.uid != -1)
if (credentials->native.uid != (uid_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.uid);
if (credentials->native.gid != -1)
if (credentials->native.gid != (gid_t) -1)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) credentials->native.gid);
if (ret->str[ret->len - 1] == ',')
ret->str[ret->len - 1] = '\0';
@ -281,11 +281,11 @@ g_credentials_to_string (GCredentials *credentials)
g_string_append (ret, "solaris-ucred:");
{
id_t id;
if ((id = ucred_getpid (credentials->native)) != -1)
if ((id = ucred_getpid (credentials->native)) != (id_t) -1)
g_string_append_printf (ret, "pid=%" G_GINT64_FORMAT ",", (gint64) id);
if ((id = ucred_geteuid (credentials->native)) != -1)
if ((id = ucred_geteuid (credentials->native)) != (id_t) -1)
g_string_append_printf (ret, "uid=%" G_GINT64_FORMAT ",", (gint64) id);
if ((id = ucred_getegid (credentials->native)) != -1)
if ((id = ucred_getegid (credentials->native)) != (id_t) -1)
g_string_append_printf (ret, "gid=%" G_GINT64_FORMAT ",", (gint64) id);
if (ret->str[ret->len - 1] == ',')
ret->str[ret->len - 1] = '\0';

View File

@ -274,8 +274,8 @@ valid_char (char c)
static char *
escape_byte_string (const char *str)
{
size_t len;
int num_invalid, i;
size_t i, len;
int num_invalid;
char *escaped_val, *p;
unsigned char c;
const char hex_digits[] = "0123456789abcdef";

View File

@ -694,7 +694,7 @@ g_file_info_remove_attribute (GFileInfo *info,
{
guint32 attr_id;
GFileAttribute *attrs;
int i;
guint i;
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
@ -1075,7 +1075,7 @@ g_file_info_create_value (GFileInfo *info,
guint32 attr_id)
{
GFileAttribute *attrs;
int i;
guint i;
if (info->mask != NO_ATTRIBUTE_MASK &&
!_g_file_attribute_matcher_matches_id (info->mask, attr_id))
@ -2619,7 +2619,7 @@ matcher_matches_id (GFileAttributeMatcher *matcher,
guint32 id)
{
SubMatcher *sub_matchers;
int i;
guint i;
if (matcher->sub_matchers)
{
@ -2696,8 +2696,8 @@ g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher,
const char *ns)
{
SubMatcher *sub_matchers;
int ns_id;
int i;
guint ns_id;
guint i;
g_return_val_if_fail (ns != NULL && *ns != '\0', FALSE);
@ -2738,7 +2738,7 @@ g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher,
const char *
g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher)
{
int i;
guint i;
SubMatcher *sub_matcher;
/* We return a NULL matcher for an empty match string, so handle this */

View File

@ -138,7 +138,7 @@ g_icon_to_string_tokenized (GIcon *icon, GString *s)
GPtrArray *tokens;
gint version;
GIconIface *icon_iface;
int i;
guint i;
g_return_val_if_fail (icon != NULL, FALSE);
g_return_val_if_fail (G_IS_ICON (icon), FALSE);