Home | History | Annotate | Download | only in bsdiff

Lines Matching defs:oldsize

104 static void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
110 for(i=0;i<oldsize;i++) buckets[old[i]]++;
115 for(i=0;i<oldsize;i++) I[++buckets[old[i]]]=i;
116 I[0]=oldsize;
117 for(i=0;i<oldsize;i++) V[i]=buckets[old[i]];
118 V[oldsize]=0;
122 for(h=1;I[0]!=-(oldsize+1);h+=h) {
124 for(i=0;i<oldsize+1;) {
139 for(i=0;i<oldsize+1;i++) I[V[i]]=i;
142 static off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
146 for(i=0;(i<oldsize)&&(i<newsize);i++)
152 static off_t search(off_t *I,u_char *old,off_t oldsize,
158 x=matchlen(old+I[st],oldsize-I[st],new,newsize);
159 y=matchlen(old+I[en],oldsize-I[en],new,newsize);
171 if(memcmp(old+I[x],new,MIN(oldsize-I[x],newsize))<0) {
172 return search(I,old,oldsize,new,newsize,x,en,pos);
174 return search(I,old,oldsize,new,newsize,st,x,pos);
200 off_t oldsize,newsize;
218 /* Allocate oldsize+1 bytes instead of oldsize bytes to ensure
221 ((oldsize=lseek(fd,0,SEEK_END))==-1) ||
222 ((old=malloc(oldsize+1))==NULL) ||
224 (read(fd,old,oldsize)!=oldsize) ||
227 if(((I=malloc((oldsize+1)*sizeof(off_t)))==NULL) ||
228 ((V=malloc((oldsize+1)*sizeof(off_t)))==NULL)) err(1,NULL);
230 qsufsort(I,V,old,oldsize);
278 len=search(I,old,oldsize,new+scan,newsize-scan,
279 0,oldsize,&pos);
282 if((scsc+lastoffset<oldsize) &&
289 if((scan+lastoffset<oldsize) &&
296 for(i=0;(lastscan+i<scan)&&(lastpos+i<oldsize);) {