Clean up compiler warnings.

This commit is contained in:
Brandon Wright 2017-12-06 19:00:19 -06:00
parent dd1202a2ad
commit e2277ff55b
12 changed files with 65 additions and 107 deletions

View File

@ -803,7 +803,7 @@ void SPC_DSP::run( int clocks_remain )
{
loop:
#define PHASE( n ) if ( n && !--clocks_remain ) break; case n:
#define PHASE( n ) if ( n && !--clocks_remain ) break; /* Fall through */ case n:
GEN_DSP_TIMING
#undef PHASE

36
bsx.cpp
View File

@ -268,10 +268,7 @@ static void BSX_Map_SRAM (void);
static void BSX_Map_PSRAM (void);
static void BSX_Map_BIOS (void);
static void BSX_Map_RAM (void);
static void BSX_Map_Dirty (void);
static void BSX_Map (void);
static void BSX_Set_Bypass_FlashIO (uint16, uint8);
static uint8 BSX_Get_Bypass_FlashIO (uint16);
static bool8 BSX_LoadBIOS (void);
static void map_psram_mirror_sub (uint32);
static int is_bsx (unsigned char *);
@ -619,39 +616,6 @@ static void BSX_Map_RAM (void)
}
}
static void BSX_Map_Dirty (void)
{
// for the quick bank change
int i, c;
// Banks 00->1F and 80->9F:8000-FFFF
if (BSX.MMC[0x02])
{
for (c = 0; c < 0x200; c += 16)
{
for (i = c + 8; i < c + 16; i++)
{
Map[i] = Map[i + 0x800] = &MapROM[(c << 12) % FlashSize];
BlockIsRAM[i] = BlockIsRAM[i + 0x800] = BSX.write_enable;
BlockIsROM[i] = BlockIsROM[i + 0x800] = !BSX.write_enable;
}
}
}
else
{
for (c = 0; c < 0x200; c += 16)
{
for (i = c + 8; i < c + 16; i++)
{
Map[i] = Map[i + 0x800] = &MapROM[(c << 11) % FlashSize] - 0x8000;
BlockIsRAM[i] = BlockIsRAM[i + 0x800] = BSX.write_enable;
BlockIsROM[i] = BlockIsROM[i + 0x800] = !BSX.write_enable;
}
}
}
}
static void BSX_Map (void)
{
#ifdef BSX_DEBUG

View File

@ -3376,6 +3376,7 @@ void S9xSetControllerCrosshair (enum crosscontrols ctl, int8 idx, const char *fg
for (i = 0; i < 16; i++)
{
for (j = 0; color_names[i][j] && fg[j] == color_names[i][j]; j++) ;
if (isalnum(fg[j]))
continue;
@ -3403,6 +3404,7 @@ void S9xSetControllerCrosshair (enum crosscontrols ctl, int8 idx, const char *fg
for (i = 0; i < 16; i++)
{
for (j = 0; color_names[i][j] && bg[j] == color_names[i][j]; j++) ;
if (isalnum(bg[j]))
continue;

32
dma.cpp
View File

@ -613,7 +613,7 @@ bool8 S9xDoDMA (uint8 Channel)
S9xSetPPU(Work, 0x2100 + d->BAddress);
UPDATE_COUNTERS;
count--;
// Fall through
case 1:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -648,7 +648,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 1;
break;
}
// Fall through
case 1:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2100 + d->BAddress);
@ -658,7 +658,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 2;
break;
}
// Fall through
case 2:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -668,7 +668,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 3;
break;
}
// Fall through
case 3:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -697,7 +697,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 1;
break;
}
// Fall through
case 1:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -707,7 +707,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 2;
break;
}
// Fall through
case 2:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2102 + d->BAddress);
@ -717,7 +717,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 3;
break;
}
// Fall through
case 3:
Work = S9xGetByte((d->ABank << 16) + p);
S9xSetPPU(Work, 0x2103 + d->BAddress);
@ -857,7 +857,7 @@ bool8 S9xDoDMA (uint8 Channel)
REGISTER_2118_linear(Work);
UPDATE_COUNTERS;
count--;
// Fall through
case 1:
Work = *(base + p);
REGISTER_2119_linear(Work);
@ -887,7 +887,7 @@ bool8 S9xDoDMA (uint8 Channel)
REGISTER_2118_tile(Work);
UPDATE_COUNTERS;
count--;
// Fall through
case 1:
Work = *(base + p);
REGISTER_2119_tile(Work);
@ -919,7 +919,7 @@ bool8 S9xDoDMA (uint8 Channel)
S9xSetPPU(Work, 0x2100 + d->BAddress);
UPDATE_COUNTERS;
count--;
// Fall through
case 1:
Work = *(base + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -955,7 +955,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 1;
break;
}
// Fall through
case 1:
Work = *(base + p);
S9xSetPPU(Work, 0x2100 + d->BAddress);
@ -965,7 +965,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 2;
break;
}
// Fall through
case 2:
Work = *(base + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -975,7 +975,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 3;
break;
}
// Fall through
case 3:
Work = *(base + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -1004,7 +1004,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 1;
break;
}
// Fall through
case 1:
Work = *(base + p);
S9xSetPPU(Work, 0x2101 + d->BAddress);
@ -1014,7 +1014,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 2;
break;
}
// Fall through
case 2:
Work = *(base + p);
S9xSetPPU(Work, 0x2102 + d->BAddress);
@ -1024,7 +1024,7 @@ bool8 S9xDoDMA (uint8 Channel)
b = 3;
break;
}
// Fall through
case 3:
Work = *(base + p);
S9xSetPPU(Work, 0x2103 + d->BAddress);

View File

@ -1369,7 +1369,7 @@ void DSP1SetByte (uint8 byte, uint16 address)
case 0x17:
case 0x37:
case 0x3F:
DSP1.command = 0x1f;
DSP1.command = 0x1f; // Fall through
case 0x1f: DSP1.in_count = 1; break;
default:
#ifdef DEBUGGER

View File

@ -969,7 +969,7 @@ get_filter_scale (int &width, int &height)
height *= 4;
break;
}
// Fall through
case FILTER_HQ3X:
if (width * 3 <= S9xDisplayDriver::scaled_max_width &&
height * 3 <= S9xDisplayDriver::scaled_max_height)
@ -978,7 +978,7 @@ get_filter_scale (int &width, int &height)
height *= 3;
break;
}
// Fall through
case FILTER_HQ2X:
width *= 2;
height *= 2;
@ -994,7 +994,7 @@ get_filter_scale (int &width, int &height)
height *= 4;
break;
}
// Fall through
case FILTER_3XBRZ:
if (width * 3 <= S9xDisplayDriver::scaled_max_width &&
height * 3 <= S9xDisplayDriver::scaled_max_height)
@ -1003,7 +1003,7 @@ get_filter_scale (int &width, int &height)
height *= 3;
break;
}
// Fall through
case FILTER_2XBRZ:
width *= 2;
height *= 2;
@ -1018,7 +1018,7 @@ get_filter_scale (int &width, int &height)
height *= 4;
break;
}
// Fall through
case FILTER_SIMPLE3X:
if (width * 3 <= S9xDisplayDriver::scaled_max_width &&
height * 3 <= S9xDisplayDriver::scaled_max_height)
@ -1027,7 +1027,7 @@ get_filter_scale (int &width, int &height)
height *= 3;
break;
}
// Fall through
case FILTER_SIMPLE2X:
width *= 2;
height *= 2;
@ -1114,8 +1114,7 @@ internal_filter (uint8 *src_buffer,
break;
}
/* Fall back to 3x */
// Fall through
case FILTER_HQ3X:
if (width * 3 <= S9xDisplayDriver::scaled_max_width &&
@ -1130,8 +1129,7 @@ internal_filter (uint8 *src_buffer,
break;
}
/* Fall back to 2x */
// Fall through
case FILTER_HQ2X:
HQ2X_16 (src_buffer,
@ -1155,7 +1153,7 @@ internal_filter (uint8 *src_buffer,
height);
break;
// Fall through
case FILTER_3XBRZ:
filter_3xBRZ (src_buffer,
@ -1166,7 +1164,7 @@ internal_filter (uint8 *src_buffer,
height);
break;
// Fall through
case FILTER_2XBRZ:
filter_2xBRZ (src_buffer,
@ -1194,7 +1192,7 @@ internal_filter (uint8 *src_buffer,
break;
}
// Fall through
case FILTER_SIMPLE3X:
if (width * 3 <= S9xDisplayDriver::scaled_max_width &&
@ -1209,7 +1207,7 @@ internal_filter (uint8 *src_buffer,
break;
}
// Fall through
case FILTER_SIMPLE2X:
filter_2x (src_buffer,

View File

@ -48,7 +48,7 @@ namespace JMA
//Retreive the file block, what else?
void jma_open::retrieve_file_block() throw(jma_errors)
void jma_open::retrieve_file_block()
{
unsigned char uint_buffer[UINT_SIZE];
unsigned char ushort_buffer[USHORT_SIZE];
@ -168,7 +168,7 @@ namespace JMA
}
//Constructor for opening JMA files for reading
jma_open::jma_open(const char *compressed_file_name) throw (jma_errors)
jma_open::jma_open(const char *compressed_file_name)
{
decompressed_buffer = 0;
compressed_buffer = 0;
@ -229,7 +229,7 @@ namespace JMA
}
//Skip forward a given number of chunks
void jma_open::chunk_seek(unsigned int chunk_num) throw(jma_errors)
void jma_open::chunk_seek(unsigned int chunk_num)
{
//Check the stream is open
if (!stream.is_open())
@ -257,7 +257,7 @@ namespace JMA
//Return a vector of pointers to each file in the JMA, the buffer to hold all the files
//must be initilized outside.
vector<unsigned char *> jma_open::get_all_files(unsigned char *buffer) throw(jma_errors)
vector<unsigned char *> jma_open::get_all_files(unsigned char *buffer)
{
//If there's no stream we can't read from it, so exit
if (!stream.is_open())
@ -396,7 +396,7 @@ namespace JMA
}
//Extracts the file with a given name found in the archive to the given buffer
void jma_open::extract_file(string& name, unsigned char *buffer) throw(jma_errors)
void jma_open::extract_file(string& name, unsigned char *buffer)
{
if (!stream.is_open())
{

View File

@ -64,12 +64,12 @@ namespace JMA
class jma_open
{
public:
jma_open(const char *) throw(jma_errors);
jma_open(const char *);
~jma_open();
std::vector<jma_public_file_info> get_files_info();
std::vector<unsigned char *> get_all_files(unsigned char *) throw(jma_errors);
void extract_file(std::string& name, unsigned char *) throw(jma_errors);
std::vector<unsigned char *> get_all_files(unsigned char *);
void extract_file(std::string& name, unsigned char *);
bool is_solid();
private:
@ -79,8 +79,8 @@ namespace JMA
unsigned char *decompressed_buffer;
unsigned char *compressed_buffer;
void chunk_seek(unsigned int) throw(jma_errors);
void retrieve_file_block() throw(jma_errors);
void chunk_seek(unsigned int);
void retrieve_file_block();
};
time_t uint_to_time(unsigned short, unsigned short);

View File

@ -960,11 +960,9 @@ static bool8 allASCII (uint8 *, int);
static bool8 is_SufamiTurbo_BIOS (const uint8 *, uint32);
static bool8 is_SufamiTurbo_Cart (const uint8 *, uint32);
static bool8 is_BSCart_BIOS (const uint8 *, uint32);
static bool8 is_SameGame_Add_On (const uint8 *, uint32);
static bool8 is_BSCartSA1_BIOS(const uint8 *, uint32);
static bool8 is_GNEXT_Add_On (const uint8 *, uint32);
static uint32 caCRC32 (uint8 *, uint32, uint32 crc32 = 0xffffffff);
static uint32 ReadUPSPointer (const uint8 *, unsigned &, unsigned);
static bool8 ReadUPSPatch (Stream *, long, int32 &);
static long ReadInt (Stream *, unsigned);
static bool8 ReadIPSPatch (Stream *, long, int32 &);
@ -1265,14 +1263,6 @@ static bool8 is_BSCart_BIOS(const uint8 *data, uint32 size)
return (FALSE);
}
static bool8 is_SameGame_Add_On (const uint8 *data, uint32 size)
{
if (size == 0x80000)
return (TRUE);
else
return (FALSE);
}
static bool8 is_BSCartSA1_BIOS (const uint8 *data, uint32 size)
{
//Same basic check as BSCart
@ -2018,7 +2008,7 @@ bool8 CMemory::LoadBSCart ()
CalculatedSize = Multi.cartSizeA;
if (Multi.cartSizeB == 0 && Multi.cartSizeA <= (MAX_ROM_SIZE - 0x100000 - Multi.cartOffsetA))
if (Multi.cartSizeB == 0 && Multi.cartSizeA <= (int32)(MAX_ROM_SIZE - 0x100000 - Multi.cartOffsetA))
{
//Initialize 1MB Empty Memory Pack only if cart B is cleared
//It does not make a Memory Pack if game is loaded like a normal ROM
@ -2518,6 +2508,7 @@ void CMemory::InitROM (void)
// SPC7110
case 0xF93A:
Settings.SPC7110RTC = TRUE;
// Fall through
case 0xF53A:
Settings.SPC7110 = TRUE;
S9xInitSPC7110();
@ -2930,7 +2921,7 @@ void CMemory::map_index (uint32 bank_s, uint32 bank_e, uint32 addr_s, uint32 add
for (i = addr_s; i <= addr_e; i += 0x1000)
{
p = (c << 4) | (i >> 12);
Map[p] = (uint8 *) index;
Map[p] = (uint8 *) (pint) index;
BlockIsROM[p] = isROM;
BlockIsRAM[p] = isRAM;
}
@ -4041,7 +4032,6 @@ static bool8 ReadBPSPatch (Stream *r, long, int32 &rom_size)
if(patch_crc32 != pp_crc32) { delete[] data; return false; } //patch is corrupted
if(!Settings.IgnorePatchChecksum && rom_crc32 != source_crc32) { delete[] data; return false; } //patch is for a different ROM
uint32 source_size = XPSdecode(data, addr, size);
uint32 target_size = XPSdecode(data, addr, size);
uint32 metadata_size = XPSdecode(data, addr, size);
addr += metadata_size;

View File

@ -190,7 +190,7 @@
***********************************************************************************/
#ifdef NETPLAY_SUPPORT
#if defined(NETPLAY_SUPPORT) || 1
#ifdef _DEBUG
#define NP_DEBUG 1
#endif
@ -596,11 +596,11 @@ void S9xNPProcessClient (int c)
if (NPServer.SyncByReset)
{
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) c);
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) (pint) c);
S9xNPServerAddTask (NP_SERVER_RESET_ALL, 0);
}
else
S9xNPServerAddTask (NP_SERVER_SYNC_CLIENT, (void *) c);
S9xNPServerAddTask (NP_SERVER_SYNC_CLIENT, (void *) (pint) c);
break;
case NP_CLNT_RECEIVED_ROM_IMAGE:
@ -615,11 +615,11 @@ void S9xNPProcessClient (int c)
if (NPServer.SyncByReset)
{
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) c);
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) (pint) c);
S9xNPServerAddTask (NP_SERVER_RESET_ALL, 0);
}
else
S9xNPServerAddTask (NP_SERVER_SYNC_CLIENT, (void *) c);
S9xNPServerAddTask (NP_SERVER_SYNC_CLIENT, (void *) (pint) c);
break;
@ -660,7 +660,7 @@ void S9xNPProcessClient (int c)
if (NPServer.SyncByReset)
{
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) c);
S9xNPServerAddTask (NP_SERVER_SEND_SRAM, (void *) (pint) c);
S9xNPServerAddTask (NP_SERVER_RESET_ALL, 0);
}
else
@ -668,7 +668,7 @@ void S9xNPProcessClient (int c)
S9xNPServerAddTask (NP_SERVER_SYNC_CLIENT, (void *) c);
#else
/* We need to resync all clients on new player connect as we don't have a 'reference game' */
S9xNPServerAddTask (NP_SERVER_SYNC_ALL, (void *) c);
S9xNPServerAddTask (NP_SERVER_SYNC_ALL, (void *) (pint) c);
#endif
}
}

View File

@ -1322,7 +1322,7 @@ bool8 S9xUnfreezeGame (const char *filename)
void S9xFreezeToStream (STREAM stream)
{
char buffer[1024];
char buffer[8192];
uint8 *soundsnapshot = new uint8[SPC_SAVE_STATE_BLOCK_SIZE];
sprintf(buffer, "%s:%04d\n", SNAPSHOT_MAGIC, SNAPSHOT_VERSION);
@ -1473,7 +1473,7 @@ int S9xUnfreezeFromStream (STREAM stream)
char buffer[PATH_MAX + 1];
len = strlen(SNAPSHOT_MAGIC) + 1 + 4 + 1;
if (READ_STREAM(buffer, len, stream) != len)
if (READ_STREAM(buffer, len, stream) != (unsigned int ) len)
return (WRONG_FORMAT);
if (strncmp(buffer, SNAPSHOT_MAGIC, strlen(SNAPSHOT_MAGIC)) != 0)
@ -2129,7 +2129,7 @@ static int UnfreezeBlock (STREAM stream, const char *name, uint8 *block, int siz
memset(block, 0, size);
if (READ_STREAM(block, len, stream) != len)
if (READ_STREAM(block, len, stream) != (unsigned int) len)
{
REVERT_STREAM(stream, rewind, 0);
return (WRONG_FORMAT);

View File

@ -196,6 +196,9 @@
// Top-level compilation.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#ifndef _NEWTILE_CPP
#define _NEWTILE_CPP
@ -1542,3 +1545,4 @@ static void (*MAKENAME(Renderers_, NAME1, NAME2)[7]) (ARGS) =
#endif
#endif
#endif
#pragma GCC diagnostic pop