dj(1): fix infiniskipping

This commit is contained in:
dtb 2024-07-08 22:48:16 -06:00
parent bf06e91be5
commit 0df2c9f566
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -263,11 +263,11 @@ int main(int argc, char *argv[]){
assert(io[0].bufuse == 0);
{ /* read */
char skipping;
long skipping;
size_t t;
/* hack to intentionally get a partial read from Io_read */
if((skipping = (io[0].seek > 0)) && io[0].seek < io[0].bs)
if((skipping = MIN(io[0].seek, io[0].bs)) > 0)
io[0].bufuse = io[0].bs - io[0].seek;
t = io[0].bufuse;
@ -290,7 +290,8 @@ int main(int argc, char *argv[]){
}
}
if(skipping){
if(skipping > 0){
io[0].seek -= skipping;
io[0].bufuse = 0;
count += (count != 0);
continue;