Correction
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2734 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -151,7 +151,7 @@ packmem_list_offs
|
|||||||
[1]. The length of a packaged file, even with the multiplier, is overflowed
|
[1]. The length of a packaged file, even with the multiplier, is overflowed
|
||||||
for some resources.
|
for some resources.
|
||||||
The actual size is a multiple of 0x10000 times the multiplier larger.
|
The actual size is a multiple of 0x10000 times the multiplier larger.
|
||||||
This occurs in 8 packages in the PC version of Star Control II, in
|
This occurs in 18 packages in the PC version of Star Control II, in
|
||||||
1 packages of the Amiga version of Star Control 1, and in 2 packages of
|
1 packages of the Amiga version of Star Control 1, and in 2 packages of
|
||||||
the PC version of The Horde. The PC version of Star Control 1, and the 3DO
|
the PC version of The Horde. The PC version of Star Control 1, and the 3DO
|
||||||
version of Star Control II don't have such overflows.
|
version of Star Control II don't have such overflows.
|
||||||
|
|||||||
+6
-4
@@ -69,6 +69,7 @@ main(int argc, char *argv[]) {
|
|||||||
uint8 *buf;
|
uint8 *buf;
|
||||||
index_header *h;
|
index_header *h;
|
||||||
struct options opts;
|
struct options opts;
|
||||||
|
off_t inSize;
|
||||||
|
|
||||||
parse_arguments(argc, argv, &opts);
|
parse_arguments(argc, argv, &opts);
|
||||||
|
|
||||||
@@ -83,8 +84,9 @@ main(int argc, char *argv[]) {
|
|||||||
perror("stat() failed");
|
perror("stat() failed");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
inSize = sb.st_size;
|
||||||
|
|
||||||
buf = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, in, 0);
|
buf = mmap(NULL, inSize, PROT_READ, MAP_SHARED, in, 0);
|
||||||
if (buf == MAP_FAILED) {
|
if (buf == MAP_FAILED) {
|
||||||
perror("mmap() failed");
|
perror("mmap() failed");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@@ -103,7 +105,7 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
FilesStats *stats = createFilesStats(h, buf, sb.st_size);
|
FilesStats *stats = createFilesStats(h, buf, inSize);
|
||||||
analyzeFilesStats(&opts, h, stats);
|
analyzeFilesStats(&opts, h, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +143,7 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// freeIndex(h);
|
// freeIndex(h);
|
||||||
munmap(buf, sb.st_size);
|
munmap(buf, inSize);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,7 +680,7 @@ analyzeFilesStats(struct options *opts, const index_header *h,
|
|||||||
size_t filesStatsI;
|
size_t filesStatsI;
|
||||||
int multiplier = resourceSizeMultiplier(opts->type);
|
int multiplier = resourceSizeMultiplier(opts->type);
|
||||||
|
|
||||||
for (filesStatsI = 0; filesStatsI < filesStats->indexUpper - 1;
|
for (filesStatsI = 0; filesStatsI < filesStats->indexUpper;
|
||||||
filesStatsI++) {
|
filesStatsI++) {
|
||||||
FileStats *stats = &filesStats->fileStats[filesStatsI];
|
FileStats *stats = &filesStats->fileStats[filesStatsI];
|
||||||
size_t packI;
|
size_t packI;
|
||||||
|
|||||||
Reference in New Issue
Block a user