generated from PlexSheep/baserepo
fix hedu limit offset
cargo devel CI / cargo CI (push) Has been cancelled
Details
cargo devel CI / cargo CI (push) Has been cancelled
Details
This commit is contained in:
parent
9f27db1ce3
commit
d1e888c138
|
@ -158,19 +158,14 @@ fn mask_chars(c: char) -> char {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rd_data(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
|
fn rd_data(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
|
||||||
config.rd_counter += config.len;
|
|
||||||
config.data_idx += config.len;
|
|
||||||
match data.read(&mut config.buf[config.alt_buf]) {
|
match data.read(&mut config.buf[config.alt_buf]) {
|
||||||
Ok(mut len) => {
|
Ok(mut len) => {
|
||||||
debug!(
|
trace!(
|
||||||
conf = format!("{:?}", config),
|
conf = format!("{:?}", config),
|
||||||
dif = (config.rd_counter as i64 - config.skip as i64),
|
eval = config.limit != 0 && config.rd_counter >= config.limit,
|
||||||
eval = (config.rd_counter as i64 - config.skip as i64) as usize >= config.limit,
|
|
||||||
"reached limit?"
|
"reached limit?"
|
||||||
);
|
);
|
||||||
if config.limit != 0
|
if config.limit != 0 && config.rd_counter + (BYTES_PER_LINE - 1) >= config.limit {
|
||||||
&& (config.rd_counter as i64 - config.skip as i64) as usize >= config.limit
|
|
||||||
{
|
|
||||||
trace!(
|
trace!(
|
||||||
conf = format!("{:?}", config),
|
conf = format!("{:?}", config),
|
||||||
nlen = (config.limit % BYTES_PER_LINE),
|
nlen = (config.limit % BYTES_PER_LINE),
|
||||||
|
@ -180,6 +175,8 @@ fn rd_data(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
|
||||||
config.stop = true;
|
config.stop = true;
|
||||||
}
|
}
|
||||||
config.len = len;
|
config.len = len;
|
||||||
|
config.rd_counter += config.len;
|
||||||
|
config.data_idx += config.len;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
Reference in New Issue