summaryrefslogtreecommitdiff
path: root/otap_create.c
diff options
context:
space:
mode:
authorBen Brewer <benbrewer@codethink.co.uk>2011-08-18 15:46:40 +0100
committerBen Brewer <benbrewer@codethink.co.uk>2011-08-18 15:46:40 +0100
commit734e18830480a752d8b63333a1ddbf5f3d08501b (patch)
tree8a87e2ef383259cc852e29c91cdfc604dcf7d315 /otap_create.c
parentd6a65f7f197cb00b186f29c128188770558f3e82 (diff)
downloadtbdiff-734e18830480a752d8b63333a1ddbf5f3d08501b.tar.gz
Fixed an unintended feature which caused incorrect deltas to be created infrequently.
Diffstat (limited to 'otap_create.c')
-rw-r--r--otap_create.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/otap_create.c b/otap_create.c
index 09e4202..e8f81a8 100644
--- a/otap_create.c
+++ b/otap_create.c
@@ -96,7 +96,7 @@ static int _otap_create_cmd_file_delta(FILE* stream, otap_stat_t* a, otap_stat_t
uintptr_t o;
for(o = 0; (blks[1] == blks[0]) && (blks[0] != 0); o += blks[1]) {
blks[0] = fread(buff[0], 1, blks[0], fpa);
- blks[1] = fread(buff[1], 1, blks[1], fpb);
+ blks[1] = fread(buff[1], 1, blks[0], fpb);
if((blks[0] == 0) || (blks[1] == 0))
break;
@@ -153,11 +153,12 @@ static int _otap_create_cmd_file_delta(FILE* stream, otap_stat_t* a, otap_stat_t
break;
}
}
- if(i != 0)
+ if(i < blks[1])
break;
}
fclose(fpa);
+ // Ensure that the start and end don't overlap for the new file.
if((flenb - o) < start)
o = (flenb - start);
@@ -165,7 +166,7 @@ static int _otap_create_cmd_file_delta(FILE* stream, otap_stat_t* a, otap_stat_t
if(end < start)
end = start;
- uint32_t size = (flenb - (o + start));
+ uint32_t size = flenb - ((flena - end) + start); //(flenb - (o + start));
if((end == start) && (size == 0)) {
fclose(fpb);