From: Matthew Endsley Date: Sat, 12 May 2012 03:42:12 +0000 (-0700) Subject: splurging on 16 extra bytes to write the 3 off_t vars at once X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e6f648ba399d16e9d68c9fe0fce7032baa89db2;p=platform%2Fupstream%2Fbsdiff.git splurging on 16 extra bytes to write the 3 off_t vars at once --- diff --git a/bsdiff.c b/bsdiff.c index 729fb3e..43bb02a 100644 --- a/bsdiff.c +++ b/bsdiff.c @@ -305,7 +305,8 @@ static int finishcompress(bz_stream* bz2, FILE* pf) int bsdiff(uint8_t* old, off_t oldsize, uint8_t* new, off_t newsize, FILE* pf, struct bsdiff_header* header) { off_t *I,*V; - off_t scan,pos,len,filelen; + off_t scan,pos,len; + off_t compresslen, filelen; off_t lastscan,lastpos,lastoffset; off_t oldscore,scsc; off_t s,Sf,lenf,Sb,lenb; @@ -313,7 +314,7 @@ int bsdiff(uint8_t* old, off_t oldsize, uint8_t* new, off_t newsize, FILE* pf, s off_t i; off_t dblen,eblen; uint8_t *db,*eb; - uint8_t buf[8]; + uint8_t buf[8 * 3]; bz_stream bz2 = {0}; int bz2err; @@ -412,18 +413,10 @@ int bsdiff(uint8_t* old, off_t oldsize, uint8_t* new, off_t newsize, FILE* pf, s eblen+=(scan-lenb)-(lastscan+lenf); offtout(lenf,buf); - bz2err = writecompress(&bz2, pf, buf, 8); - if (bz2err == -1) - errx(1, "writecompress"); - - offtout((scan-lenb)-(lastscan+lenf),buf); - bz2err = writecompress(&bz2, pf, buf, 8); - if (bz2err == -1) - errx(1, "writecompress"); - filelen += bz2err; + offtout((scan-lenb)-(lastscan+lenf),buf+8); + offtout((pos-lenb)-(lastpos+lenf),buf+16); - offtout((pos-lenb)-(lastpos+lenf),buf); - bz2err = writecompress(&bz2, pf, buf, 8); + bz2err = writecompress(&bz2, pf, buf, sizeof(buf)); if (bz2err == -1) errx(1, "writecompress"); filelen += bz2err;