Skip to content

Commit 8170718

Browse files
committed
general: housekeeping and msvc warning elimination
* avoid potential unsafe use of bool * avoid potentially empty controlled statements * annotate some unused variables * remove some undefined functions
1 parent 2692ea1 commit 8170718

File tree

18 files changed

+34
-28
lines changed

18 files changed

+34
-28
lines changed

Diff for: src/devices/bus/nes/mmc3_clones.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2934,11 +2934,11 @@ void nes_bmc_f600_device::write_l(offs_t offset, u8 data)
29342934
m_reg = offset;
29352935

29362936
m_prg_base = (m_reg & 0x38) << 1;
2937-
m_prg_mask = 0x1f >> BIT(m_reg, 5);
2937+
m_prg_mask = 0x1f >> (BIT(m_reg, 5) ? 1 : 0);
29382938
set_prg(m_prg_base, m_prg_mask);
29392939

29402940
m_chr_base = (m_reg & 0x07) << 7;
2941-
m_chr_mask = 0xff >> !BIT(m_reg, 2);
2941+
m_chr_mask = 0xff >> (BIT(m_reg, 2) ? 0 : 1);
29422942
set_chr(m_chr_source, m_chr_base, m_chr_mask);
29432943
}
29442944
}
@@ -3332,7 +3332,7 @@ void nes_bmc_810305c_device::write_h(offs_t offset, u8 data)
33323332
m_outer = BIT(offset, 13, 2);
33333333

33343334
m_prg_base = m_outer << 5;
3335-
m_prg_mask = 0x1f >> (m_outer == 2);
3335+
m_prg_mask = 0x1f >> ((m_outer == 2) ? 1 : 0);
33363336
set_prg(m_prg_base, m_prg_mask);
33373337

33383338
m_chr_base = m_outer << 7;

Diff for: src/devices/bus/spectrum/neogs.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ void neogs_device::dac_flush()
310310
right += out;
311311

312312
if (BIT(m_gscfg0, 2) && BIT(m_gscfg0, 6)) // PAN4CH
313-
;
313+
{
314+
// TODO
315+
}
314316
}
315317
m_dac[0]->data_w(left);
316318
m_dac[1]->data_w(right);

Diff for: src/devices/cpu/avr8/avr8.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@ class avr8_device : public avr8_base_device
938938
void tccr1a_w(uint8_t data);
939939
void tccr1b_w(uint8_t data);
940940
void tccr1c_w(uint8_t data);
941-
void tcnt1l_w(uint8_t data);
942-
void tcnt1h_w(uint8_t data);
941+
//void tcnt1l_w(uint8_t data);
942+
//void tcnt1h_w(uint8_t data);
943943
void icr1l_w(uint8_t data);
944944
void icr1h_w(uint8_t data);
945945
void ocr1al_w(uint8_t data);
@@ -1045,8 +1045,8 @@ class avr8_device : public avr8_base_device
10451045
void tccr3a_w(uint8_t data);
10461046
void tccr3b_w(uint8_t data);
10471047
void tccr3c_w(uint8_t data);
1048-
void tcnt3l_w(uint8_t data);
1049-
void tcnt3h_w(uint8_t data);
1048+
//void tcnt3l_w(uint8_t data);
1049+
//void tcnt3h_w(uint8_t data);
10501050
void icr3l_w(uint8_t data);
10511051
void icr3h_w(uint8_t data);
10521052
void ocr3al_w(uint8_t data);

Diff for: src/devices/cpu/i386/i386segs.hxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ void i386_device::i386_trap_with_error(int irq, int irq_gate, int trap_level, ui
794794
PUSH16(error);
795795
}
796796
}
797-
catch(uint64_t e)
797+
catch([[maybe_unused]] uint64_t e)
798798
{
799799
trap_level++;
800800
if(trap_level == 1)

Diff for: src/devices/machine/arm_iomd.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ template <unsigned Which> void arm_iomd_device::irqmsk_w(u32 data)
469469
// master clock control
470470
inline void arm7500fe_iomd_device::refresh_host_cpu_clocks()
471471
{
472-
m_host_cpu->set_unscaled_clock(this->clock() >> (m_cpuclk_divider == false));
472+
m_host_cpu->set_unscaled_clock(this->clock() >> (m_cpuclk_divider ? 0 : 1));
473473
}
474474

475475
u32 arm7500fe_iomd_device::clkctl_r()

Diff for: src/devices/machine/psion_asic5.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void psion_asic5_device::device_reset()
110110
m_int_mask = 0x00;
111111
m_int_status = 0x02; // UART transmitter empty
112112
m_control = 0x00;
113-
m_bdr = 0xffff;
113+
m_bdr = -1;
114114

115115
receive_register_reset();
116116
transmit_register_reset();

Diff for: src/frontend/mame/ui/prscntrl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ menu_control_device_preset::~menu_control_device_preset()
4646
void menu_control_device_preset::populate()
4747
{
4848
auto presets = m_image.preset_images_list();
49-
for(int i = 0; i != int(presets.size()); i++)
49+
for(uintptr_t i = 0; i != uintptr_t(presets.size()); i++)
5050
item_append(presets[i], 0, reinterpret_cast<void *>(i));
51-
set_selection(reinterpret_cast<void *>(m_image.current_preset_image_id()));
51+
set_selection(reinterpret_cast<void *>(uintptr_t(m_image.current_preset_image_id())));
5252
}
5353

5454

Diff for: src/lib/netlist/tools/nl_convert.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void nl_convert_spice_t::convert_block(const str_list &contents)
340340
{
341341
process_line(line);
342342
}
343-
catch (const plib::pexception &e)
343+
catch ([[maybe_unused]] const plib::pexception &e)
344344
{
345345
fprintf(stderr, "Error on line: <%d>\n", linenumber);
346346
throw;

Diff for: src/mame/ibm/ibm5100.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ u8 ibm5100_state::nxr_r()
536536
* giving 64KiB. Even and odd bytes are selected by a flip-flop
537537
* which is toggled with each read.
538538
*/
539-
data = BIT(m_nxr[rs][m_nxr_address >> basic], (m_nxr_ff & NXR_B0) ? 0 : 8, 8);
539+
data = BIT(m_nxr[rs][m_nxr_address >> (basic ? 1 : 0)], (m_nxr_ff & NXR_B0) ? 0 : 8, 8);
540540
}
541541

542542
// always increment address for BASIC, only on odd bytes for APL

Diff for: src/mame/igs/igs_m027.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ class igs_m027_state : public driver_device
232232
u32 slqz3_gpio_r();
233233
u32 lhdmg_gpio_r();
234234
u32 lhzb3106c5m_gpio_r();
235-
void unk2_w(u32 data);
236235

237236
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
238237

Diff for: src/mame/namco/namcos22_v.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ void namcos22_state::draw_sprites()
17511751
bool y_lowres = BIT(~m_spriteram[0], 18);
17521752

17531753
const int deltax = (m_spriteram[1] & 0xffff) + (m_spriteram[2] & 0xffff) + 0x2d;
1754-
const int deltay = (m_spriteram[3] >> 16) + (0x2a >> y_lowres);
1754+
const int deltay = (m_spriteram[3] >> 16) + (0x2a >> (y_lowres ? 1 : 0));
17551755

17561756
const int base = m_spriteram[0] & 0xffff; // alpines/alpinr2b
17571757
int num_sprites = ((m_spriteram[1] >> 16) - base) + 1;

Diff for: src/mame/namco/namcos23.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4081,7 +4081,7 @@ void gorgon_state::render_run(screen_device &screen, bitmap_rgb32 &bitmap)
40814081
{
40824082
bool y_lowres = !BIT(m_c435.spritedata[0], 2);
40834083
s16 deltax = (s16)((s16)m_c435.spritedata[6] + (s16)m_c435.spritedata[10] + 0x50);
4084-
s16 deltay = (s16)((s16)m_c435.spritedata[12] + (0x2a >> y_lowres));
4084+
s16 deltay = (s16)((s16)m_c435.spritedata[12] + (0x2a >> (y_lowres ? 1 : 0)));
40854085
u16 base = m_c435.spritedata[2];
40864086
u16 sprite_count = (m_c435.spritedata[4] - base) + 1;
40874087
for (int i = 0; i < sprite_count; i++)

Diff for: src/mame/nec/pc88va_v.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
680680
void pc88va_state::draw_graphic_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 which)
681681
{
682682
// disable graphic B if screen 0 only setting is enabled
683-
if (which > m_ymmd)
683+
if (which && !m_ymmd)
684684
return;
685685

686686
// ditto for 5bpp color mode

Diff for: src/mame/sinclair/atm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ void atm_state::atm_update_video_mode()
183183
{
184184
bool zx_scale = m_rg & 1;
185185
bool double_width = BIT(m_rg, 1) && !zx_scale;
186-
u8 border_x = (40 - (32 * !zx_scale)) << double_width;
186+
u8 border_x = (40 - (32 * !zx_scale)) << (double_width ? 1 : 0);
187187
u8 border_y = (40 - (4 * !zx_scale));
188188
rectangle scr = get_screen_area();
189-
m_screen->configure(448 << double_width, m_screen->height(), {scr.left() - border_x, scr.right() + border_x, scr.top() - border_y, scr.bottom() + border_y}, m_screen->frame_period().as_attoseconds());
189+
m_screen->configure(448 << (double_width ? 1 : 0), m_screen->height(), {scr.left() - border_x, scr.right() + border_x, scr.top() - border_y, scr.bottom() + border_y}, m_screen->frame_period().as_attoseconds());
190190
LOGVIDEO("Video mode: %d\n", m_rg);
191191

192192
//spectrum_palette(m_palette);

Diff for: src/mame/sinclair/specnext.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2609,7 +2609,8 @@ void specnext_state::map_io(address_map &map)
26092609
return /*m_nr_d8_io_trap_fdc_en ? ... :*/ 0x00;
26102610
}), NAME([this](u8 data) {
26112611
if (m_nr_d8_io_trap_fdc_en)
2612-
;
2612+
{
2613+
}
26132614
}));
26142615

26152616

Diff for: src/mame/sinclair/specnext_tiles.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ specnext_tiles_device &specnext_tiles_device::set_palette(const char *tag, u16 b
6565
TILE_GET_INFO_MEMBER(specnext_tiles_device::get_tile_info)
6666
{
6767
const bool attr_in_map = BIT(~m_control, 5);
68-
const u8 *data = &m_tiles_info[tile_index << attr_in_map];
68+
const u8 *data = &m_tiles_info[tile_index << (attr_in_map ? 1 : 0)];
6969
u8 attr = attr_in_map ? *(data + attr_in_map) : m_default_flags;
7070
u16 code = *data;
7171

Diff for: src/mame/sinclair/sprinter.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void sprinter_state::draw_tile(u8* mode, bitmap_ind16 &bitmap, const rectangle &
424424
{
425425
for (auto dx = cliprect.left(); dx <= cliprect.right(); dx++)
426426
{
427-
const u8 color = m_vram[(y + (((dy - m_hold.second) & 7) >> lowres)) * 1024 + x + (((dx - m_hold.first) & 15) >> (1 + lowres))];
427+
const u8 color = m_vram[(y + (((dy - m_hold.second) & 7) >> (lowres ? 1 : 0))) * 1024 + x + (((dx - m_hold.first) & 15) >> (1 + lowres))];
428428
*pix++ = pal + (BIT(mode[0], 5) ? color : (((dx - m_hold.first) & 1) ? (color & 0x0f) : (color >> 4)));
429429
}
430430
pix += SPRINT_WIDTH - cliprect.width();
@@ -716,9 +716,13 @@ void sprinter_state::dcp_w(offs_t offset, u8 data)
716716

717717
case 0x1b:
718718
if (data & 0x80)
719-
; // RESET
719+
{
720+
// RESET
721+
}
720722
if (data & 0x40)
721-
; // AEN
723+
{
724+
// AEN
725+
}
722726
m_isa_addr_ext = data & 0x3f;
723727
break;
724728

Diff for: src/mame/ussr/juku.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ void juku_state::fdc_data_w(uint8_t data)
579579

580580
void juku_state::speaker_w(int state)
581581
{
582-
m_speaker->level_w((m_beep_state = state) << m_beep_level);
582+
m_speaker->level_w((m_beep_state = state) << (m_beep_level ? 1 : 0));
583583
}
584584

585585

@@ -602,7 +602,7 @@ void juku_state::pio0_porta_w(uint8_t data)
602602
m_contrdat = (col_data & 0b1100'0000) >> 6; // decoded by 2x К555ИД7
603603

604604
if (m_beep_level != BIT(data, 4))
605-
m_speaker->level_w(m_beep_state << (m_beep_level = BIT(data, 4)));
605+
m_speaker->level_w(m_beep_state << ((m_beep_level = BIT(data, 4)) ? 1 : 0));
606606

607607
m_key_encoder->update();
608608
}

0 commit comments

Comments
 (0)