From fe16ad18cdee8c98695f63ad687e14ea38a8aa9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Wed, 1 Jan 2020 23:35:56 +0100 Subject: [PATCH] flash_internal: minor, fix spacing --- lib/flash_internal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/flash_internal.c b/lib/flash_internal.c index 39d7632..6e26927 100644 --- a/lib/flash_internal.c +++ b/lib/flash_internal.c @@ -36,18 +36,18 @@ * @return if the data is in the internal flash area */ static bool flash_internal_range(uint32_t address, size_t size) { - if (address>(UINT32_MAX-size)) { // on integer overflow will occur + if (address > (UINT32_MAX - size)) { // on integer overflow will occur return false; } - if (address=FLASH_BASE) { // check if the end for the internal flash is enforce by the linker script - if ((address+size)>(uint32_t)&__flash_end) { // end address is after the end of the enforced internal flash + if ((uint32_t)&__flash_end >= FLASH_BASE) { // check if the end for the internal flash is enforce by the linker script + if ((address + size) > (uint32_t)&__flash_end) { // end address is after the end of the enforced internal flash return false; } } else { - if ((address+size)>(FLASH_BASE+DESIG_FLASH_SIZE*1024)) { // end address is after the end of the advertised flash + if ((address + size) > (FLASH_BASE + DESIG_FLASH_SIZE * 1024)) { // end address is after the end of the advertised flash return false; } } @@ -57,7 +57,7 @@ static bool flash_internal_range(uint32_t address, size_t size) { bool flash_internal_read(uint32_t address, uint8_t *buffer, size_t size) { // sanity checks - if (buffer==NULL || size==0) { + if (buffer == NULL || size == 0) { return false; } if (!flash_internal_range(address, size)) { @@ -65,8 +65,8 @@ bool flash_internal_read(uint32_t address, uint8_t *buffer, size_t size) } // copy data byte per byte (a more efficient way would be to copy words, than the remaining bytes) - for (size_t i=0; i