Skip to content

Commit

Permalink
fix some harmless warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
toxieainc committed Feb 20, 2025
1 parent d73075b commit 963c07a
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 58 deletions.
3 changes: 1 addition & 2 deletions ext/basicbitmap/BasicBitmap_SSE2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1663,11 +1663,10 @@ static int _x86_cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
static int _x86_cpu_detect_feature(unsigned int *features)
{
int eax = 0, ebx = 0, ecx = 0, edx = 0;
int level = 0;
features[0] = features[1] = features[2] = features[3] = 0;
features[4] = features[5] = features[6] = features[7] = 0;
if (_x86_cpuid(0, &eax, &ebx, &ecx, &edx) != 0) return -1;
level = eax;
int level = eax;
#if (!defined(__x86_64__)) && (!defined(__amd64__)) && (!defined(_M_X64))
if (level < 1) level = 1;
#endif
Expand Down
13 changes: 4 additions & 9 deletions src/cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -4949,7 +4949,6 @@ static int DoSearchMenu(struct mame_bitmap * bitmap, int selection, int startNew
};

INT32 sel;
static INT32 submenuChoice = 0;
const char * menu_item[kMenu_Max + 2] = { 0 };
const char * menu_subitem[kMenu_Max + 2] = { 0 };
char flagBuf[kMenu_Max + 2] = { 0 };
Expand Down Expand Up @@ -5243,7 +5242,6 @@ static int DoSearchMenu(struct mame_bitmap * bitmap, int selection, int startNew
break;

case kMenu_Return:
submenuChoice = 0;
sel = -1;
break;

Expand Down Expand Up @@ -8126,7 +8124,7 @@ static void BuildSearchRegions(SearchInfo * info)
}
else if(info->targetIdx < cpu_gettotalcpu())
{
const struct Memory_WriteAddress * mwa = NULL;
const struct Memory_WriteAddress * mwa;
SearchRegion * traverse;
int count = 0;

Expand Down Expand Up @@ -10213,10 +10211,9 @@ static void UpdateCheatInfo(CheatEntry * entry, UINT8 isLoadTime)
{
int isOneShot = 1;
int isNull = 1;
int flags = 0;
int i;

flags = entry->flags & kCheatFlag_PersistentMask;
int flags = entry->flags & kCheatFlag_PersistentMask;

if( (EXTRACT_FIELD(entry->actionList[0].type, LocationType) == kLocation_Custom) &&
(EXTRACT_FIELD(entry->actionList[0].type, LocationParameter) == kCustomLocation_Select))
Expand All @@ -10226,12 +10223,10 @@ static void UpdateCheatInfo(CheatEntry * entry, UINT8 isLoadTime)
{
CheatAction * action = &entry->actionList[i];
//int isActionNull = 0;
UINT32 size;
UINT32 operation;
UINT32 actionFlags = action->flags & kActionFlag_PersistentMask;

size = EXTRACT_FIELD(action->type, BytesUsed);
operation = EXTRACT_FIELD(action->type, Operation) | EXTRACT_FIELD(action->type, OperationExtend) << 2;
UINT32 size = EXTRACT_FIELD(action->type, BytesUsed);
UINT32 operation = EXTRACT_FIELD(action->type, Operation) | EXTRACT_FIELD(action->type, OperationExtend) << 2;

if( (EXTRACT_FIELD(action->type, LocationType) == kLocation_Custom) &&
(EXTRACT_FIELD(action->type, LocationParameter) == kCustomLocation_Comment))
Expand Down
6 changes: 1 addition & 5 deletions src/cpu/at91/at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,6 @@ unsigned at91_dasm(char *buffer, unsigned int pc)

void at91_init(void)
{
int i;

//clear out static data - since for VPM this code can be re-run with values from last game run which causes issues
memset(&at91, 0, sizeof(at91));
memset(&at91rs, 0, sizeof(at91rs));
Expand All @@ -1976,7 +1974,7 @@ void at91_init(void)
arm7_core_init("at91");

//allocate timers
for(i=0;i<MAX_TIMER;i++)
for(int i=0;i<MAX_TIMER;i++)
{
at91rs.timer[i] = timer_alloc(timer_trigger_event);
}
Expand All @@ -1995,8 +1993,6 @@ void at91_init(void)
//at91usart[i].US_CSR = US_ENDTX | US_ENDRX; // On reset, according to datasheet, only ENDTX and ENDRX are set but we also need TXRDY/US_TXEMPTY to be defined (I guess they would be set after USART setup by AT91)
at91usart[i].US_CSR = US_ENDTX | US_ENDRX | US_TXRDY | US_TXEMPTY;
}

return;
}

#if USE_MAME_TIMERS
Expand Down
2 changes: 0 additions & 2 deletions src/sound/disc_flt.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,6 @@ int dst_op_amp_filt_reset(struct node_description *node)

int dst_op_amp_filt_init(struct node_description *node)
{
struct dst_op_amp_filt_context *context = (struct dst_op_amp_filt_context*)node->context;

/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dst_op_amp_filt_context)))==NULL)
{
Expand Down
2 changes: 0 additions & 2 deletions src/sound/disc_mth.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,6 @@ int dst_mixer_reset(struct node_description *node)

int dst_mixer_init(struct node_description *node)
{
struct dst_mixer_context*context = (struct dst_mixer_context*)node->context;

/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dst_mixer_context)))==NULL)
{
Expand Down
5 changes: 2 additions & 3 deletions src/win32com/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ STDMETHODIMP CController::Run(/*[in]*/ LONG_PTR hParentWnd, /*[in,defaultvalue(1

if(!cabinetMode) {
if ( fFirstTime ) {
char szTemp[256];
sprintf(szTemp,"This is the first time you use: %s\nPlease specify options for this game by clicking \"OK\"!",drivers[m_nGameNo]->description);
MessageBox(GetActiveWindow(),szTemp,"Notice!",MB_OK | MB_ICONINFORMATION);
m_pGameSettings->ShowSettingsDlg(0);
Expand Down Expand Up @@ -618,7 +617,7 @@ STDMETHODIMP CController::get_ChangedNVRAM(VARIANT *pVal)
uCount = min((size_t)nvram_file->offset, CORE_MAXNVRAM);
for (size_t i = 0; i < uCount; ++i)
{
chgNVRAMs[i].nvramNo = i;
chgNVRAMs[i].nvramNo = (int)i;
chgNVRAMs[i].oldStat = 0; //!!
chgNVRAMs[i].currStat = nvram_file->data[i];
}
Expand All @@ -641,7 +640,7 @@ STDMETHODIMP CController::get_ChangedNVRAM(VARIANT *pVal)
{
if (oldNVRAM[i] != nvram_file->data[i])
{
chgNVRAMs[uCount].nvramNo = i;
chgNVRAMs[uCount].nvramNo = (int)i;
chgNVRAMs[uCount].oldStat = oldNVRAM[i];
chgNVRAMs[uCount].currStat = nvram_file->data[i];
uCount++;
Expand Down
2 changes: 1 addition & 1 deletion src/win32com/VPinMAME.idl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ import "ocidl.idl";
]
interface IController : IDispatch
{
[id(1), helpstring("method Run")] HRESULT Run([in,defaultvalue(0)] LONG_PTR hParentWnd, [in,defaultvalue(99)] int nMinVersion);
[id(1), helpstring("method Run")] HRESULT Run([in,defaultvalue(0)] LONG_PTR hParentWnd, [in,defaultvalue(100)] int nMinVersion);
[id(2), helpstring("method Stop")] HRESULT Stop();
/* ! */ [id(3), helpstring("method ShowOptsDialog")] HRESULT ShowOptsDialog([in,defaultvalue(0)] LONG_PTR hParentWnd);
/* ! */ [id(4), helpstring("method ShowAboutDialog")] HRESULT ShowAboutDialog([in,defaultvalue(0)] LONG_PTR hParentWnd);
Expand Down
40 changes: 20 additions & 20 deletions src/win32com/VPinMAMEConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ extern UINT8 blit_swapxy;
void vpm_game_init(int game_index) {
logfile = config_get_logfile();

/* first start with the game's built in orientation */
/* first start with the game's built in orientation */
int orientation = drivers[game_index]->flags & ORIENTATION_MASK;
options.ui_orientation = orientation;

Expand Down Expand Up @@ -393,10 +393,10 @@ void CLIB_DECL logerror(const char *text,...) {
vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), text, arg);
OutputDebugString(szBuffer);
fprintf(logfile, szBuffer);
//DAR@20230518 Delay in output was hiding cause of crash, should flush
// the buffer regularly to ensure capture
fflush(logfile);

//DAR@20230518 Delay in output was hiding cause of crash, should flush
// the buffer regularly to ensure capture
fflush(logfile);
}
va_end(arg);
}
Expand Down Expand Up @@ -541,10 +541,10 @@ bool RegSaveOpts(HKEY hKey, rc_option *pOpt, void* pValue)
case rc_string:
pszValue = *(char**) pValue;
if ( pszValue )
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) pszValue, strlen(pszValue)+1)!=ERROR_SUCCESS);
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) pszValue, (DWORD)strlen(pszValue)+1)!=ERROR_SUCCESS);
else {
lstrcpy(szTemp, "");
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) &szTemp, strlen(szTemp)+1)!=ERROR_SUCCESS);
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) &szTemp, (DWORD)strlen(szTemp)+1)!=ERROR_SUCCESS);
}
break;

Expand All @@ -559,7 +559,7 @@ bool RegSaveOpts(HKEY hKey, rc_option *pOpt, void* pValue)

case rc_float:
sprintf(szTemp, "%f", *(float*)pValue);
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) szTemp, strlen(szTemp)+1)!=ERROR_SUCCESS);
fFailed = (RegSetValueEx(hKey, pOpt->name, 0, REG_SZ, (LPBYTE) szTemp, (DWORD)strlen(szTemp)+1)!=ERROR_SUCCESS);
break;
}

Expand All @@ -575,7 +575,7 @@ void SaveGlobalSettings()

HKEY hKey;
DWORD dwDisposition;
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
return;

rc_option* opts[10];
Expand All @@ -590,7 +590,7 @@ void SaveGlobalSettings()
case rc_float:
if ( !IsGlobalSetting(opts[sp]->name) || IgnoreSetting(opts[sp]->name) )
break;

RegSaveOpts(hKey, opts[sp], opts[sp]->dest);
break;

Expand Down Expand Up @@ -680,7 +680,7 @@ void DeleteGlobalSettings()
lstrcpy(szKey, REG_BASEKEY);

HKEY hKey;
if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey)!=ERROR_SUCCESS )
if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey)!=ERROR_SUCCESS )
return;

RegDeleteKey(hKey, REG_GLOBALS);
Expand All @@ -700,7 +700,7 @@ void SaveGameSettings(const char* const pszGameName)

HKEY hKey;
DWORD dwDisposition;
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
return;

rc_option* opts[10];
Expand Down Expand Up @@ -810,7 +810,7 @@ void DeleteGameSettings(const char * const pszGameName)
lstrcpy(szKey, REG_BASEKEY);

HKEY hKey;
if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey)!=ERROR_SUCCESS )
if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey)!=ERROR_SUCCESS )
return;

if ( pszGameName && *pszGameName )
Expand Down Expand Up @@ -920,7 +920,7 @@ BOOL PutSetting(const char* const pszGameName, const char* const pszName, VARIAN

HKEY hKey;
DWORD dwDisposition;
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
if ( RegCreateKeyEx(HKEY_CURRENT_USER, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
return FALSE;

BOOL fSuccess = TRUE;
Expand All @@ -942,7 +942,7 @@ BOOL PutSetting(const char* const pszGameName, const char* const pszName, VARIAN
pszValue = szValue;
RegSaveOpts(hKey, option, &pszValue);
break;

case rc_int:
VariantChangeType(&vValue, &vValue, 0, VT_I4);
RegSaveOpts(hKey, option, &vValue.lVal);
Expand Down Expand Up @@ -974,15 +974,15 @@ BOOL WriteRegistry(const char* const pszKey, const char* const pszName, DWORD dw
if ( !pszKey || !*pszKey )
return FALSE;

if ( RegCreateKeyEx(HKEY_CURRENT_USER, pszKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
if ( RegCreateKeyEx(HKEY_CURRENT_USER, pszKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition)!=ERROR_SUCCESS )
return FALSE;

if ( RegSetValueEx(hKey, pszName, 0, REG_DWORD, (LPBYTE) &dwValue, sizeof dwValue)!=ERROR_SUCCESS ) {
if ( RegSetValueEx(hKey, pszName, 0, REG_DWORD, (LPBYTE) &dwValue, sizeof dwValue)!=ERROR_SUCCESS ) {
RegCloseKey(hKey);
return FALSE;
}
RegCloseKey(hKey);

return TRUE;
}

Expand All @@ -996,12 +996,12 @@ DWORD ReadRegistry(const char* const pszKey, const char* const pszName, DWORD dw
if ( !pszKey || !*pszKey )
return FALSE;

if ( RegOpenKeyEx(HKEY_CURRENT_USER, pszKey, 0, KEY_QUERY_VALUE, &hKey)!=ERROR_SUCCESS )
if ( RegOpenKeyEx(HKEY_CURRENT_USER, pszKey, 0, KEY_QUERY_VALUE, &hKey)!=ERROR_SUCCESS )
return dwValue;

dwType = REG_DWORD;
dwSize = sizeof dwValue;
if ( RegQueryValueEx(hKey, pszName, 0, &dwType, (LPBYTE) &dwValue, &dwSize)!=ERROR_SUCCESS )
if ( RegQueryValueEx(hKey, pszName, 0, &dwType, (LPBYTE) &dwValue, &dwSize)!=ERROR_SUCCESS )
dwValue = dwDefault;

RegCloseKey(hKey);
Expand Down
3 changes: 1 addition & 2 deletions src/wpc/by35.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,9 @@ static WRITE_HANDLER(sam1cb2_w) {
pia_set_input_cb1(4, data); // J4-10
}
static READ_HANDLER(sam2a_r) {
int lastbcd;
logerror("2A %04x %x %02x %02x %02x\n", activecpu_get_pc(), locals.ca20, locals.a0, locals.a1, locals.lastbcd);
if (locals.ca20) {
lastbcd = locals.lastbcd;
int lastbcd = locals.lastbcd;
locals.lastbcd = 1;
return lastbcd ? 0x80 : 0x00;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wpc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3390,7 +3390,6 @@ void core_dmd_render_dmddevice(const int width, const int height, const UINT8* c
void core_dmd_capture_frame(const int width, const int height, const UINT8* const dmdDotRaw, const int rawFrameCount, const UINT8* const rawFrame) {
const int isStrikeNSpares = strncasecmp(Machine->gamedrv->name, "snspare", 7) == 0;
if (!isStrikeNSpares && (g_fDumpFrames || (g_fShowPinDMD && g_fShowWinDMD))) {
FILE *f;
char *ptr;
char DumpFilename[MAX_PATH];
const DWORD tick = GetTickCount();
Expand Down Expand Up @@ -3439,6 +3438,7 @@ void core_dmd_capture_frame(const int width, const int height, const UINT8* cons
static UINT8 lastCapture[DMD_MAXX * DMD_MAXY] = { 0 };
if (memcmp(lastCapture, dmdDotRaw, width * height) != 0)
{
FILE *f;
memcpy(lastCapture, dmdDotRaw, width * height);
strcat_s(DumpFilename, MAX_PATH, ".txt");
f = fopen(DumpFilename, "a");
Expand Down
4 changes: 2 additions & 2 deletions src/wpc/lancelot.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ static WRITE_HANDLER(disp_w) {
}

static WRITE_HANDLER(col_w) {
int i, seg;
int i;
locals.col = data & 0x0f;
if (locals.col) {
for (i = 0; i < 6; i++) {
seg = (5 - i) * 8 + 8 - locals.col;
int seg = (5 - i) * 8 + 8 - locals.col;
coreGlobals.segments[seg].w = locals.dispData[5 - i];
// make up for a silly flaw in code; comma segment is contained in another digit!
if (seg == 41 || seg == 44 || seg == 47) {
Expand Down
3 changes: 1 addition & 2 deletions src/wpc/ltd.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ static void snd_stop(int param) {
*/
static WRITE_HANDLER(peri_w) {
static const int freq[] = { 105, 70, 40, 30, 21, 15, 10, 5 };
int seg;
if (offset < 0x06) {
if (!strncasecmp(Machine->gamedrv->name, "spcpoker", 8)) {
if (offset == 5) { // extra strobe for more lamps
Expand Down Expand Up @@ -210,7 +209,7 @@ static WRITE_HANDLER(peri_w) {
coreGlobals.solenoids = locals.solenoids;
locals.vblankCount = 0;
} else if (offset == 0x08) {
seg = 9 - (locals.strobe & 0x0f);
int seg = 9 - (locals.strobe & 0x0f);
locals.segments[seg].w = core_bcd2seg7a[data >> 4];
locals.segments[10 + seg].w = core_bcd2seg7a[data & 0x0f];
if (core_gameData->hw.gameSpecific1 & (1 << seg)) {
Expand Down
3 changes: 1 addition & 2 deletions src/wpc/regama.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ static int colForBit(UINT8 data) {
}

static WRITE_HANDLER(riot_portc_w) {
int strobe;
int col = colForBit(data);
if (col) {
if (data & 1)
Expand All @@ -58,7 +57,7 @@ static WRITE_HANDLER(riot_portc_w) {
case 1:
case 2:
if (locals.bitCnt > 15) {
strobe = (locals.latch & 0x1000) ? 1 : 0; // this is probably how additional displays are accessed, needs other games to confirm
int strobe = (locals.latch & 0x1000) ? 1 : 0; // this is probably how additional displays are accessed, needs other games to confirm
coreGlobals.segments[strobe + 16 - 8 * col].w = core_bcd2seg7[core_revnyb(0x0f & locals.latch)];
coreGlobals.segments[strobe + 18 - 8 * col].w = core_bcd2seg7[core_revnyb(0x0f & locals.latch >> 4)];
coreGlobals.segments[strobe + 20 - 8 * col].w = core_bcd2seg7[core_revnyb(0x0f & locals.latch >> 8)];
Expand Down
2 changes: 1 addition & 1 deletion src/wpc/s11.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ static WRITE_HANDLER(latch2200) {
static WRITE_HANDLER(pia0cb2_w) {
locals.ssEn = !data;
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & ~(1 << (S11_GAMEONSOL - 1))) | (data ? 0 : (1 << (S11_GAMEONSOL - 1)));
core_write_pwm_output(CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1, 1, locals.ssEn ? 1.f : 0.f);
core_write_pwm_output(CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1, 1, locals.ssEn ? 1 : 0);
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL, 6, locals.ssEn ? locals.switchedSol : 0);
}

Expand Down
6 changes: 2 additions & 4 deletions src/wpc/se.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,19 +1000,17 @@ PINMAME_VIDEO_UPDATE(seminidmd4_update) {
static const int color[2][2] = {
{ 0, 7 }, { 8, 10 } // off, green, red, yellow
};
int ii;
UINT8 *line;
UINT16 *seg = coreGlobals.drawSeg;

for (ii=0; ii < 14; ii++) {
for (int ii=0; ii < 14; ii++) {
UINT16 bits1 = 0;
UINT16 bits2 = 0;
int kk, bits;
for (kk=0, bits = 0x40; kk < 7; kk++, bits >>= 1) {
int isRed = (selocals.minidmd[0][ii/7][ii%7] & bits) > 0;
int isGrn = (selocals.minidmd[1][ii/7][ii%7] & bits) > 0;
bits1 = (bits1 << 2) | (isGrn << 1) | isRed;
line = &coreGlobals.dmdDotRaw[ii * layout->length + kk];
UINT8* line = &coreGlobals.dmdDotRaw[ii * layout->length + kk];
*line = color[isRed][isGrn];
isRed = (selocals.minidmd[2][ii/7][ii%7] & bits) > 0;
isGrn = (selocals.minidmd[3][ii/7][ii%7] & bits) > 0;
Expand Down

0 comments on commit 963c07a

Please sign in to comment.