Merge branch 'fixing_warnings' into 'master'

Fixing warnings

See merge request GNOME/glib!622
This commit is contained in:
Philip Withnall 2019-01-31 13:15:23 +00:00
commit 097dc30ad9
8 changed files with 16 additions and 15 deletions

View File

@ -171,7 +171,7 @@ struct _GStaticRecMutex
} unused;
};
#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } }
GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init)
void g_static_rec_mutex_init (GStaticRecMutex *mutex);

View File

@ -907,7 +907,7 @@ struct _GRealPtrArray
*/
static void g_ptr_array_maybe_expand (GRealPtrArray *array,
gint len);
guint len);
/**
* g_ptr_array_new:
@ -1166,7 +1166,7 @@ ptr_array_free (GPtrArray *array,
static void
g_ptr_array_maybe_expand (GRealPtrArray *array,
gint len)
guint len)
{
/* Detect potential overflow */
if G_UNLIKELY ((G_MAXUINT - array->len) < len)
@ -1519,7 +1519,7 @@ g_ptr_array_insert (GPtrArray *array,
if (index_ < 0)
index_ = rarray->len;
if (index_ < rarray->len)
if ((guint) index_ < rarray->len)
memmove (&(rarray->pdata[index_ + 1]),
&(rarray->pdata[index_]),
(rarray->len - index_) * sizeof (gpointer));

View File

@ -177,8 +177,7 @@ static gchar *
digest_to_string (guint8 *digest,
gsize digest_len)
{
gint len = digest_len * 2;
gint i;
gsize i, len = digest_len * 2;
gchar *retval;
retval = g_new (gchar, len + 1);

View File

@ -222,7 +222,7 @@ static void
g_datalist_clear_i (GData **datalist)
{
GData *data;
gint i;
guint i;
data = G_DATALIST_GET_POINTER (datalist);
G_DATALIST_SET_POINTER (datalist, NULL);
@ -254,7 +254,7 @@ void
g_datalist_clear (GData **datalist)
{
GData *data;
gint i;
guint i;
g_return_if_fail (datalist != NULL);
@ -1119,7 +1119,7 @@ g_datalist_foreach (GData **datalist,
gpointer user_data)
{
GData *d;
int i, j, len;
guint i, j, len;
GQuark *keys;
g_return_if_fail (datalist != NULL);

View File

@ -1729,7 +1729,7 @@ g_date_add_months (GDate *d,
years = nmonths/12;
months = nmonths%12;
g_return_if_fail (years <= G_MAXUINT16 - d->year);
g_return_if_fail (years <= (guint) (G_MAXUINT16 - d->year));
d->month = months + 1;
d->year += years;
@ -1813,7 +1813,7 @@ g_date_add_years (GDate *d,
g_date_update_dmy (d);
g_return_if_fail (d->dmy != 0);
g_return_if_fail (nyears <= G_MAXUINT16 - d->year);
g_return_if_fail (nyears <= (guint) (G_MAXUINT16 - d->year));
d->year += nyears;

View File

@ -1134,7 +1134,8 @@ g_date_time_new_from_timeval_utc (const GTimeVal *tv)
static gboolean
get_iso8601_int (const gchar *text, gsize length, gint *value)
{
gint i, v = 0;
gsize i;
guint v = 0;
if (length < 1 || length > 4)
return FALSE;
@ -1155,7 +1156,7 @@ get_iso8601_int (const gchar *text, gsize length, gint *value)
static gboolean
get_iso8601_seconds (const gchar *text, gsize length, gdouble *value)
{
gint i;
gsize i;
gdouble divisor = 1, v = 0;
if (length < 2)
@ -2803,7 +2804,7 @@ initialize_alt_digits (void)
if (digit == NULL)
return NULL;
g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
g_assert (digit_len < (gsize) (buffer + sizeof (buffer) - buffer_end));
alt_digits[i] = buffer_end;
buffer_end = g_stpcpy (buffer_end, digit);

View File

@ -69,7 +69,7 @@ static const char*
sindent (guint n)
{
static const char spaces[] = " ";
int l = sizeof (spaces) - 1;
gsize l = sizeof (spaces) - 1;
n = MIN (n, l);
return spaces + l - n;
}

View File

@ -355,6 +355,7 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
# building with -Wbad-function-cast.
'-Wno-bad-function-cast',
'-Wno-cast-function-type',
# Due to function casts through (void*) we cannot support -Wpedantic:
# https://wiki.gnome.org/Projects/GLib/CompilerRequirements#Function_pointer_conversions.
'-Wno-pedantic',