diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-15 22:31:22 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-15 22:31:22 +0000 |
| commit | 80c7cc1c8f027fcf5d5f0a2df4b9aef6904ed079 (patch) | |
| tree | f34884b5132e36e8b0946f07dc1cf090047af8fb /usr.bin/bsdiff | |
| parent | 14a0ca29fe703fdb1903fd229ad762a1192690c7 (diff) | |
Notes
Diffstat (limited to 'usr.bin/bsdiff')
| -rw-r--r-- | usr.bin/bsdiff/bsdiff/bsdiff.c | 50 | ||||
| -rw-r--r-- | usr.bin/bsdiff/bspatch/bspatch.c | 4 |
2 files changed, 27 insertions, 27 deletions
diff --git a/usr.bin/bsdiff/bsdiff/bsdiff.c b/usr.bin/bsdiff/bsdiff/bsdiff.c index 7e39275a0a46..e0b3ee7d2553 100644 --- a/usr.bin/bsdiff/bsdiff/bsdiff.c +++ b/usr.bin/bsdiff/bsdiff/bsdiff.c @@ -57,24 +57,24 @@ static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h) if(V[I[k+i]+h]<x) { x=V[I[k+i]+h]; j=0; - }; + } if(V[I[k+i]+h]==x) { tmp=I[k+j];I[k+j]=I[k+i];I[k+i]=tmp; j++; - }; - }; + } + } for(i=0;i<j;i++) V[I[k+i]]=k+j-1; if(j==1) I[k]=-1; - }; + } return; - }; + } x=V[I[start+len/2]+h]; jj=0;kk=0; for(i=start;i<start+len;i++) { if(V[I[i]+h]<x) jj++; if(V[I[i]+h]==x) kk++; - }; + } jj+=start;kk+=jj; i=start;j=0;k=0; @@ -87,8 +87,8 @@ static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h) } else { tmp=I[i];I[i]=I[kk+k];I[kk+k]=tmp; k++; - }; - }; + } + } while(jj+j<kk) { if(V[I[jj+j]+h]==x) { @@ -96,8 +96,8 @@ static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h) } else { tmp=I[jj+j];I[jj+j]=I[kk+k];I[kk+k]=tmp; k++; - }; - }; + } + } if(jj>start) split(I,V,start,jj-start,h); @@ -137,10 +137,10 @@ static void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize) split(I,V,i,len,h); i+=len; len=0; - }; - }; + } + } if(len) I[i-len]=-len; - }; + } for(i=0;i<oldsize+1;i++) I[V[i]]=i; } @@ -171,7 +171,7 @@ static off_t search(off_t *I,u_char *old,off_t oldsize, *pos=I[en]; return y; } - }; + } x=st+(en-st)/2; if(memcmp(old+I[x],new,MIN(oldsize-I[x],newsize))<0) { @@ -321,24 +321,24 @@ int main(int argc,char *argv[]) if((scan+lastoffset<oldsize) && (old[scan+lastoffset] == new[scan])) oldscore--; - }; + } if((len!=oldscore) || (scan==newsize)) { s=0;Sf=0;lenf=0; for(i=0;(lastscan+i<scan)&&(lastpos+i<oldsize);) { if(old[lastpos+i]==new[lastscan+i]) s++; i++; - if(s*2-i>Sf*2-lenf) { Sf=s; lenf=i; }; - }; + if(s*2-i>Sf*2-lenf) { Sf=s; lenf=i; } + } lenb=0; if(scan<newsize) { s=0;Sb=0; for(i=1;(scan>=lastscan+i)&&(pos>=i);i++) { if(old[pos-i]==new[scan-i]) s++; - if(s*2-i>Sb*2-lenb) { Sb=s; lenb=i; }; - }; - }; + if(s*2-i>Sb*2-lenb) { Sb=s; lenb=i; } + } + } if(lastscan+lenf>scan-lenb) { overlap=(lastscan+lenf)-(scan-lenb); @@ -348,12 +348,12 @@ int main(int argc,char *argv[]) old[lastpos+lenf-overlap+i]) s++; if(new[scan-lenb+i]== old[pos-lenb+i]) s--; - if(s>Ss) { Ss=s; lens=i+1; }; - }; + if(s>Ss) { Ss=s; lens=i+1; } + } lenf+=lens-overlap; lenb-=lens; - }; + } for(i=0;i<lenf;i++) db[dblen+i]=new[lastscan+i]-old[lastpos+i]; @@ -381,8 +381,8 @@ int main(int argc,char *argv[]) lastscan=scan-lenb; lastpos=pos-lenb; lastoffset=pos-scan; - }; - }; + } + } BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL); if (bz2err != BZ_OK) errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err); diff --git a/usr.bin/bsdiff/bspatch/bspatch.c b/usr.bin/bsdiff/bspatch/bspatch.c index db72e5c70236..eb99e5ba16a0 100644 --- a/usr.bin/bsdiff/bspatch/bspatch.c +++ b/usr.bin/bsdiff/bspatch/bspatch.c @@ -161,7 +161,7 @@ int main(int argc,char * argv[]) (cbz2err != BZ_STREAM_END))) errx(1, "Corrupt patch\n"); ctrl[i]=offtin(buf); - }; + } /* Sanity-check */ if(newpos+ctrl[0]>newsize) @@ -195,7 +195,7 @@ int main(int argc,char * argv[]) /* Adjust pointers */ newpos+=ctrl[1]; oldpos+=ctrl[2]; - }; + } /* Clean up the bzip2 reads */ BZ2_bzReadClose(&cbz2err, cpfbz2); |
