From 271d9d588dfbf866d28a8b681d1930281ece1d11 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Tue, 27 Jul 2021 11:34:35 +0200 Subject: [PATCH] Clean up more warnings --- CGDOOM-minisdk/CGDOOM/Makefile | 2 +- cgdoom/cgdoom.c | 11 ++++++----- cgdoom/i_system.c | 14 +++++++------- cgdoom/i_system.h | 2 +- cgdoom/os.h | 3 +++ cgdoom/w_wad.c | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CGDOOM-minisdk/CGDOOM/Makefile b/CGDOOM-minisdk/CGDOOM/Makefile index fbe6edb..8fe4866 100644 --- a/CGDOOM-minisdk/CGDOOM/Makefile +++ b/CGDOOM-minisdk/CGDOOM/Makefile @@ -3,7 +3,7 @@ CPP=sh-elf-g++ OBJCOPY=sh-elf-objcopy MKG3A=mkg3a RM=rm -CFLAGS=-m4a-nofpu -mb -fgcse-sm -fgcse-las -fgcse-after-reload -Isrc -O3 -fmerge-all-constants -mhitachi -fuse-linker-plugin -Wall -Wextra -Wno-sign-compare -I../../../../include -lgcc -L../../../../lib -I./ -I../../cgdoom -D_FXCG_MINICOMPAT +CFLAGS=-m4a-nofpu -mb -fgcse-sm -fgcse-las -fgcse-after-reload -Isrc -O3 -fmerge-all-constants -mhitachi -fuse-linker-plugin -Wall -Wextra -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -I../../../../include -lgcc -L../../../../lib -I./ -I../../cgdoom -D_FXCG_MINICOMPAT LDFLAGS=$(CFLAGS) -nostartfiles -T../../../../toolchain/prizm.x -Wl,-static -lfxcg -lgcc -Wl,-Map=$(PROJ_NAME).map CSOURCES=$(wildcard ../../cgdoom/*.c) OBJECTS=$(CSOURCES:.c=.o) diff --git a/cgdoom/cgdoom.c b/cgdoom/cgdoom.c index 596d28a..60f7d02 100644 --- a/cgdoom/cgdoom.c +++ b/cgdoom/cgdoom.c @@ -478,7 +478,7 @@ void abort(void){ GetKey(&key); } /////////////////////////////////////////////////////////////////////////////////////////////////// -void main(void){ +int main(void){ InitFlashSimu(cgdoom_wad_path); //load wad file to flash simulation on simulator, do nothing on real HW #ifdef CG_EMULATOR SaveVRAMBuffer = aSaveVRAMBuffer; @@ -503,23 +503,24 @@ void main(void){ if(size == -1) { I_Error ("File read error"); - return; + return 1; } else if(size == -2) { I_Error ("Page not found"); - return; + return 1; } else if(size == -3) { I_Error ("File too fragmented"); - return; + return 1; } else if(size < 0) { I_ErrorI ("CreateFileMapping", size, 0, 0, 0); - return; + return 1; } #endif D_DoomMain(); + return 1; } //todo: wrapper pro (patch_t*), + flash diff --git a/cgdoom/i_system.c b/cgdoom/i_system.c index 5fb6279..e7fb260 100644 --- a/cgdoom/i_system.c +++ b/cgdoom/i_system.c @@ -117,7 +117,7 @@ int toupper_int(int i) // I_Error // static int key = 31; -void I_ErrorI (char *error, int i1,int i2,int i3,int i4) +void I_ErrorI (const char *error, int i1,int i2,int i3,int i4) { #ifndef CG_EMULATOR @@ -126,11 +126,11 @@ void I_ErrorI (char *error, int i1,int i2,int i3,int i4) locate_OS( 1, 1 ); PrintLine( "ERROR:", 21 ); locate_OS( 1, 2 ); - PrintLine( (unsigned char *)error, 21 ); - locate_OS( 1, 3 );CGDAppendHex32("i1:",i1,8,buf);PrintLine( (unsigned char *)buf, 21 ); - locate_OS( 1, 4 );CGDAppendHex32("i2:",i2,8,buf);PrintLine( (unsigned char *)buf, 21 ); - locate_OS( 1, 5 );CGDAppendHex32("i3:",i3,8,buf);PrintLine( (unsigned char *)buf, 21 ); - locate_OS( 1, 6 );CGDAppendHex32("i4:",i4,8,buf);PrintLine( (unsigned char *)buf, 21 ); + PrintLine( error, 21 ); + locate_OS( 1, 3 );CGDAppendHex32("i1:",i1,8,buf);PrintLine( buf, 21 ); + locate_OS( 1, 4 );CGDAppendHex32("i2:",i2,8,buf);PrintLine( buf, 21 ); + locate_OS( 1, 5 );CGDAppendHex32("i3:",i3,8,buf);PrintLine( buf, 21 ); + locate_OS( 1, 6 );CGDAppendHex32("i4:",i4,8,buf);PrintLine( buf, 21 ); GetKey( &key ); #else I_Error (error,i1,i2,i3,i4); @@ -157,7 +157,7 @@ void I_Error (char *error, ...) locate_OS( 1, 1 ); PrintLine( "ERROR:", 21 ); locate_OS( 1, 2 ); - PrintLine( (unsigned char *)error, 21 ); + PrintLine( error, 21 ); GetKey( &key ); #endif //#ifdef CG_EMULATOR //I_Quit(); diff --git a/cgdoom/i_system.h b/cgdoom/i_system.h index a8f20d0..f9faa6d 100644 --- a/cgdoom/i_system.h +++ b/cgdoom/i_system.h @@ -94,7 +94,7 @@ int toupper_int(int i); void I_Error (char *error, ...); //CGD bastl/hack -void I_ErrorI (char *error, int i1,int i2,int i3,int i4); +void I_ErrorI (const char *error, int i1,int i2,int i3,int i4); //Set by I_Error() extern boolean fuck; diff --git a/cgdoom/os.h b/cgdoom/os.h index 963f2b8..002944e 100644 --- a/cgdoom/os.h +++ b/cgdoom/os.h @@ -29,9 +29,12 @@ int CGDstrnicmp (const char*s1,const char*s2,int iLen); void CGDstrncpy(char *pszBuf,const char *pszText,int iLen); void CGDAppendNum0_999(const char *pszText,int iNum,int iMinDigits,char *pszBuf); +void CGDAppendHex32(const char *pszText,int iNum, int iDigits,char *pszBuf); int abs(int x); +void I_ErrorI(const char *str, int i1, int i2, int i3, int i4); + //force compiler error on use following: #define strcpy 12 #define strnicmp 22 diff --git a/cgdoom/w_wad.c b/cgdoom/w_wad.c index e9bab93..9a54de4 100644 --- a/cgdoom/w_wad.c +++ b/cgdoom/w_wad.c @@ -333,7 +333,7 @@ static void* W_CacheLumpNumCommon( int lump, int tag,int iEnableFlash) int p1 = ((unsigned int)lumpcache[lump] & 0xf0000000) == 0x80000000; int p2 = ((unsigned int)lumpcache[lump] & 0xf0000000) == 0xa0000000; if(lumpcache[lump] == NULL || (!p1 && !p2)) - I_ErrorI("W_CacheLumpNumCommon", lumpcache[lump], lump, 0, 0); + I_ErrorI("W_CacheLumpNumCommon", (int)lumpcache[lump], lump, 0, 0); return lumpcache[lump]; }