From 4038aa23ab80bf52e98ffe69442ccd5e0cf79a89 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 23 Mar 2017 09:02:34 +0100 Subject: fixed and optimized piping very large buffers via EC/EG * test case: HECcat$ on a large buffer (>= 64kb) truncates the buffer or repeats its beginning * it turns out that the incremental writing to the process' stdin was broken. We were always writing data from the beginning of the buffer which fails if the stdin watcher must be activated more than once. * Also, EOLWriter::convert() can validly return 0, even if bytes have been written on the data sink, so this value cannot be used to check whether the process has closed its stdin. We now make sure that the entire buffer range is written to stdin. * Piping large buffers no longer removes the buffer gap. This makes little difference when filtering via EC since it will change the buffer gap anyway. Can make a huge difference when not touching the buffer, though (e.g. HEGAcat$). * I did not add a test suite case since that requires a very large test file and it cannot be easily generated automatically. --- src/eol.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/eol.cpp') diff --git a/src/eol.cpp b/src/eol.cpp index 85c69ba..de503e5 100644 --- a/src/eol.cpp +++ b/src/eol.cpp @@ -249,8 +249,7 @@ EOLReaderMem::convert_all(gsize *out_len) * * @param buffer The buffer to convert. * @parem buffer_len The length of the data in buffer. - * @return The number of bytes written to the data sink, - * i.e. the size of the EOL-normalized data written. + * @return The number of bytes consumed/converted from buffer. */ gsize EOLWriter::convert(const gchar *buffer, gsize buffer_len) -- cgit v1.2.3