From: Owen Taylor Date: Wed, 19 Sep 2001 17:06:14 +0000 (+0000) Subject: Handle NUL bytes_written, bytes_read. (Suggested by Joshua N Pritikin, X-Git-Tag: GLIB_1_3_9~94 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=031a4b0f46256868a190939515fbd961015d2651;p=platform%2Fupstream%2Fglib.git Handle NUL bytes_written, bytes_read. (Suggested by Joshua N Pritikin, Wed Sep 19 13:03:38 2001 Owen Taylor * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) --- diff --git a/ChangeLog b/ChangeLog index fb5964c..4d21157 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index fb5964c..4d21157 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Wed Sep 19 13:03:38 2001 Owen Taylor + + * glib/giochannel.c (g_io_channel_read/write_chars): Handle NUL + bytes_written, bytes_read. (Suggested by Joshua N Pritikin, #59550) + Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of diff --git a/glib/giochannel.c b/glib/giochannel.c index 50bd8e9..bebab83 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -907,9 +907,9 @@ g_io_channel_flush (GIOChannel *channel, g_assert (this_time > 0); status = channel->funcs->io_write (channel, - channel->write_buf->str + bytes_written, - channel->write_buf->len - bytes_written, - &this_time, error); + channel->write_buf->str + bytes_written, + channel->write_buf->len - bytes_written, + &this_time, error); bytes_written += this_time; } while ((bytes_written < channel->write_buf->len) @@ -1722,9 +1722,16 @@ g_io_channel_read_chars (GIOChannel *channel, if (!channel->use_buffer) { + gint tmp_bytes; + g_assert (!channel->read_buf || channel->read_buf->len == 0); - return channel->funcs->io_read (channel, buf, count, bytes_read, error); + status = channel->funcs->io_read (channel, buf, count, &tmp_bytes, error); + + if (bytes_read) + *bytes_read = tmp_bytes; + + return status; } status = G_IO_STATUS_NORMAL; @@ -1907,9 +1914,17 @@ g_io_channel_write_chars (GIOChannel *channel, if (!channel->use_buffer) { + gint tmp_bytes; + g_assert (!channel->write_buf || channel->write_buf->len == 0); g_assert (channel->partial_write_buf[0] == '\0'); - return channel->funcs->io_write (channel, buf, count, bytes_written, error); + + status = channel->funcs->io_write (channel, buf, count, &tmp_bytes, error); + + if (bytes_written) + *bytes_written = tmp_bytes; + + return status; } /* General case */