Replaced old casts with function calls

This commit is contained in:
_
2018-04-23 17:28:39 -07:00
parent 6d0b82682e
commit 046e1f8617
4 changed files with 9 additions and 11 deletions

View File

@@ -87,11 +87,11 @@ static bool getgheader(struct Header* h, const char* filedata) {
static bool getmeshheader(struct MeshHeader **hs,
unsigned int i,
const char * const filedata) {
bool done = false;
if (hs == NULL || filedata == NULL) {
bool done = false;
struct Header *h = NULL;
if (hs == NULL || !(getgheader(h, filedata))) {
return done;
}
struct Header *h = (struct Header*)filedata;
if (h -> numMesh < i) {
return done;
}

View File

@@ -9,7 +9,7 @@ static void printtph(struct TexturePack*);
static void printtbd(struct TextureBatchDescriptor*);
// Get Texture Pack Header
static bool getpackheader(struct TexturePack*, const char*);
static inline bool getpackheader(struct TexturePack*, const char*);
// Get Texture Batch Descriptor.
static bool gettexdescriptor(struct TextureBatchDescriptor**,
@@ -58,7 +58,7 @@ static void printtbd(struct TextureBatchDescriptor *bd) {
}
}
static bool getpackheader(struct TexturePack* p, const char *filedata) {
inline static bool getpackheader(struct TexturePack* p, const char *filedata) {
if (filedata == NULL) {
return false;
}
@@ -86,10 +86,9 @@ static bool gettexbatch(struct TextureBatch **batch,
const char *filedata,
unsigned int filesize) {
struct TexturePack *p = NULL;
if (filedata == NULL) { // no data to get batch from.
if (!(getpackheader(p, filedata))) {
return false;
}
p = (struct TexturePack*)filedata;
if (i > p -> batchNumber) { // no such batch in texture pack
return false;
}