From 9b1df43687cf2369ce71741e4997440f6434c9ec Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 25 Mar 2016 01:58:42 +0100 Subject: [PATCH] Useless casts again --- source/firm.c | 8 ++++---- source/fs.c | 4 ++-- source/fs.h | 4 ++-- source/utils.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/firm.c b/source/firm.c index cbc5537..ef92a8c 100755 --- a/source/firm.c +++ b/source/firm.c @@ -50,7 +50,7 @@ void setupCFW(void){ //Attempt to read the configuration file const char configPath[] = "aurei/config.bin"; u16 config = 0; - u32 needConfig = fileRead((u8 *)&config, configPath, 2) ? 1 : 2; + u32 needConfig = fileRead(&config, configPath, 2) ? 1 : 2; //Determine if A9LH is installed if(a9lhBoot || (config >> 2) & 0x1){ @@ -116,7 +116,7 @@ void setupCFW(void){ if(bootConfig != (config & 0xFF00)){ //Preserve user settings (first byte) u16 tempConfig = ((config & 0xFF) | bootConfig); - fileWrite((u8 *)&tempConfig, configPath, 2); + fileWrite(&tempConfig, configPath, 2); } } @@ -148,7 +148,7 @@ void loadFirm(void){ (mode ? "/aurei/firmware.bin" : "/aurei/firmware90.bin"); firmSize = fileSize(path); if(!firmSize) error("aurei/firmware(90).bin doesn't exist"); - fileRead((u8 *)firmLocation, path, firmSize); + fileRead(firmLocation, path, firmSize); } section = firmLocation->section; @@ -255,7 +255,7 @@ void patchFirm(void){ //Write patched FIRM to SD if needed if(selectedFirm) - if(!fileWrite((u8 *)firmLocation, patchedFirms[selectedFirm - 1], firmSize)) + if(!fileWrite(firmLocation, patchedFirms[selectedFirm - 1], firmSize)) error("Couldn't write the patched FIRM (no free space?)"); } diff --git a/source/fs.c b/source/fs.c index 6bdd6f0..d5fb4a8 100644 --- a/source/fs.c +++ b/source/fs.c @@ -14,7 +14,7 @@ u32 mountSD(void){ return 1; } -u32 fileRead(u8 *dest, const char *path, u32 size){ +u32 fileRead(void *dest, const char *path, u32 size){ FRESULT fr; FIL fp; unsigned int br = 0; @@ -29,7 +29,7 @@ u32 fileRead(u8 *dest, const char *path, u32 size){ return fr ? 0 : 1; } -u32 fileWrite(const u8 *buffer, const char *path, u32 size){ +u32 fileWrite(const void *buffer, const char *path, u32 size){ FRESULT fr; FIL fp; unsigned int br = 0; diff --git a/source/fs.h b/source/fs.h index 6fbef63..c5ab353 100644 --- a/source/fs.h +++ b/source/fs.h @@ -9,8 +9,8 @@ #include "types.h" u32 mountSD(void); -u32 fileRead(u8 *dest, const char *path, u32 size); -u32 fileWrite(const u8 *buffer, const char *path, u32 size); +u32 fileRead(void *dest, const char *path, u32 size); +u32 fileWrite(const void *buffer, const char *path, u32 size); u32 fileSize(const char *path); u32 fileExists(const char *path); void fileDelete(const char *path); \ No newline at end of file diff --git a/source/utils.c b/source/utils.c index aae5327..8b38244 100644 --- a/source/utils.c +++ b/source/utils.c @@ -63,7 +63,7 @@ void configureCFW(const char *configPath){ //Read and parse the existing configuration u16 tempConfig = 0; - fileRead((u8 *)&tempConfig, configPath, 2); + fileRead(&tempConfig, configPath, 2); for(u32 i = 0; i < OPTIONS; i++) options.enabled[i] = (tempConfig >> i) & 0x1; @@ -94,7 +94,7 @@ void configureCFW(const char *configPath){ //Parse and write the selected options for(u32 i = 0; i < OPTIONS; i++) tempConfig |= options.enabled[i] << i; - fileWrite((u8 *)&tempConfig, configPath, 2); + fileWrite(&tempConfig, configPath, 2); //Reboot i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);