From 21f7c8423fa4e0c68eb3adf82d371ec8e9a5af6c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 May 2017 17:38:50 +0200 Subject: [PATCH] Fix obvious bugs found by GCC 7.1 (nw) --- src/devices/bus/isa/hdc.cpp | 2 +- src/devices/cpu/dsp56k/dsp56pcu.cpp | 2 +- src/devices/cpu/spc700/spc700.cpp | 2 +- src/devices/machine/hdc92x4.cpp | 2 +- src/devices/machine/stvcd.cpp | 2 +- src/devices/video/snes_ppu.cpp | 2 +- src/emu/render.h | 2 +- src/mame/machine/n64.cpp | 2 +- src/mame/video/decodmd1.cpp | 2 +- src/mame/video/pc4.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/devices/bus/isa/hdc.cpp b/src/devices/bus/isa/hdc.cpp index 52a8bb34e0c..4f22a5ac616 100644 --- a/src/devices/bus/isa/hdc.cpp +++ b/src/devices/bus/isa/hdc.cpp @@ -884,7 +884,7 @@ uint8_t xt_hdc_device::data_r() data_cnt = 0; } data = buffer[data_cnt++]; - if(data_cnt >= ((sector_cnt[drv] * 512) ? (sector_cnt[drv] * 512) : (256 * 512))) + if(data_cnt >= ((sector_cnt[drv]!=0) ? (sector_cnt[drv] * 512) : (256 * 512))) { data_cnt = 0; pc_hdc_result(1); diff --git a/src/devices/cpu/dsp56k/dsp56pcu.cpp b/src/devices/cpu/dsp56k/dsp56pcu.cpp index 245d83e7d87..529c623a506 100644 --- a/src/devices/cpu/dsp56k/dsp56pcu.cpp +++ b/src/devices/cpu/dsp56k/dsp56pcu.cpp @@ -148,7 +148,7 @@ void pcu_reset(dsp56k_core* cpustate) /* P:$cfff -> Internal P:$07ff high byte */ uint8_t mem_value_low = cpustate->program->read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */ uint8_t mem_value_high = cpustate->program->read_byte(mem_offset); - cpustate->program_ram[i] = (mem_value_high << 8) || mem_value_low; + cpustate->program_ram[i] = (mem_value_high << 8) | mem_value_low; } /* HACK - Set the PC to 0x0000 as per the boot ROM. */ diff --git a/src/devices/cpu/spc700/spc700.cpp b/src/devices/cpu/spc700/spc700.cpp index 410be9f41d4..b7f54dc2554 100644 --- a/src/devices/cpu/spc700/spc700.cpp +++ b/src/devices/cpu/spc700/spc700.cpp @@ -1258,7 +1258,7 @@ void spc700_device::state_string_export(const device_state_entry &entry, std::st (m_flag_b) ? 'B':'.', (m_flag_h & HFLAG_SET) ? 'H':'.', ( m_flag_i) ? 'I':'.', - ((!m_flag_z) << 1) ? 'Z':'.', + (((!m_flag_z) << 1) & 1) ? 'Z':'.', ((m_flag_c >> 8)&1) ? 'C':'.' ); break; diff --git a/src/devices/machine/hdc92x4.cpp b/src/devices/machine/hdc92x4.cpp index a14b8f231a1..b75c865b2ce 100644 --- a/src/devices/machine/hdc92x4.cpp +++ b/src/devices/machine/hdc92x4.cpp @@ -2068,7 +2068,7 @@ void hdc92x4_device::format_track() cont = WAIT; break; case TRACKDONE: - if (FORMAT_TRACK && TRACE_SUBSTATES) logerror("Track writing done\n"); + if (TRACE_FORMAT && TRACE_SUBSTATES) logerror("Track writing done\n"); cont = SUCCESS; break; } diff --git a/src/devices/machine/stvcd.cpp b/src/devices/machine/stvcd.cpp index 0d19577524b..6fc101d79fb 100644 --- a/src/devices/machine/stvcd.cpp +++ b/src/devices/machine/stvcd.cpp @@ -2140,7 +2140,7 @@ void saturn_state::read_new_dir(uint32_t fileno) // makes the directory pointed to by FAD current void saturn_state::make_dir_current(uint32_t fad) { - int i; + uint32_t i; uint32_t nextent, numentries; std::vector sect(MAX_DIR_SIZE); direntryT *curentry; diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp index 836690f2a72..49ee17c94b4 100644 --- a/src/devices/video/snes_ppu.cpp +++ b/src/devices/video/snes_ppu.cpp @@ -419,7 +419,7 @@ void snes_ppu_device::device_reset() { elem.enable = 0; elem.clip = 0; - memset(elem.buffer, 0, SNES_SCR_WIDTH); + memset(elem.buffer, 0, SNES_SCR_WIDTH * sizeof(uint16_t)); memset(elem.priority, 0, SNES_SCR_WIDTH); memset(elem.layer, 0, SNES_SCR_WIDTH); memset(elem.blend_exception, 0, SNES_SCR_WIDTH); diff --git a/src/emu/render.h b/src/emu/render.h index 3a5b5cecccc..2f86b6032e0 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -1110,7 +1110,7 @@ public: void set_max_texture_size(int maxwidth, int maxheight); void set_transform_container(bool transform_container) { m_transform_container = transform_container; } void set_keepaspect(bool keepaspect) { m_keepaspect = keepaspect; } - void set_scale_mode(bool scale_mode) { m_scale_mode = scale_mode; } + void set_scale_mode(int scale_mode) { m_scale_mode = scale_mode; } // layer config getters bool backdrops_enabled() const { return m_layerconfig.backdrops_enabled(); } diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index 52eaa42d1c2..88355534a74 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -2720,7 +2720,7 @@ void n64_state::n64_machine_stop() device_image_interface *image = dynamic_cast(periphs->m_nvram_image); uint8_t data[0x30800]; - if (m_sram != nullptr) + if (m_sram == nullptr) { memset(data, 0, 0x20000); } diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index 409c7f92018..47d2bb5857b 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -252,7 +252,7 @@ void decodmd_type1_device::device_reset() m_rom = memregion(m_gfxtag); memset(RAM,0,0x2000); - memset(m_pixels,0,0x200); + memset(m_pixels,0,0x200*sizeof(uint32_t)); ROM = m_rom->base(); m_rombank1->configure_entries(0, 8, &ROM[0x0000], 0x4000); diff --git a/src/mame/video/pc4.cpp b/src/mame/video/pc4.cpp index 336da060c7d..81a829500bf 100644 --- a/src/mame/video/pc4.cpp +++ b/src/mame/video/pc4.cpp @@ -144,7 +144,7 @@ WRITE8_MEMBER(pc4_state::lcd_control_w) READ8_MEMBER(pc4_state::lcd_control_r) { - return m_busy_flag<<7 || m_ac&0x7f; + return (m_busy_flag<<7) | (m_ac & 0x7f); } void pc4_state::update_ac(void)