|
@@ -59,12 +59,11 @@ namespace GtkCommonMark {
|
|
|
var reader = new GtkCommonMark.Reader(buffer, this, tag_manager);
|
|
|
reader.widget_embedded.connect(on_widget_embedded);
|
|
|
|
|
|
- var buffer = new uint8[1048576]; // TODO read properly in loop
|
|
|
- size_t bytes_read;
|
|
|
- stream.read_all(buffer, out bytes_read);
|
|
|
- buffer.length = (int)bytes_read;
|
|
|
-
|
|
|
- reader.read_data(buffer);
|
|
|
+ MemoryOutputStream os = new MemoryOutputStream (null, GLib.realloc, GLib.free);
|
|
|
+ os.splice (stream, OutputStreamSpliceFlags.CLOSE_TARGET);
|
|
|
+ var data = os.steal_data();
|
|
|
+ data.length = (int) os.get_data_size ();
|
|
|
+ reader.read_data(data);
|
|
|
}
|
|
|
|
|
|
protected string? link_at_buffer_location(int x, int y) {
|