Fix warnings

This commit is contained in:
Pol Henarejos
2022-05-27 20:58:28 +02:00
parent 79878a76c2
commit 152a2fa031
9 changed files with 81 additions and 82 deletions

View File

@@ -36,8 +36,6 @@ extern void low_flash_available();
//puts FCI in the RAPDU
void process_fci(const file_t *pe, int fmd) {
uint8_t *p = res_APDU;
uint8_t buf[64];
res_APDU_size = 0;
if (fmd) {
res_APDU[res_APDU_size++] = 0x6f;
@@ -185,7 +183,7 @@ bool authenticate_action(const file_t *ef, uint8_t op) {
return true;
else if (acl == 0xff)
return false;
else if (acl == 0x90 || acl & 0x9F == 0x10) {
else if (acl == 0x90 || (acl & 0x9F) == 0x10) {
// PIN required.
if (isUserAuthenticated) {
return true;
@@ -222,7 +220,6 @@ void scan_flash() {
}
printf("SCAN\r\n");
uintptr_t base = flash_read_uintptr(end_data_pool);
for (uintptr_t base = flash_read_uintptr(end_data_pool); base >= start_data_pool; base = flash_read_uintptr(base)) {
if (base == 0x0) //all is empty
break;

View File

@@ -79,7 +79,7 @@ uintptr_t allocate_free_addr(uint16_t size) {
return 0x0;
}
//we check if |base-(next_addr+size_next_addr)| > |base-potential_addr| only if fid != 1xxx (not size blocked)
else if (addr_alg <= potential_addr && base-(next_base+flash_read_uint16(next_base+sizeof(uintptr_t)+sizeof(uintptr_t)+sizeof(uint16_t))+2*sizeof(uint16_t)+2*sizeof(uintptr_t)) > base-potential_addr && flash_read_uint16(next_base+sizeof(uintptr_t)) & 0x1000 != 0x1000) {
else if (addr_alg <= potential_addr && base-(next_base+flash_read_uint16(next_base+sizeof(uintptr_t)+sizeof(uintptr_t)+sizeof(uint16_t))+2*sizeof(uint16_t)+2*sizeof(uintptr_t)) > base-potential_addr && (flash_read_uint16(next_base+sizeof(uintptr_t)) & 0x1000) != 0x1000) {
flash_program_uintptr(potential_addr, next_base);
flash_program_uintptr(potential_addr+sizeof(uintptr_t), base);
flash_program_uintptr(base, potential_addr);

View File

@@ -138,7 +138,6 @@ page_flash_t *find_free_page(uintptr_t addr) {
}
int flash_program_block(uintptr_t addr, const uint8_t *data, size_t len) {
uintptr_t addr_alg = addr & -FLASH_SECTOR_SIZE;
page_flash_t *p = NULL;
if (!data || len == 0)
@@ -213,7 +212,6 @@ uint8_t flash_read_uint8(uintptr_t addr) {
}
int flash_erase_page (uintptr_t addr, size_t page_size) {
uintptr_t addr_alg = addr & -FLASH_SECTOR_SIZE;
page_flash_t *p = NULL;
mutex_enter_blocking(&mtx_flash);