@@ -471,7 +471,9 @@ line_buffer::set_fd(auto_fd& fd)
471471 if (!hdr.empty ()) {
472472 this ->lb_header = std::move (hdr);
473473 }
474- this ->resize_buffer (INITIAL_COMPRESSED_BUFFER_SIZE );
474+ if (this ->lb_decompress_extra ) {
475+ this ->resize_buffer (INITIAL_COMPRESSED_BUFFER_SIZE );
476+ }
475477 }
476478#ifdef HAVE_BZLIB_H
477479 else if (gz_id[0 ] == ' B' && gz_id[1 ] == ' Z' )
@@ -486,7 +488,9 @@ line_buffer::set_fd(auto_fd& fd)
486488 * Loading data from a bzip2 file is pretty slow, so we try
487489 * to keep as much in memory as possible.
488490 */
489- this ->resize_buffer (INITIAL_COMPRESSED_BUFFER_SIZE );
491+ if (this ->lb_decompress_extra ) {
492+ this ->resize_buffer (INITIAL_COMPRESSED_BUFFER_SIZE );
493+ }
490494
491495 this ->lb_compressed_offset = 0 ;
492496 }
@@ -1038,7 +1042,9 @@ line_buffer::fill_range(file_off_t start,
10381042 * For compressed files, increase the buffer size so we
10391043 * don't have to spend as much time uncompressing the data.
10401044 */
1041- this ->resize_buffer (MAX_COMPRESSED_BUFFER_SIZE );
1045+ if (this ->lb_decompress_extra ) {
1046+ this ->resize_buffer (MAX_COMPRESSED_BUFFER_SIZE );
1047+ }
10421048 }
10431049 break ;
10441050
@@ -1298,6 +1304,9 @@ line_buffer::load_next_line(file_range prev_line)
12981304
12991305 offset += retval.li_file_range .fr_size ;
13001306
1307+ done = true ;
1308+ } else if (!retval.li_utf8_scan_result .is_valid ()) {
1309+ retval.li_partial = true ;
13011310 done = true ;
13021311 } else {
13031312 if (!this ->is_pipe () || !this ->is_pipe_closed ()) {
0 commit comments