mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-12-01 19:20:56 +05:30
renamed functions
This commit is contained in:
parent
96b2acf95c
commit
97527f549c
25
main.c
25
main.c
@ -21,7 +21,7 @@ bool writedata(const char *basename,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpackpld(const char *buffer,
|
void splitpld(const char *buffer,
|
||||||
const struct PldHeader *ph,
|
const struct PldHeader *ph,
|
||||||
const char *name,
|
const char *name,
|
||||||
unsigned int s) {
|
unsigned int s) {
|
||||||
@ -44,7 +44,7 @@ void unpackpld(const char *buffer,
|
|||||||
free(wbuffer);
|
free(wbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_pldheader(struct PldHeader *x) {
|
void showpldh(struct PldHeader *x) {
|
||||||
printf("number of offsets = %i\n", x -> numOffset);
|
printf("number of offsets = %i\n", x -> numOffset);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < x -> numOffset; i++) {
|
for (i = 0; i < x -> numOffset; i++) {
|
||||||
@ -52,7 +52,7 @@ void show_pldheader(struct PldHeader *x) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PldHeader *read_pldheader(const char *buffer) {
|
struct PldHeader *getpldh(const char *buffer) {
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ struct PldHeader *read_pldheader(const char *buffer) {
|
|||||||
return ph;
|
return ph;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *readpld(const char *fname, unsigned int *s) {
|
char *loadfile(const char *fname, unsigned int *s) {
|
||||||
FILE *f = fopen(fname, "rb");
|
FILE *f = fopen(fname, "rb");
|
||||||
unsigned int size = 0; // number of elements to buffer;
|
unsigned int size = 0; // number of elements to buffer;
|
||||||
unsigned int rcnt = 0; // number of char's read by fread(...)
|
unsigned int rcnt = 0; // number of char's read by fread(...)
|
||||||
@ -103,18 +103,25 @@ char *readpld(const char *fname, unsigned int *s) {
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
bool unpackpld (const char *filename) {
|
||||||
char *filename = argv[1];
|
bool status = false;
|
||||||
unsigned int fsize = 0;
|
unsigned int fsize = 0;
|
||||||
char *filedata = readpld(filename, &fsize);
|
char *filedata = loadfile(filename, &fsize);
|
||||||
printf("fsize is %i\n", fsize);
|
printf("fsize is %i\n", fsize);
|
||||||
if (filedata != NULL && fsize != 0) {
|
if (filedata != NULL && fsize != 0) {
|
||||||
struct PldHeader *pldh = read_pldheader(filedata);
|
struct PldHeader *pldh = getpldh(filedata);
|
||||||
unpackpld(filedata, pldh, filename, fsize);
|
splitpld(filedata, pldh, filename, fsize);
|
||||||
free(pldh -> offsets);
|
free(pldh -> offsets);
|
||||||
free(pldh);
|
free(pldh);
|
||||||
|
status = true;
|
||||||
}
|
}
|
||||||
free(filedata);
|
free(filedata);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char ** argv) {
|
||||||
|
char *f = argv[1];
|
||||||
|
unpackpld(f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user