mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-16 09:16:15 +01:00
win32: make sure bytes_read/written is set to 0 on error
If we fail to PeekMessage or PostMessage we should make sure that the output parameter bytes_read/written is set 0 instead of being left uninitialized. This fixes an assertion in the io channel call where the following invariant is checked: (status == G_IO_STATUS_NORMAL) || (read_size == 0)
This commit is contained in:
parent
3bb8294e00
commit
50d704ab8f
@ -1033,7 +1033,9 @@ g_io_win32_msg_read (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
||||||
MSG msg; /* In case of alignment problems */
|
MSG msg; /* In case of alignment problems */
|
||||||
|
|
||||||
|
*bytes_read = 0;
|
||||||
|
|
||||||
if (count < sizeof (MSG))
|
if (count < sizeof (MSG))
|
||||||
{
|
{
|
||||||
g_set_error_literal (err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
|
g_set_error_literal (err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
|
||||||
@ -1062,7 +1064,9 @@ g_io_win32_msg_write (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
|
*bytes_written = 0;
|
||||||
|
|
||||||
if (count != sizeof (MSG))
|
if (count != sizeof (MSG))
|
||||||
{
|
{
|
||||||
g_set_error_literal (err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
|
g_set_error_literal (err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user