mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-08 18:36:17 +01:00
Merge branch 'fix_more_windows_warnings' into 'main'
Fix windows warnings See merge request GNOME/glib!2294
This commit is contained in:
commit
e212c5a28d
@ -2588,7 +2588,8 @@ win32_strftime_helper (const GDate *d,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slen <= convlen)
|
g_assert (convlen >= 0);
|
||||||
|
if ((gsize) convlen >= slen)
|
||||||
{
|
{
|
||||||
/* Ensure only whole characters are copied into the buffer. */
|
/* Ensure only whole characters are copied into the buffer. */
|
||||||
gchar *end = g_utf8_find_prev_char (convbuf, convbuf + slen);
|
gchar *end = g_utf8_find_prev_char (convbuf, convbuf + slen);
|
||||||
|
@ -349,7 +349,7 @@ g_file_test (const gchar *filename,
|
|||||||
GFileTest test)
|
GFileTest test)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
int attributes;
|
DWORD attributes;
|
||||||
wchar_t *wfilename;
|
wchar_t *wfilename;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2875,7 +2875,7 @@ g_get_current_dir (void)
|
|||||||
|
|
||||||
gchar *dir = NULL;
|
gchar *dir = NULL;
|
||||||
wchar_t dummy[2], *wdir;
|
wchar_t dummy[2], *wdir;
|
||||||
int len;
|
DWORD len;
|
||||||
|
|
||||||
len = GetCurrentDirectoryW (2, dummy);
|
len = GetCurrentDirectoryW (2, dummy);
|
||||||
wdir = g_new (wchar_t, len);
|
wdir = g_new (wchar_t, len);
|
||||||
|
@ -1023,7 +1023,9 @@ GSourceFuncs g_io_watch_funcs = {
|
|||||||
g_io_win32_prepare,
|
g_io_win32_prepare,
|
||||||
g_io_win32_check,
|
g_io_win32_check,
|
||||||
g_io_win32_dispatch,
|
g_io_win32_dispatch,
|
||||||
g_io_win32_finalize
|
g_io_win32_finalize,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static GIOStatus
|
static GIOStatus
|
||||||
|
14
glib/gpoll.c
14
glib/gpoll.c
@ -135,7 +135,7 @@ poll_rest (GPollFD *msg_fd,
|
|||||||
HANDLE *handles,
|
HANDLE *handles,
|
||||||
GPollFD *handle_to_fd[],
|
GPollFD *handle_to_fd[],
|
||||||
gint nhandles,
|
gint nhandles,
|
||||||
gint timeout_ms)
|
DWORD timeout_ms)
|
||||||
{
|
{
|
||||||
DWORD ready;
|
DWORD ready;
|
||||||
GPollFD *f;
|
GPollFD *f;
|
||||||
@ -147,7 +147,7 @@ poll_rest (GPollFD *msg_fd,
|
|||||||
* -> Use MsgWaitForMultipleObjectsEx
|
* -> Use MsgWaitForMultipleObjectsEx
|
||||||
*/
|
*/
|
||||||
if (_g_main_poll_debug)
|
if (_g_main_poll_debug)
|
||||||
g_print (" MsgWaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout_ms);
|
g_print (" MsgWaitForMultipleObjectsEx(%d, %lu)\n", nhandles, timeout_ms);
|
||||||
|
|
||||||
ready = MsgWaitForMultipleObjectsEx (nhandles, handles, timeout_ms,
|
ready = MsgWaitForMultipleObjectsEx (nhandles, handles, timeout_ms,
|
||||||
QS_ALLINPUT, MWMO_ALERTABLE);
|
QS_ALLINPUT, MWMO_ALERTABLE);
|
||||||
@ -177,7 +177,7 @@ poll_rest (GPollFD *msg_fd,
|
|||||||
* -> Use WaitForMultipleObjectsEx
|
* -> Use WaitForMultipleObjectsEx
|
||||||
*/
|
*/
|
||||||
if (_g_main_poll_debug)
|
if (_g_main_poll_debug)
|
||||||
g_print (" WaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout_ms);
|
g_print (" WaitForMultipleObjectsEx(%d, %lu)\n", nhandles, timeout_ms);
|
||||||
|
|
||||||
ready = WaitForMultipleObjectsEx (nhandles, handles, FALSE, timeout_ms, TRUE);
|
ready = WaitForMultipleObjectsEx (nhandles, handles, FALSE, timeout_ms, TRUE);
|
||||||
if (ready == WAIT_FAILED)
|
if (ready == WAIT_FAILED)
|
||||||
@ -216,7 +216,7 @@ poll_rest (GPollFD *msg_fd,
|
|||||||
recursed_result = poll_rest (NULL, stop_fd, handles, handle_to_fd, nhandles, 0);
|
recursed_result = poll_rest (NULL, stop_fd, handles, handle_to_fd, nhandles, 0);
|
||||||
return (recursed_result == -1) ? -1 : 1 + recursed_result;
|
return (recursed_result == -1) ? -1 : 1 + recursed_result;
|
||||||
}
|
}
|
||||||
else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles)
|
else if (ready < WAIT_OBJECT_0 + nhandles)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ typedef struct
|
|||||||
GPollFD *msg_fd;
|
GPollFD *msg_fd;
|
||||||
GPollFD *stop_fd;
|
GPollFD *stop_fd;
|
||||||
gint nhandles;
|
gint nhandles;
|
||||||
gint timeout_ms;
|
DWORD timeout_ms;
|
||||||
} GWin32PollThreadData;
|
} GWin32PollThreadData;
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -295,7 +295,7 @@ poll_single_thread (GWin32PollThreadData *data)
|
|||||||
static void
|
static void
|
||||||
fill_poll_thread_data (GPollFD *fds,
|
fill_poll_thread_data (GPollFD *fds,
|
||||||
guint nfds,
|
guint nfds,
|
||||||
gint timeout_ms,
|
DWORD timeout_ms,
|
||||||
GPollFD *stop_fd,
|
GPollFD *stop_fd,
|
||||||
GWin32PollThreadData *data)
|
GWin32PollThreadData *data)
|
||||||
{
|
{
|
||||||
@ -474,7 +474,7 @@ g_poll (GPollFD *fds,
|
|||||||
for (i = 0; i < nthreads; i++)
|
for (i = 0; i < nthreads; i++)
|
||||||
{
|
{
|
||||||
if (GetExitCodeThread (thread_handles[i], &thread_retval))
|
if (GetExitCodeThread (thread_handles[i], &thread_retval))
|
||||||
retval = retval == -1 ? -1 : thread_retval == -1 ? -1 : retval + thread_retval;
|
retval = (retval == -1) ? -1 : ((thread_retval == (DWORD) -1) ? -1 : (int) (retval + thread_retval));
|
||||||
|
|
||||||
CloseHandle (thread_handles[i]);
|
CloseHandle (thread_handles[i]);
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ read_helper_report (int fd,
|
|||||||
gintptr report[2],
|
gintptr report[2],
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gint bytes = 0;
|
gsize bytes = 0;
|
||||||
|
|
||||||
while (bytes < sizeof(gintptr)*2)
|
while (bytes < sizeof(gintptr)*2)
|
||||||
{
|
{
|
||||||
|
@ -760,7 +760,7 @@ _g_win32_stat_utf8 (const gchar *filename,
|
|||||||
len--;
|
len--;
|
||||||
|
|
||||||
if (len <= 0 ||
|
if (len <= 0 ||
|
||||||
(g_path_is_absolute (filename) && len <= g_path_skip_root (filename) - filename))
|
(g_path_is_absolute (filename) && len <= (gsize) (g_path_skip_root (filename) - filename)))
|
||||||
len = strlen (filename);
|
len = strlen (filename);
|
||||||
|
|
||||||
wfilename = g_utf8_to_utf16 (filename, len, NULL, NULL, NULL);
|
wfilename = g_utf8_to_utf16 (filename, len, NULL, NULL, NULL);
|
||||||
@ -893,7 +893,7 @@ g_win32_readlink_utf8 (const gchar *filename,
|
|||||||
return tmp_len;
|
return tmp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_len > buf_size)
|
if ((gsize) tmp_len > buf_size)
|
||||||
tmp_len = buf_size;
|
tmp_len = buf_size;
|
||||||
|
|
||||||
memcpy (buf, tmp, tmp_len);
|
memcpy (buf, tmp, tmp_len);
|
||||||
|
@ -1680,7 +1680,7 @@ utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
|
|||||||
* Use MLang instead.
|
* Use MLang instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ISO2022_MODE(cs, shift) (((cs) << 8) | (shift))
|
#define ISO2022_MODE(cs, shift) ((((DWORD) cs) << 8) | (shift))
|
||||||
#define ISO2022_MODE_CS(mode) (((mode) >> 8) & 0xFF)
|
#define ISO2022_MODE_CS(mode) (((mode) >> 8) & 0xFF)
|
||||||
#define ISO2022_MODE_SHIFT(mode) ((mode) & 0xFF)
|
#define ISO2022_MODE_SHIFT(mode) ((mode) & 0xFF)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user