From: Mateusz Moscicki Date: Tue, 8 Mar 2022 10:52:32 +0000 (+0100) Subject: Add two additional offsets while trying to create a patch X-Git-Tag: accepted/tizen/6.5/unified/20220314.125352~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a76b9c2f8a2c9ec47e9847dd3283f200526ba00e;p=platform%2Fcore%2Fsystem%2Flibtota.git Add two additional offsets while trying to create a patch Creating a patch with an offset score equal to 8 may take too long. On the other hand for a value of 2 the resulting patch will consist of multiple blocks, which can significantly increase the application time. Therefore this commit adds two intermediate steps as a compromise solution. Change-Id: Id90beba4c4c89e20fb5f377f1499fb308e9f36a1 --- diff --git a/bsdiff/ss_bsdiff.c b/bsdiff/ss_bsdiff.c index 209f2e9..0cef267 100755 --- a/bsdiff/ss_bsdiff.c +++ b/bsdiff/ss_bsdiff.c @@ -723,13 +723,16 @@ int MY_CDECL main(int argc, char *argv[]) int ret = create_patch(info.old_file, info.new_file, TEMP_PATCH_NAME, 8); #ifdef TIME_LIMIT_CHECK - if (ret != 0) { - printf("Trying with offset score 2\n"); - ret = create_patch(info.old_file, info.new_file, TEMP_PATCH_NAME, 2); - } - if (ret != 0) { - printf("Trying with offset score 0\n"); - ret = create_patch(info.old_file, info.new_file, TEMP_PATCH_NAME, 0); + /* + * Creating a patch with an offset score equal to 8 may take too long. On + * the other hand for a value of 2 the resulting patch will consist of + * multiple blocks, which can significantly increase the application time. + * Therefore this commit adds two intermediate steps as a compromise + * solution. + */ + for (int score = 6; score >= 0 && ret != 0; score-=2) { + printf("Trying with offset score %d\n", score); + ret = create_patch(info.old_file, info.new_file, TEMP_PATCH_NAME, score); } if (ret != 0) err(1, "bsdiff fails to create delta within timelimit");