Commit e449a91b authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Bug 547481 – g_data_input_stream_read_line behaves not as stated in the

2008-11-28  Matthias Clasen  <mclasen@redhat.com>

        Bug 547481 – g_data_input_stream_read_line behaves not as stated in
        the docs

        * gdatainputstream.c (g_data_input_stream_read_line): Behave as
        documented and include the line end in the returned string.
        Pointed out by Paul Pogonyshev.

        * tests/data-input-stream.c: Fix the read_line test to test the
        documented behaviour.



svn path=/trunk/; revision=7694
parent 688b2e0e
2008-11-28 Matthias Clasen <mclasen@redhat.com>
Bug 547481 – g_data_input_stream_read_line behaves not as stated in
the docs
* gdatainputstream.c (g_data_input_stream_read_line): Behave as
documented and include the line end in the returned string.
Pointed out by Paul Pogonyshev.
* tests/data-input-stream.c: Fix the read_line test to test the
documented behaviour.
2008-11-28 Matthias Clasen <mclasen@redhat.com>
* gdesktopappinfo.c (g_app_info_can_delete): Only allow deleting
......
......@@ -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] = 0;
line[found_pos + newline_len] = 0;
return line;
}
......
......@@ -87,8 +87,12 @@ test_read_lines (GDataStreamNewlineType newline_type)
data = g_data_input_stream_read_line (G_DATA_INPUT_STREAM (stream), &length, NULL, &error);
if (data)
{
g_assert_cmpstr (data, ==, lines[line]);
char *expected;
expected = g_strconcat (lines[line], endl[newline_type], NULL);
g_assert_cmpstr (data, ==, expected);
g_assert_no_error (error);
g_free (expected);
line++;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment