From e9594732345b89ac675ec0bc46e6b07314637b37 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 1 Dec 2008 19:02:58 +0000 Subject: [PATCH] Revert behaviour change in g_data_input_stream_read_line svn path=/trunk/; revision=7720 --- gio/ChangeLog | 6 ++++++ gio/gdatainputstream.c | 4 ++-- gio/tests/data-input-stream.c | 6 +----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 0eba92a..d34de39 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,11 @@ 2008-12-01 Matthias Clasen + * gdatainputstream.c (g_data_input_stream_read_line): Revert the + behaviour change, and update the docs instead, to avoid breaking + existing users. + +2008-12-01 Matthias Clasen + * === Released 2.19.1 === 2008-12-01 Alexander Larsson diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c index 967c67b..6b0a978 100644 --- a/gio/gdatainputstream.c +++ b/gio/gdatainputstream.c @@ -739,7 +739,7 @@ scan_for_newline (GDataInputStream *stream, * triggering the cancellable object from another thread. If the operation * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. * - * Returns: a string with the line that was read in (including the newlines). + * Returns: a string with the line that was read in (without the newlines). * Set @length to a #gsize to get the length of the read line. * On an error, it will return %NULL and @error will be set. If there's no * content to read, it will still return %NULL, but @error won't be set. @@ -803,7 +803,7 @@ g_data_input_stream_read_line (GDataInputStream *stream, if (length) *length = (gsize)found_pos; g_warn_if_fail (res == found_pos + newline_len); - line[found_pos + newline_len] = 0; + line[found_pos] = 0; return line; } diff --git a/gio/tests/data-input-stream.c b/gio/tests/data-input-stream.c index 5a44148..d1385ca 100644 --- a/gio/tests/data-input-stream.c +++ b/gio/tests/data-input-stream.c @@ -87,12 +87,8 @@ test_read_lines (GDataStreamNewlineType newline_type) data = g_data_input_stream_read_line (G_DATA_INPUT_STREAM (stream), &length, NULL, &error); if (data) { - char *expected; - - expected = g_strconcat (lines[line], endl[newline_type], NULL); - g_assert_cmpstr (data, ==, expected); + g_assert_cmpstr (data, ==, lines[line]); g_assert_no_error (error); - g_free (expected); line++; } } -- 2.7.4