From 780d7a74aec0f298937abb98020bffa332922514 Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sun, 15 Apr 2007 23:58:42 +0000 Subject: [PATCH] Padding is harmless. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2735 8092fc87-c524-0410-9efc-e669fe64eaf9 --- tools/pkg/unpkg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/pkg/unpkg.c b/tools/pkg/unpkg.c index bdcf6420e..39f187b2e 100644 --- a/tools/pkg/unpkg.c +++ b/tools/pkg/unpkg.c @@ -724,7 +724,7 @@ analyzeFilesStats(struct options *opts, const index_header *h, // one package with 2 instances. // The DOS version of SC1 and the 3DO version of SC2 have // no such overflows. - fprintf(stderr, "Package #%d: Size is 0x%08x; " + fprintf(stderr, "Package #%d: Size 0x%08x; " "Expected 0x%08x. %d instances. ", pack->index, pack->size, expectedSize, pack->num_instances); if (pack->size < expectedSize && @@ -732,6 +732,14 @@ analyzeFilesStats(struct options *opts, const index_header *h, fprintf(stderr, "Correcting.\n"); pack->size = expectedSize; lastInstance(pack)->size += missing; + } else if (packI == stats->numPackages - 1 && + pack->size + multiplier > expectedSize) { + // It's possible that the package itself came from + // another package; in that case, there might be up to + // multiplier - 1 bytes of padding to the end of the + // package file to make the size a multiple of + // 'multiplier'. + fprintf(stderr, "Just padding.\n"); } else { fprintf(stderr, "KEPT VALUE!\n"); }