rename typedef structs
This commit is contained in:
1 parent
dd3b63ae32
commit
bae5362656
24 files changed
+196
-196
No files matched your search
+7
-7
@@ -76,8 +76,8 @@ static int chipid_to_mem_avail(uint32_t iChipID) {
|
||||
|
||||
// Turn PHDRs into flasher segments, checking for PHDR sanity and merging adjacent
|
||||
// unaligned segments if needed
|
||||
static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs, uint16_t num_phdrs, uint32_t flash_end) {
|
||||
Elf32_Phdr *phdr = phdrs;
|
||||
static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr_t *phdrs, uint16_t num_phdrs, uint32_t flash_end) {
|
||||
Elf32_Phdr_t *phdr = phdrs;
|
||||
flash_seg_t *seg;
|
||||
uint32_t last_end = 0;
|
||||
|
||||
@@ -231,8 +231,8 @@ static int check_segs(flash_file_t *ctx, int can_write_bl, uint32_t flash_end) {
|
||||
// Load an ELF file and prepare it for flashing
|
||||
int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_size) {
|
||||
FILE *fd;
|
||||
Elf32_Ehdr ehdr;
|
||||
Elf32_Phdr *phdrs = NULL;
|
||||
Elf32_Ehdr_t ehdr;
|
||||
Elf32_Phdr_t *phdrs = NULL;
|
||||
uint16_t num_phdrs;
|
||||
uint32_t flash_end = FLASH_START + flash_size;
|
||||
int res = PM3_EUNDEF;
|
||||
@@ -272,7 +272,7 @@ int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_
|
||||
res = PM3_EFILE;
|
||||
goto fail;
|
||||
}
|
||||
if (le16(ehdr.e_phentsize) != sizeof(Elf32_Phdr)) {
|
||||
if (le16(ehdr.e_phentsize) != sizeof(Elf32_Phdr_t)) {
|
||||
// could be a structure padding issue...
|
||||
PrintAndLogEx(ERR, "Either the ELF file or this code is made of fail");
|
||||
res = PM3_EFILE;
|
||||
@@ -280,7 +280,7 @@ int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_
|
||||
}
|
||||
num_phdrs = le16(ehdr.e_phnum);
|
||||
|
||||
phdrs = calloc(le16(ehdr.e_phnum) * sizeof(Elf32_Phdr), sizeof(uint8_t));
|
||||
phdrs = calloc(le16(ehdr.e_phnum) * sizeof(Elf32_Phdr_t), sizeof(uint8_t));
|
||||
if (!phdrs) {
|
||||
PrintAndLogEx(ERR, "Out of memory");
|
||||
res = PM3_EMALLOC;
|
||||
@@ -291,7 +291,7 @@ int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_
|
||||
res = PM3_EFILE;
|
||||
goto fail;
|
||||
}
|
||||
if (fread(phdrs, sizeof(Elf32_Phdr), num_phdrs, fd) != num_phdrs) {
|
||||
if (fread(phdrs, sizeof(Elf32_Phdr_t), num_phdrs, fd) != num_phdrs) {
|
||||
res = PM3_EFILE;
|
||||
PrintAndLogEx(ERR, "Error while reading ELF PHDRs");
|
||||
goto fail;
|
||||
|
||||
Reference in new issue
Block a user