mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Fixed segmentation fault by clarifying pointer of pointer
This commit is contained in:
@@ -9,7 +9,7 @@ static void printmeshbatch(struct Batch*);
|
||||
|
||||
static void printcoordinate(struct Coordinate*, unsigned int);
|
||||
|
||||
static bool getgheader(struct Header*, const char*);
|
||||
static bool getgheader(struct Header**, const char*);
|
||||
|
||||
static bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const);
|
||||
|
||||
@@ -76,11 +76,11 @@ static void printcoordinate(struct Coordinate *p, unsigned int count) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool getgheader(struct Header* h, const char* filedata) {
|
||||
static bool getgheader(struct Header** h, const char* filedata) {
|
||||
if (filedata == NULL) {
|
||||
return false;
|
||||
}
|
||||
h = (struct Header*)filedata;
|
||||
(*h) = (struct Header*)filedata;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ static bool getmeshheader(struct MeshHeader **hs,
|
||||
const char * const filedata) {
|
||||
bool done = false;
|
||||
struct Header *h = NULL;
|
||||
if (hs == NULL || !(getgheader(h, filedata))) {
|
||||
if (hs == NULL || !(getgheader(&h, filedata))) {
|
||||
return done;
|
||||
}
|
||||
if (h -> numMesh < i) {
|
||||
|
@@ -9,7 +9,7 @@ static void printtph(struct TexturePack*);
|
||||
static void printtbd(struct TextureBatchDescriptor*);
|
||||
|
||||
// Get Texture Pack Header
|
||||
static inline bool getpackheader(struct TexturePack*, const char*);
|
||||
static inline bool getpackheader(struct TexturePack**, const char*);
|
||||
|
||||
// Get Texture Batch Descriptor.
|
||||
static bool gettexdescriptor(struct TextureBatchDescriptor**,
|
||||
@@ -58,11 +58,11 @@ static void printtbd(struct TextureBatchDescriptor *bd) {
|
||||
}
|
||||
}
|
||||
|
||||
inline static bool getpackheader(struct TexturePack* p, const char *filedata) {
|
||||
inline static bool getpackheader(struct TexturePack** p, const char *filedata) {
|
||||
if (filedata == NULL) {
|
||||
return false;
|
||||
}
|
||||
p = (struct TexturePack*)filedata;
|
||||
(*p) = (struct TexturePack*)filedata;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ static bool gettexbatch(struct TextureBatch **batch,
|
||||
const char *filedata,
|
||||
unsigned int filesize) {
|
||||
struct TexturePack *p = NULL;
|
||||
if (!(getpackheader(p, filedata))) {
|
||||
if (!(getpackheader(&p, filedata))) {
|
||||
return false;
|
||||
}
|
||||
if (i > p -> batchNumber) { // no such batch in texture pack
|
||||
|
Reference in New Issue
Block a user