Replaced some large local variables by other means in xorriso/cmp_update.c

This commit is contained in:
Thomas Schmitt 2011-05-04 15:17:10 +00:00
parent 78a183341a
commit ff6772ca45
2 changed files with 10 additions and 4 deletions

View File

@ -54,9 +54,13 @@ int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr,
int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0, use_md5= 0; int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0, use_md5= 0;
void *stream2= NULL; void *stream2= NULL;
off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1;
char *respt, buf1[32*1024], buf2[32*1024], offset_text[80]; char *respt, *buf1= NULL, *buf2= NULL, offset_text[80];
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;
Xorriso_alloc_meM(buf1, char, buf_size);
Xorriso_alloc_meM(buf2, char, buf_size);
respt= xorriso->result_line; respt= xorriso->result_line;
@ -108,7 +112,7 @@ cannot_address:;
done= 0; done= 0;
while(!done) { while(!done) {
wanted= sizeof(buf1); wanted= buf_size;
if(r1count+offset+wanted>disk_size) if(r1count+offset+wanted>disk_size)
wanted= disk_size-r1count-offset; wanted= disk_size-r1count-offset;
if(r1count+wanted>bytes) if(r1count+wanted>bytes)
@ -122,7 +126,7 @@ cannot_address:;
r1+= ret; r1+= ret;
} }
wanted= sizeof(buf2); wanted= buf_size;
if(r2count+wanted>iso_size) if(r2count+wanted>iso_size)
wanted= iso_size-r2count; wanted= iso_size-r2count;
/* /*
@ -248,6 +252,8 @@ cannot_address:;
ex:; ex:;
if(ctx != NULL) if(ctx != NULL)
Xorriso_md5_end(xorriso, &ctx, disk_md5, 0); Xorriso_md5_end(xorriso, &ctx, disk_md5, 0);
Xorriso_free_meM(buf1);
Xorriso_free_meM(buf2);
return(ret); return(ret);
} }

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.04.151605" #define Xorriso_timestamP "2011.05.04.151721"