Apply unpackssi_64bit_fix.patch from Gentoo Linux, with modifications.

https://bugs.gentoo.org/attachment.cgi?id=342598&action=edit

git-svn-id: https://svn.eduke32.com/eduke32@4544 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-07-22 11:18:41 +00:00
parent b332189ae5
commit c1701f9299

View file

@ -41,23 +41,24 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
FILE *fp, *ofp; FILE *fp, *ofp;
long i,j=0; int32_t i,j=0;
long version; int32_t version;
long numfiles; int32_t numfiles;
unsigned char numchars; unsigned char numchars;
char title[33]; char title[33];
char description[3][71]; char description[3][71];
struct file { struct file {
char name[13]; char name[13];
long length; int32_t length;
} *filenames; } *filenames;
char runfile[13] = "<unknown>"; char runfile[13] = "<unknown>";
char buf[1024]; char buf[1024];
int mode=0, param; int32_t mode=0, param;
puts("unpackssi - .SSI File Unpacker\n" puts("unpackssi - .SSI File Unpacker\n"
"Copyright (c) 2003 Jonathon Fowler\n" "Copyright (c) 2003 Jonathon Fowler\n"
@ -96,7 +97,7 @@ int main(int argc, char **argv)
return -1; return -1;
} }
printf("File is SSI Version %ld\n", version); printf("File is SSI Version %i\n", version);
fread(&numfiles, 4, 1, fp); fread(&numfiles, 4, 1, fp);
@ -159,7 +160,7 @@ int main(int argc, char **argv)
break; break;
} }
printf("Unpacking %s (%ld bytes)...", filenames[i].name, filenames[i].length); printf("Unpacking %s (%i bytes)...", filenames[i].name, filenames[i].length);
for (j=filenames[i].length; j>1024; j-=1024) { for (j=filenames[i].length; j>1024; j-=1024) {
fread(buf, 1024, 1, fp); fread(buf, 1024, 1, fp);
@ -173,14 +174,14 @@ int main(int argc, char **argv)
fclose(ofp); fclose(ofp);
puts("done"); puts("done");
} else if (mode == 1) { } else if (mode == 1) {
printf(" %-12s %ld bytes\n", filenames[i].name, filenames[i].length); printf(" %-12s %i bytes\n", filenames[i].name, filenames[i].length);
j += filenames[i].length; j += filenames[i].length;
} }
} }
if (mode == 1) { if (mode == 1) {
puts(""); puts("");
printf(" %ld files, %ld bytes\n", numfiles, j); printf(" %i files, %i bytes\n", numfiles, j);
} }
fclose(fp); fclose(fp);