mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-25 16:28:57 +05:30
Moved file operation out of unpackpld
This commit is contained in:
parent
54ef5e84db
commit
6cf243138e
21
test/main.c
21
test/main.c
@ -73,25 +73,26 @@ char *loadfile(const char *fname, unsigned int *s) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool unpackpld (const char *filename) {
|
||||
bool unpackpld (const char *filedata,
|
||||
unsigned int filesize,
|
||||
const char *filename) {
|
||||
bool status = false;
|
||||
unsigned int fsize = 0;
|
||||
char *filedata = loadfile(filename, &fsize);
|
||||
printf("fsize is %i\n", fsize);
|
||||
if (filedata != NULL && fsize != 0) {
|
||||
printf("fsize is %i\n", filesize);
|
||||
if (filedata != NULL && filesize != 0) {
|
||||
struct PldHeader *pldh = getpldh(filedata);
|
||||
splitpld(filedata, pldh, filename, fsize);
|
||||
free(pldh -> offsets);
|
||||
free(pldh);
|
||||
splitpld(filedata, pldh, filename, filesize);
|
||||
destroypldh(pldh);
|
||||
status = true;
|
||||
}
|
||||
free(filedata);
|
||||
return status;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
char *f = argv[1];
|
||||
unpackpld(f);
|
||||
unsigned int bufsize = 0;
|
||||
char *buffer = loadfile(f, &bufsize);
|
||||
unpackpld(buffer, bufsize, f);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user