Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use local variable for read_result instead of *ret, and fix calculation of *ret for EOF case. * Found a problem when reading an odd (%4) number of bytes at the end of a file. fread (on stm32) get them (say 3 bytes), then askes for more. do_semihosting gets a read return of 0 and tries to write that. mem_write alters the address to be aligned and overwrites then 3 bytes from the last read. This change simply tells mem_write to do nothing if len is 0. * Fix Issues from Fabien-Chouteau's review of my previous patch in isue #727. * Revert change to mem_write() so it does not confuse fixes to do_semihosting(). * Add cast to avoid warning. * Restore change to mem_write to return immeadiately if len == 0. Add more comments on further possible issues and ways to handle them. Using a branch to separate this change from others as it may need more discussion and go on for a while... * Remove cast of "-1" to uint32_t. It's now compared to a ssize_t and the compiler should be fine with that without any cast.
- Loading branch information