mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-03 12:19:20 +02:00
Modified Files: ChangeLog glib/giochannel.c
Modified Files: ChangeLog glib/giochannel.c * glib/giochannel.c: safer handling of errno, fixed a bug in an assert
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2001-08-12 Ron Steinke <rsteinke@w-link.net>
|
||||||
|
|
||||||
|
* glib/giochannel.c: safer handling of errno, fixed
|
||||||
|
a bug in an assert
|
||||||
|
|
||||||
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
Sun Aug 12 10:09:00 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* tests/iochannel-test.c (main): Find test case for
|
* tests/iochannel-test.c (main): Find test case for
|
||||||
|
@@ -758,7 +758,7 @@ g_io_channel_seek_position (GIOChannel* channel,
|
|||||||
offset -= channel->read_buf->len;
|
offset -= channel->read_buf->len;
|
||||||
if (channel->encoded_read_buf)
|
if (channel->encoded_read_buf)
|
||||||
{
|
{
|
||||||
g_assert (channel->encoded_read_buf->len == 0 && !channel->do_encode);
|
g_assert (channel->encoded_read_buf->len == 0 || !channel->do_encode);
|
||||||
|
|
||||||
/* If there's anything here, it's because the encoding is UTF-8,
|
/* If there's anything here, it's because the encoding is UTF-8,
|
||||||
* so we can just subtract the buffer length, the same as for
|
* so we can just subtract the buffer length, the same as for
|
||||||
@@ -1011,7 +1011,7 @@ g_io_channel_set_encoding (GIOChannel *channel,
|
|||||||
else
|
else
|
||||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
||||||
_("Could not open converter from `%s' to `%s': %s"),
|
_("Could not open converter from `%s' to `%s': %s"),
|
||||||
from_enc, to_enc, strerror (errno));
|
from_enc, to_enc, strerror (err));
|
||||||
|
|
||||||
if (read_cd != (GIConv) -1)
|
if (read_cd != (GIConv) -1)
|
||||||
g_iconv_close (read_cd);
|
g_iconv_close (read_cd);
|
||||||
@@ -1126,6 +1126,7 @@ g_io_channel_fill_buffer (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
size_t errnum, inbytes_left, outbytes_left;
|
size_t errnum, inbytes_left, outbytes_left;
|
||||||
gchar *inbuf, *outbuf;
|
gchar *inbuf, *outbuf;
|
||||||
|
int errval;
|
||||||
|
|
||||||
g_assert (channel->encoded_read_buf);
|
g_assert (channel->encoded_read_buf);
|
||||||
|
|
||||||
@@ -1144,6 +1145,12 @@ reencode:
|
|||||||
|
|
||||||
errnum = g_iconv (channel->read_cd, &inbuf, &inbytes_left,
|
errnum = g_iconv (channel->read_cd, &inbuf, &inbytes_left,
|
||||||
&outbuf, &outbytes_left);
|
&outbuf, &outbytes_left);
|
||||||
|
errval = errno;
|
||||||
|
|
||||||
|
g_assert (inbuf + inbytes_left == channel->read_buf->str
|
||||||
|
+ channel->read_buf->len);
|
||||||
|
g_assert (outbuf + outbytes_left == channel->encoded_read_buf->str
|
||||||
|
+ channel->encoded_read_buf->len);
|
||||||
|
|
||||||
g_string_erase (channel->read_buf, 0,
|
g_string_erase (channel->read_buf, 0,
|
||||||
channel->read_buf->len - inbytes_left);
|
channel->read_buf->len - inbytes_left);
|
||||||
@@ -1152,7 +1159,7 @@ reencode:
|
|||||||
|
|
||||||
if (errnum == (size_t) -1)
|
if (errnum == (size_t) -1)
|
||||||
{
|
{
|
||||||
switch (errno)
|
switch (errval)
|
||||||
{
|
{
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
if ((oldlen == channel->encoded_read_buf->len)
|
if ((oldlen == channel->encoded_read_buf->len)
|
||||||
@@ -1177,8 +1184,9 @@ reencode:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
g_assert (errval != EBADF); /* The converter should be open */
|
||||||
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
||||||
_("Error during conversion: %s"), strerror (errno));
|
_("Error during conversion: %s"), strerror (errval));
|
||||||
return G_IO_STATUS_ERROR;
|
return G_IO_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2021,7 +2029,7 @@ reconvert:
|
|||||||
return G_IO_STATUS_ERROR;
|
return G_IO_STATUS_ERROR;
|
||||||
default:
|
default:
|
||||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
|
||||||
_("Error during conversion: %s"), strerror (errno));
|
_("Error during conversion: %s"), strerror (errnum));
|
||||||
if (from_buf_len >= left_len + from_buf_old_len)
|
if (from_buf_len >= left_len + from_buf_old_len)
|
||||||
wrote_bytes += from_buf_len - left_len - from_buf_old_len;
|
wrote_bytes += from_buf_len - left_len - from_buf_old_len;
|
||||||
if (bytes_written)
|
if (bytes_written)
|
||||||
|
Reference in New Issue
Block a user