Skip to content

Commit

Permalink
Use MultiGzDecoder to deal with multi-member gzip files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarx committed Dec 9, 2023
1 parent a904c63 commit 91af52f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions helpers/rust/src/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
types::{self, sitelinks, ClassRecord, DataFile, DumpStatistics, Item, Settings, Statistics},
};
use anyhow::{Context, Result};
use flate2::read::GzDecoder;
use flate2::read::MultiGzDecoder;
use std::{
cmp::Ordering,
collections::HashMap,
Expand Down Expand Up @@ -101,7 +101,7 @@ pub(super) fn process_dump(settings: &Settings) -> Result<()> {
);

let dump = File::open(dump_info.path.as_path())?;
let decoder = GzDecoder::new(dump);
let decoder = MultiGzDecoder::new(dump);
let mut reader = BufReader::new(decoder);
let mut line = String::new();

Expand All @@ -121,9 +121,9 @@ pub(super) fn process_dump(settings: &Settings) -> Result<()> {

loop {
line.clear();
let read = reader.read_line(&mut line)?;
let read_bytes = reader.read_line(&mut line)?;

if read == 0 || line.starts_with(']') {
if read_bytes == 0 || line.starts_with(']') {
break;
}

Expand Down

0 comments on commit 91af52f

Please sign in to comment.