@@ -1508,8 +1508,6 @@ bool Par2Repairer::ScanDataFile(DiskFile *diskfile, // [in]
15081508 // Which block do we expect to find first
15091509 const VerificationHashEntry *nextentry = 0 ;
15101510
1511- u64 progress = 0 ;
1512-
15131511 // How far will we scan the file (1 byte at a time)
15141512 // before skipping ahead looking for the next block
15151513 u64 scandistance = min (skipleaway<<1 , blocksize);
@@ -1528,20 +1526,30 @@ bool Par2Repairer::ScanDataFile(DiskFile *diskfile, // [in]
15281526
15291527 bool progressline = false ;
15301528
1529+ u64 oldoffset = 0 ;
1530+ u64 printprogress = 0 ;
1531+
15311532 // Whilst we have not reached the end of the file
15321533 while (filechecksummer.Offset () < diskfile->FileSize ())
15331534 {
15341535 if (noiselevel > CommandLine::nlQuiet)
15351536 {
1536- // Update a progress indicator
1537- u32 oldfraction = (u32 )(1000 * progress / diskfile->FileSize ());
1538- u32 newfraction = (u32 )(1000 * (progress = filechecksummer.Offset ()) / diskfile->FileSize ());
1539- if (oldfraction != newfraction)
1537+ // Update progress indicator
1538+ printprogress += filechecksummer.Offset () - oldoffset;
1539+ if (printprogress == blocksize || filechecksummer.ShortBlock ())
15401540 {
1541- cout << " Scanning: \" " << shortname << " \" : " << newfraction/10 << ' .' << newfraction%10 << " %\r " << flush;
1541+ u32 oldfraction = (u32 )(1000 * (filechecksummer.Offset () - printprogress) / diskfile->FileSize ());
1542+ u32 newfraction = (u32 )(1000 * filechecksummer.Offset () / diskfile->FileSize ());
1543+ printprogress = 0 ;
1544+
1545+ if (oldfraction != newfraction)
1546+ {
1547+ cout << " Scanning: \" " << shortname << " \" : " << newfraction/10 << ' .' << newfraction%10 << " %\r " << flush;
15421548
1543- progressline = true ;
1549+ progressline = true ;
1550+ }
15441551 }
1552+ oldoffset = filechecksummer.Offset ();
15451553 }
15461554
15471555 // If we fail to find a match, it might be because it was a duplicate of a block
0 commit comments