From ed36841f78fd8a520fc69b8921fdb529c542016f Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sun, 6 Jan 2019 23:47:10 +0800 Subject: [PATCH] Fix the warnings. --- MiSTer.vcxproj | 2 +- support/minimig/minimig_config.cpp | 15 +++++++-------- support/minimig/minimig_fdd.cpp | 14 +++++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/MiSTer.vcxproj b/MiSTer.vcxproj index 2543498..3518958 100644 --- a/MiSTer.vcxproj +++ b/MiSTer.vcxproj @@ -29,7 +29,7 @@ git.lnk ./build.sh MiSTer git.lnk ./clean.sh - __GNUC__;__USE_GNU ;_GNU_SOURCE;VDATE="000000";_FILE_OFFSET_BITS=64;_LARGEFILE64_SOURCE;$(NMakePreprocessorDefinitions) + __arm__;__GNUC__;__USE_GNU ;_GNU_SOURCE;VDATE="000000";_FILE_OFFSET_BITS=64;_LARGEFILE64_SOURCE;$(NMakePreprocessorDefinitions) c:\Work\Git\opt\gcc54\arm-linux-gnueabihf\libc\usr\include;c:\Work\Git\opt\gcc54\lib\gcc\arm-linux-gnueabihf\5.4.1\include;c:\Work\Git\opt\gcc54\arm-linux-gnueabihf\include\c++\5.4.1;$(NMakeIncludeSearchPath);lib\libco $(TEMP) $(TEMP) diff --git a/support/minimig/minimig_config.cpp b/support/minimig/minimig_config.cpp index 344e525..af8c11d 100644 --- a/support/minimig/minimig_config.cpp +++ b/support/minimig/minimig_config.cpp @@ -35,7 +35,7 @@ typedef struct unsigned char autofire; } configTYPE_old; -configTYPE config = { 0 }; +configTYPE config = { }; unsigned char romkey[3072]; static void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int address, int size) @@ -61,7 +61,7 @@ static void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int addr for (int j = 0; j<512; j++) { buf[j] ^= key[keyidx++]; - if (keyidx >= keysize) keyidx -= keysize; + if ((int)keyidx >= keysize) keyidx -= keysize; } } EnableOsd(); @@ -86,7 +86,7 @@ static void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int addr static char UploadKickstart(char *name) { - fileTYPE file = { 0 }; + fileTYPE file = {}; int keysize = 0; BootPrint("Checking for Amiga Forever key file:"); @@ -168,7 +168,7 @@ static char UploadKickstart(char *name) static char UploadActionReplay() { - fileTYPE file = { 0 }; + fileTYPE file = {}; if(FileOpen(&file, "Amiga/HRTMON.ROM") || FileOpen(&file, "HRTMON.ROM")) { int adr, data; @@ -378,7 +378,6 @@ unsigned char LoadConfiguration(int num) static const char config_id[] = "MNMGCFG0"; char updatekickstart = 0; char result = 0; - unsigned char key, i; const char *filename = GetConfigurationName(num); @@ -387,7 +386,7 @@ unsigned char LoadConfiguration(int num) if(filename && (size = FileLoadConfig(filename, 0, 0))>0) { BootPrint("Opened configuration file\n"); - printf("Configuration file size: %s, %lu\n", filename, size); + printf("Configuration file size: %s, %d\n", filename, size); if (size == sizeof(config)) { static configTYPE tmpconf; @@ -439,7 +438,7 @@ unsigned char LoadConfiguration(int num) } else printf("Cannot load configuration file\n"); } - else printf("Wrong configuration file size: %lu (expected: %lu)\n", size, sizeof(config)); + else printf("Wrong configuration file size: %d (expected: %u)\n", size, sizeof(config)); } if (!result) { BootPrint("Can not open configuration file!\n"); @@ -502,7 +501,7 @@ void MinimigReset() void SetKickstart(char *name) { - int len = strlen(name); + uint len = strlen(name); if (len > (sizeof(config.kickstart) - 1)) len = sizeof(config.kickstart) - 1; memcpy(config.kickstart, name, len); config.kickstart[len] = 0; diff --git a/support/minimig/minimig_fdd.cpp b/support/minimig/minimig_fdd.cpp index 22f0f08..fabd0cf 100644 --- a/support/minimig/minimig_fdd.cpp +++ b/support/minimig/minimig_fdd.cpp @@ -35,7 +35,7 @@ along with this program. If not, see . unsigned char drives = 0; // number of active drives reported by FPGA (may change only during reset) adfTYPE *pdfx; // drive select pointer -adfTYPE df[4] = { 0 }; // drive information structure +adfTYPE df[4] = {}; // drive information structure static uint8_t sector_buffer[512]; @@ -71,13 +71,13 @@ void SendSector(unsigned char *pData, unsigned char sector, unsigned char track, // odd bits of header x = 0x55; checksum[0] = x; - y = track >> 1 & 0x55; + y = (track >> 1) & 0x55; checksum[1] = y; spi_w(B2W(x,y)); - x = sector >> 1 & 0x55; + x = (sector >> 1) & 0x55; checksum[2] = x; - y = 11 - sector >> 1 & 0x55; + y = ((11 - sector) >> 1) & 0x55; checksum[3] = y; spi_w(B2W(x, y)); @@ -90,7 +90,7 @@ void SendSector(unsigned char *pData, unsigned char sector, unsigned char track, x = sector & 0x55; checksum[2] ^= x; - y = 11 - sector & 0x55; + y = (11 - sector) & 0x55; checksum[3] ^= y; spi_w(B2W(x, y)); @@ -135,8 +135,8 @@ void SendSector(unsigned char *pData, unsigned char sector, unsigned char track, p = pData; while (i--) { - x = *p++ >> 1 | 0xAA; - y = *p++ >> 1 | 0xAA; + x = (*p++ >> 1) | 0xAA; + y = (*p++ >> 1) | 0xAA; spi_w(B2W(x, y)); }