Addressed warnings for pld module

This commit is contained in:
_ 2018-04-19 05:19:02 -07:00
parent 2977274f93
commit 70f7ccd29a
2 changed files with 12 additions and 10 deletions

View File

@ -14,23 +14,19 @@ struct PldHeader {
#pragma pack(pop) #pragma pack(pop)
typedef struct { typedef struct {
bool (* const getheader) (struct PldHeader*, const char*);
int (* const sizeofsector)(struct PldHeader*, unsigned int, unsigned int);
void (* const printheader) (struct PldHeader*);
} fn_devil1pld;
extern fn_devil1pld const DEVIL1PLD;
// input: pointer to a struct, contents of the .pld file. // input: pointer to a struct, contents of the .pld file.
// * = pass by reference of a struct PldHeader // * = pass by reference of a struct PldHeader
static bool getpldh(struct PldHeader*, const char*); bool (* const getheader) (struct PldHeader*, const char*);
// input: pointer to header, index of offset, filesize // input: pointer to header, index of offset, filesize
// * = pass by reference of a struct PldHeader // * = pass by reference of a struct PldHeader
static int sizeofpldstruct(struct PldHeader*, unsigned int, unsigned int); int (* const sizeofsector)(struct PldHeader*, unsigned int, unsigned int);
// input: a pld header struct. // input: a pld header struct.
// * = pass by reference of a struct PldHeader // * = pass by reference of a struct PldHeader
static void printpldh(struct PldHeader*); void (* const printheader) (struct PldHeader*);
} fn_devil1pld;
extern fn_devil1pld const DEVIL1PLD;
#endif #endif

View File

@ -1,6 +1,12 @@
#include "devil1pld.h" #include "devil1pld.h"
#include <stdio.h> #include <stdio.h>
static bool getpldh(struct PldHeader*, const char*);
static int sizeofpldstruct(struct PldHeader*, unsigned int, unsigned int);
static void printpldh(struct PldHeader*);
fn_devil1pld const DEVIL1PLD = {getpldh, sizeofpldstruct, printpldh}; fn_devil1pld const DEVIL1PLD = {getpldh, sizeofpldstruct, printpldh};
static bool getpldh(struct PldHeader *ph, const char *filedata) { static bool getpldh(struct PldHeader *ph, const char *filedata) {
@ -36,7 +42,7 @@ static void printpldh(struct PldHeader *ph) {
return; return;
} }
printf("number of offsets = %i\n", ph -> numOffset); printf("number of offsets = %i\n", ph -> numOffset);
printf("offsets = %x\n", ph -> offsets); printf("offsets = %p\n", ph -> offsets);
unsigned int i; unsigned int i;
for (i = 0; i < ph -> numOffset; i++) { for (i = 0; i < ph -> numOffset; i++) {
printf("offset %i = %x\n", i, ph -> offsets[i]); printf("offset %i = %x\n", i, ph -> offsets[i]);