Merge branch 'fix_all_warnings' into 'main'

Fix final warnings in Windows code

See merge request GNOME/glib!2323
This commit is contained in:
Philip Withnall 2021-11-17 15:15:46 +00:00
commit b09ccc4635
6 changed files with 12 additions and 13 deletions

View File

@ -59,7 +59,7 @@ get_registry_classes_key (const char *subdir,
if (key_type == REG_EXPAND_SZ) if (key_type == REG_EXPAND_SZ)
{ {
wchar_t dummy[1]; wchar_t dummy[1];
int len = ExpandEnvironmentStringsW (wc_temp, dummy, 1); DWORD len = ExpandEnvironmentStringsW (wc_temp, dummy, 1);
if (len > 0) if (len > 0)
{ {
wchar_t *wc_temp_expanded = g_new (wchar_t, len); wchar_t *wc_temp_expanded = g_new (wchar_t, len);

View File

@ -429,8 +429,8 @@ g_input_stream_real_skip (GInputStream *stream,
end = g_seekable_tell (seekable); end = g_seekable_tell (seekable);
g_assert (start >= 0); g_assert (start >= 0);
g_assert (end >= start); g_assert (end >= start);
if ((guint64) start > (G_MAXSIZE - count) || if (start > (goffset) (G_MAXOFFSET - count) ||
(start + count) > (guint64) end) (goffset) (start + count) > end)
{ {
stream->priv->pending = TRUE; stream->priv->pending = TRUE;
return end - start; return end - start;

View File

@ -3359,7 +3359,7 @@ uwp_package_cb (gpointer user_data,
GPtrArray *supported_extgroups, GPtrArray *supported_extgroups,
GPtrArray *supported_protocols) GPtrArray *supported_protocols)
{ {
gint i, i_verb, i_ext; guint i, i_verb, i_ext;
gint extensions_considered; gint extensions_considered;
GWin32AppInfoApplication *app; GWin32AppInfoApplication *app;
gchar *app_user_model_id_u8; gchar *app_user_model_id_u8;
@ -3459,7 +3459,7 @@ uwp_package_cb (gpointer user_data,
*/ */
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &ext)) while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &ext))
{ {
gint i_hverb; guint i_hverb;
if (!ext) if (!ext)
continue; continue;
@ -3537,7 +3537,7 @@ uwp_package_cb (gpointer user_data,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &url)) while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &url))
{ {
gint i_hverb; guint i_hverb;
if (!url) if (!url)
continue; continue;
@ -4788,7 +4788,7 @@ g_win32_app_info_launch_internal (GWin32AppInfo *info,
if (apppath) if (apppath)
{ {
gchar **p; gchar **p;
gint p_index; gsize p_index;
for (p = envp, p_index = 0; p[0]; p++, p_index++) for (p = envp, p_index = 0; p[0]; p++, p_index++)
if ((p[0][0] == 'p' || p[0][0] == 'P') && if ((p[0][0] == 'p' || p[0][0] == 'P') &&

View File

@ -96,7 +96,7 @@ static BOOL
WIN32_FROM_HRESULT (HRESULT hresult, WIN32_FROM_HRESULT (HRESULT hresult,
DWORD *win32_error_code) DWORD *win32_error_code)
{ {
if ((hresult & 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) || if ((hresult & (HRESULT) 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) ||
hresult == S_OK) hresult == S_OK)
{ {
*win32_error_code = HRESULT_CODE (hresult); *win32_error_code = HRESULT_CODE (hresult);

View File

@ -79,7 +79,6 @@ main (int argc, char **argv)
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
argv = g_win32_get_command_line (); argv = g_win32_get_command_line ();
argc = g_strv_length (argv);
#endif #endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");

View File

@ -574,7 +574,7 @@ static inline gunichar
g_utf8_get_char_extended (const gchar *p, g_utf8_get_char_extended (const gchar *p,
gssize max_len) gssize max_len)
{ {
guint i, len; gsize i, len;
gunichar min_code; gunichar min_code;
gunichar wc = (guchar) *p; gunichar wc = (guchar) *p;
const gunichar partial_sequence = (gunichar) -2; const gunichar partial_sequence = (gunichar) -2;
@ -623,9 +623,9 @@ g_utf8_get_char_extended (const gchar *p,
return malformed_sequence; return malformed_sequence;
} }
if (G_UNLIKELY (max_len >= 0 && len > max_len)) if (G_UNLIKELY (max_len >= 0 && len > (gsize) max_len))
{ {
for (i = 1; i < max_len; i++) for (i = 1; i < (gsize) max_len; i++)
{ {
if ((((guchar *)p)[i] & 0xc0) != 0x80) if ((((guchar *)p)[i] & 0xc0) != 0x80)
return malformed_sequence; return malformed_sequence;