Useless casts again

This commit is contained in:
Aurora 2016-03-25 01:58:42 +01:00
parent 56e0157d64
commit 9b1df43687
4 changed files with 10 additions and 10 deletions

View File

@ -50,7 +50,7 @@ void setupCFW(void){
//Attempt to read the configuration file //Attempt to read the configuration file
const char configPath[] = "aurei/config.bin"; const char configPath[] = "aurei/config.bin";
u16 config = 0; 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 //Determine if A9LH is installed
if(a9lhBoot || (config >> 2) & 0x1){ if(a9lhBoot || (config >> 2) & 0x1){
@ -116,7 +116,7 @@ void setupCFW(void){
if(bootConfig != (config & 0xFF00)){ if(bootConfig != (config & 0xFF00)){
//Preserve user settings (first byte) //Preserve user settings (first byte)
u16 tempConfig = ((config & 0xFF) | bootConfig); 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"); (mode ? "/aurei/firmware.bin" : "/aurei/firmware90.bin");
firmSize = fileSize(path); firmSize = fileSize(path);
if(!firmSize) error("aurei/firmware(90).bin doesn't exist"); if(!firmSize) error("aurei/firmware(90).bin doesn't exist");
fileRead((u8 *)firmLocation, path, firmSize); fileRead(firmLocation, path, firmSize);
} }
section = firmLocation->section; section = firmLocation->section;
@ -255,7 +255,7 @@ void patchFirm(void){
//Write patched FIRM to SD if needed //Write patched FIRM to SD if needed
if(selectedFirm) 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?)"); error("Couldn't write the patched FIRM (no free space?)");
} }

View File

@ -14,7 +14,7 @@ u32 mountSD(void){
return 1; return 1;
} }
u32 fileRead(u8 *dest, const char *path, u32 size){ u32 fileRead(void *dest, const char *path, u32 size){
FRESULT fr; FRESULT fr;
FIL fp; FIL fp;
unsigned int br = 0; unsigned int br = 0;
@ -29,7 +29,7 @@ u32 fileRead(u8 *dest, const char *path, u32 size){
return fr ? 0 : 1; 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; FRESULT fr;
FIL fp; FIL fp;
unsigned int br = 0; unsigned int br = 0;

View File

@ -9,8 +9,8 @@
#include "types.h" #include "types.h"
u32 mountSD(void); u32 mountSD(void);
u32 fileRead(u8 *dest, const char *path, u32 size); u32 fileRead(void *dest, const char *path, u32 size);
u32 fileWrite(const u8 *buffer, const char *path, u32 size); u32 fileWrite(const void *buffer, const char *path, u32 size);
u32 fileSize(const char *path); u32 fileSize(const char *path);
u32 fileExists(const char *path); u32 fileExists(const char *path);
void fileDelete(const char *path); void fileDelete(const char *path);

View File

@ -63,7 +63,7 @@ void configureCFW(const char *configPath){
//Read and parse the existing configuration //Read and parse the existing configuration
u16 tempConfig = 0; u16 tempConfig = 0;
fileRead((u8 *)&tempConfig, configPath, 2); fileRead(&tempConfig, configPath, 2);
for(u32 i = 0; i < OPTIONS; i++) for(u32 i = 0; i < OPTIONS; i++)
options.enabled[i] = (tempConfig >> i) & 0x1; options.enabled[i] = (tempConfig >> i) & 0x1;
@ -94,7 +94,7 @@ void configureCFW(const char *configPath){
//Parse and write the selected options //Parse and write the selected options
for(u32 i = 0; i < OPTIONS; i++) for(u32 i = 0; i < OPTIONS; i++)
tempConfig |= options.enabled[i] << i; tempConfig |= options.enabled[i] << i;
fileWrite((u8 *)&tempConfig, configPath, 2); fileWrite(&tempConfig, configPath, 2);
//Reboot //Reboot
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2); i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);