Fixed a comparation report text problem with files of 4 GiB or larger. Thanks Eliska Svobodova.

This commit is contained in:
Thomas Schmitt 2019-08-12 17:29:05 +02:00
parent e3ff5a971f
commit fb61be034f
3 changed files with 13 additions and 4 deletions

View File

@ -103,6 +103,7 @@ int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag)
int ret, differs= 0, r1, r2, fd1= -1, fd2= -1, i, done; int ret, differs= 0, r1, r2, fd1= -1, fd2= -1, i, done;
char buf1[4096], buf2[4096], a[4096], ttx1[40], ttx2[40]; char buf1[4096], buf2[4096], a[4096], ttx1[40], ttx2[40];
off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1;
double dcount;
ret= lstat(adr1, &s1); ret= lstat(adr1, &s1);
if(ret==-1) { if(ret==-1) {
@ -241,9 +242,13 @@ int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag)
if(diffcount>0 || r1count!=r2count) { if(diffcount>0 || r1count!=r2count) {
if(first_diff<0) if(first_diff<0)
first_diff= (r1count>r2count ? r2count : r1count); first_diff= (r1count>r2count ? r2count : r1count);
if(r1count > r2count)
dcount= diffcount + (r1count - r2count);
else
dcount= diffcount + (r2count - r1count);
printf("%s : %s : differs by at least %.f bytes. First at %.f\n", a, printf("%s : %s : differs by at least %.f bytes. First at %.f\n", a,
(s1.st_mtime==s2.st_mtime ? "CONTENT":"content"), (s1.st_mtime==s2.st_mtime ? "CONTENT":"content"),
(double) (diffcount + abs(r1count-r2count)), (double) first_diff); dcount, (double) first_diff);
differs= 1; differs= 1;
} }
} }

View File

@ -62,6 +62,7 @@ int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr,
char disk_md5[16], iso_md5[16]; char disk_md5[16], iso_md5[16];
void *ctx= NULL; void *ctx= NULL;
int buf_size= 32 * 1024; int buf_size= 32 * 1024;
double dcount;
Xorriso_alloc_meM(buf1, char, buf_size); Xorriso_alloc_meM(buf1, char, buf_size);
Xorriso_alloc_meM(buf2, char, buf_size); Xorriso_alloc_meM(buf2, char, buf_size);
@ -238,10 +239,13 @@ cannot_address:;
offset_text[0]= 0; offset_text[0]= 0;
if(offset>0) if(offset>0)
sprintf(offset_text, "%.f+", (double) offset); sprintf(offset_text, "%.f+", (double) offset);
if(r1count > r2count)
dcount= diffcount + (r1count - r2count);
else
dcount= diffcount + (r2count - r1count);
sprintf(respt, "%s %s : differs by at least %.f bytes. First at %s%.f\n", sprintf(respt, "%s %s : differs by at least %.f bytes. First at %s%.f\n",
common_adr, (flag&1 ? "CONTENT": "content"), common_adr, (flag&1 ? "CONTENT": "content"),
(double) (diffcount + abs(r1count-r2count)), dcount, offset_text, (double) first_diff);
offset_text, (double) first_diff);
if(!(flag&(1<<31))) if(!(flag&(1<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= (1<<15); (*result)|= (1<<15);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2019.07.24.141555" #define Xorriso_timestamP "2019.08.12.152719"