mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Added function that determines size of pld section
This commit is contained in:
@@ -11,6 +11,24 @@ bool getpldh(struct PldHeader *ph, const char *filedata) {
|
||||
return good;
|
||||
}
|
||||
|
||||
// determine the size of the i-th pld structure
|
||||
int sizeofpldstruct(struct PldHeader *ph, unsigned int i, unsigned int max) {
|
||||
unsigned int size = -1;
|
||||
if (ph == NULL) {
|
||||
fprintf(stderr, "Error: given null pointer\n");
|
||||
return size;
|
||||
}
|
||||
if (i > ph -> numOffset) {
|
||||
fprintf(stderr, "Error: i exceeds pldHeader -> numOffset\n");
|
||||
return size;
|
||||
}
|
||||
unsigned int start = 0, end = 0;
|
||||
start = ph -> offsets[i];
|
||||
end = (i == (ph -> numOffset) - 1) ? max : ph -> offsets[i + 1];
|
||||
size = end - start;
|
||||
return size;
|
||||
}
|
||||
|
||||
void printpldh(struct PldHeader *ph) {
|
||||
if (ph == NULL) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user