Lines Matching refs:oldsize
121 static void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
127 for(i=0;i<oldsize;i++) buckets[old[i]]++;
132 for(i=0;i<oldsize;i++) I[++buckets[old[i]]]=i;
133 I[0]=oldsize;
134 for(i=0;i<oldsize;i++) V[i]=buckets[old[i]];
135 V[oldsize]=0;
139 for(h=1;I[0]!=-(oldsize+1);h+=h) {
141 for(i=0;i<oldsize+1;) {
156 for(i=0;i<oldsize+1;i++) I[V[i]]=i;
159 static off_t matchlen(u_char *olddata,off_t oldsize,u_char *newdata,off_t newsize)
163 for(i=0;(i<oldsize)&&(i<newsize);i++)
169 static off_t search(off_t *I,u_char *old,off_t oldsize,
175 x=matchlen(old+I[st],oldsize-I[st],newdata,newsize);
176 y=matchlen(old+I[en],oldsize-I[en],newdata,newsize);
188 if(memcmp(old+I[x],newdata,MIN(oldsize-I[x],newsize))<0) {
189 return search(I,old,oldsize,newdata,newsize,x,en,pos);
191 return search(I,old,oldsize,newdata,newsize,st,x,pos);
215 // - old, oldsize, newdata, newsize are arguments; we don't load this
224 int bsdiff(u_char* old, off_t oldsize, off_t** IP, u_char* newdata, off_t newsize,
245 *IP = reinterpret_cast<off_t*>(malloc((oldsize+1) * sizeof(off_t)));
246 V = reinterpret_cast<off_t*>(malloc((oldsize+1) * sizeof(off_t)));
247 qsufsort(*IP, V, old, oldsize);
287 len=search(I,old,oldsize,newdata+scan,newsize-scan,
288 0,oldsize,&pos);
291 if((scsc+lastoffset<oldsize) &&
298 if((scan+lastoffset<oldsize) &&
305 for(i=0;(lastscan+i<scan)&&(lastpos+i<oldsize);) {