From 547636c1f1e5c060cef0fb45aed42f6a0afd7d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Kom=C3=ADnek?= Date: Sat, 15 Sep 2018 19:54:22 +0200 Subject: [PATCH 1/2] Merging control records having zero in their first triplet with the previous record (original bsdiff produces records having both the first and second item zeroes, i.e. representing only a seek in the old file). --- bsdiff.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/bsdiff.c b/bsdiff.c index 628f1c1..8992214 100644 --- a/bsdiff.c +++ b/bsdiff.c @@ -222,6 +222,7 @@ static int bsdiff_internal(const struct bsdiff_request req) int64_t *I,*V; int64_t scan,pos,len; int64_t lastscan,lastpos,lastoffset; + int64_t ctrlcur[3],ctrlnext[3]; int64_t oldscore,scsc; int64_t s,Sf,lenf,Sb,lenb; int64_t overlap,Ss,lens; @@ -240,6 +241,7 @@ static int bsdiff_internal(const struct bsdiff_request req) /* Compute the differences, writing ctrl as we go */ scan=0;len=0;pos=0; lastscan=0;lastpos=0;lastoffset=0; + ctrlcur[0]=0;ctrlcur[1]=0;ctrlcur[2]=0; while(scan Date: Tue, 15 Sep 2020 20:00:51 +0200 Subject: [PATCH 2/2] Reintroduced optimizations. These optimizations work for both original and endsley's formats. --- bsdiff.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/bsdiff.c b/bsdiff.c index 8992214..1cb58d4 100644 --- a/bsdiff.c +++ b/bsdiff.c @@ -221,8 +221,8 @@ static int bsdiff_internal(const struct bsdiff_request req) { int64_t *I,*V; int64_t scan,pos,len; - int64_t lastscan,lastpos,lastoffset; - int64_t ctrlcur[3],ctrlnext[3]; + int64_t lastscan,lastpos,lastoffset,lastwrittenscan,lastwrittenpos; + int64_t ctrlcur[3], ctrlnext[3]; int64_t oldscore,scsc; int64_t s,Sf,lenf,Sb,lenb; int64_t overlap,Ss,lens; @@ -240,7 +240,7 @@ static int bsdiff_internal(const struct bsdiff_request req) /* Compute the differences, writing ctrl as we go */ scan=0;len=0;pos=0; - lastscan=0;lastpos=0;lastoffset=0; + lastscan=0;lastpos=0;lastoffset=lastwrittenscan=lastwrittenpos=0; ctrlcur[0]=0;ctrlcur[1]=0;ctrlcur[2]=0; while(scan