mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
gio: Update GMemoryOutputStream length after truncate
For GMemoryOutputStream, update valid_len when truncating so that g_memory_output_stream_get_data_size () returns the correct result. https://bugzilla.gnome.org/show_bug.cgi?id=720080
This commit is contained in:
parent
c34cc2348c
commit
3b9ad6e6ef
@ -828,6 +828,8 @@ g_memory_output_stream_truncate (GSeekable *seekable,
|
||||
if (!array_resize (ostream, offset, FALSE, error))
|
||||
return FALSE;
|
||||
|
||||
ostream->priv->valid_len = offset;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,11 @@ test_truncate (void)
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
g_test_bug ("720080");
|
||||
|
||||
g_seekable_truncate (G_SEEKABLE (mo), 8192, NULL, &error);
|
||||
g_assert_cmpint (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mo)), ==, 8192);
|
||||
|
||||
g_object_unref (o);
|
||||
g_object_unref (mo);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user