From a0ce6c3b37050c1a765ae13babb109c729153989 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 1 Aug 2016 01:17:27 +1000 Subject: [PATCH] fix after pass through the diff --- src/devices/bus/isa/cga.cpp | 4 ++-- src/devices/machine/laserdsc.cpp | 6 +++--- src/devices/video/bufsprite.h | 2 +- src/emu/render.cpp | 4 ++-- src/lib/formats/apridisk.cpp | 6 +++--- src/lib/formats/cassimg.cpp | 2 +- src/lib/util/chd.cpp | 6 +++--- src/lib/util/flac.cpp | 8 ++++---- src/lib/util/palette.cpp | 4 ++-- src/mame/drivers/prestige.cpp | 4 ++-- src/osd/modules/debugger/win/consolewininfo.cpp | 4 ++-- src/tools/imgtool/modules/fat.cpp | 2 +- src/tools/imgtool/modules/os9.cpp | 6 +++--- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 028b8cb4ad4..b894060b182 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -349,7 +349,7 @@ void isa8_cga_device::device_start() set_isa_device(); m_vram.resize(m_vram_size); m_isa->install_device(0x3d0, 0x3df, read8_delegate( FUNC(isa8_cga_device::io_read), this ), write8_delegate( FUNC(isa8_cga_device::io_write), this ) ); - m_isa->install_bank(0xb8000, 0xb8000 + std::min(0x8000,m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); if(m_vram_size == 0x4000) m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); @@ -1821,7 +1821,7 @@ WRITE8_MEMBER( isa8_ec1841_0002_device::io_write ) read8_delegate( FUNC(isa8_ec1841_0002_device::char_ram_read), this), write8_delegate(FUNC(isa8_ec1841_0002_device::char_ram_write), this) ); } else { - m_isa->install_bank(0xb8000, 0xb8000 + std::min(0x8000,m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); if(m_vram_size == 0x4000) m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); } diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index 3867e9b5ca6..57d5a6f0edb 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -986,9 +986,9 @@ laserdisc_device::frame_data &laserdisc_device::current_frame() void laserdisc_device::read_track_data() { // compute the chdhunk number we are going to read - UINT32 chdtrack = m_curtrack - 1 - VIRTUAL_LEAD_IN_TRACKS; - chdtrack = std::max(chdtrack, UINT32(0)); - chdtrack = std::min(chdtrack, m_chdtracks - 1); + INT32 chdtrack = m_curtrack - 1 - VIRTUAL_LEAD_IN_TRACKS; + chdtrack = (std::max)(chdtrack, 0); + chdtrack = (std::min)(chdtrack, m_chdtracks - 1); UINT32 readhunk = chdtrack * 2 + m_fieldnum; // cheat and look up the metadata we are about to retrieve diff --git a/src/devices/video/bufsprite.h b/src/devices/video/bufsprite.h index 2e1f7c98bc5..70975527c32 100644 --- a/src/devices/video/bufsprite.h +++ b/src/devices/video/bufsprite.h @@ -67,7 +67,7 @@ public: { assert(m_spriteram != nullptr); if (m_spriteram != nullptr) - memcpy(&m_buffered[0], m_spriteram + srcoffset, std::min(srclength, UINT32(m_spriteram.bytes() / sizeof(_Type) - srcoffset)) * sizeof(_Type)); + memcpy(&m_buffered[0], m_spriteram + srcoffset, (std::min)(srclength, m_spriteram.bytes() / sizeof(_Type) - srcoffset) * sizeof(_Type)); return &m_buffered[0]; } diff --git a/src/emu/render.cpp b/src/emu/render.cpp index c328238f299..5b15bc4498e 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -1225,8 +1225,8 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height // first compute scale factors to fit the screen float xscale = (float)target_width / src_width; float yscale = (float)target_height / src_height; - float maxxscale = std::max(float(1.0f), float(m_int_overscan? render_round_nearest(xscale) : floor(xscale))); - float maxyscale = std::max(float(1.0f), float(m_int_overscan? render_round_nearest(yscale) : floor(yscale))); + float maxxscale = std::max(1.0f, float(m_int_overscan ? render_round_nearest(xscale) : floor(xscale))); + float maxyscale = std::max(1.0f, float(m_int_overscan ? render_round_nearest(yscale) : floor(yscale))); // now apply desired scale mode and aspect correction if (m_keepaspect && target_aspect > src_aspect) xscale *= src_aspect / target_aspect * (maxyscale / yscale); diff --git a/src/lib/formats/apridisk.cpp b/src/lib/formats/apridisk.cpp index 08fd6777bd9..a004d54ccd0 100644 --- a/src/lib/formats/apridisk.cpp +++ b/src/lib/formats/apridisk.cpp @@ -74,9 +74,9 @@ bool apridisk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima UINT8 sector = pick_integer_le(§or_header, 13, 1); UINT8 track = (UINT8) pick_integer_le(§or_header, 14, 2); - track_count = std::max(track_count, int(track)); - head_count = std::max(head_count, int(head)); - sector_count = std::max(sector_count, int(sector)); + track_count = std::max(track_count, int(unsigned(track))); + head_count = std::max(head_count, int(unsigned(head))); + sector_count = std::max(sector_count, int(unsigned(sector))); // build sector info sectors[track][head][sector - 1].head = head; diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp index d1b3495e3e8..38403e598d2 100644 --- a/src/lib/formats/cassimg.cpp +++ b/src/lib/formats/cassimg.cpp @@ -791,7 +791,7 @@ casserr_t cassette_read_modulated_data(cassette_image *cassette, int channel, do while(length > 0) { - this_length = std::min(size_t(length), buffer_length); + this_length = (std::min)(length, buffer_length); cassette_image_read(cassette, buffer, offset, this_length); err = cassette_put_modulated_data(cassette, channel, time_index, buffer, this_length, modulation, &delta); diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp index 6d50ce1b571..07da646dca3 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -242,7 +242,7 @@ inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 al delta = alignment - delta; while (delta != 0) { - UINT32 bytes_to_write = std::min(UINT32(sizeof(buffer)), delta); + UINT32 bytes_to_write = (std::min)(sizeof(buffer), delta); UINT32 count = m_file->write(buffer, bytes_to_write); if (count != bytes_to_write) throw CHDERR_WRITE_ERROR; @@ -1980,7 +1980,7 @@ chd_error chd_file::compress_v5_map() // track maximum compressed length else //if (curcomp >= COMPRESSION_TYPE_0 && curcomp <= COMPRESSION_TYPE_3) - max_complen = std::max(max_complen, UINT32(be_read(&m_rawmap[hunknum * 12 + 1], 3))); // TODO: check types + max_complen = std::max(max_complen, UINT32(be_read(&m_rawmap[hunknum * 12 + 1], 3))); // track repeats if (curcomp == lastcomp) @@ -2333,7 +2333,7 @@ chd_error chd_file::create_common() UINT64 offset = m_mapoffset; while (mapsize != 0) { - UINT32 bytes_to_write = std::min(mapsize, UINT32(sizeof(buffer))); + UINT32 bytes_to_write = (std::min)(mapsize, sizeof(buffer)); file_write(offset, buffer, bytes_to_write); offset += bytes_to_write; mapsize -= bytes_to_write; diff --git a/src/lib/util/flac.cpp b/src/lib/util/flac.cpp index a642bc86ba8..085eaacffef 100644 --- a/src/lib/util/flac.cpp +++ b/src/lib/util/flac.cpp @@ -127,7 +127,7 @@ bool flac_encoder::encode_interleaved(const INT16 *samples, UINT32 samples_per_c // process in batches of 2k samples FLAC__int32 converted_buffer[2048]; FLAC__int32 *dest = converted_buffer; - UINT32 cur_samples = std::min(UINT32(ARRAY_LENGTH(converted_buffer) / num_channels), samples_per_channel); + UINT32 cur_samples = (std::min)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel); // convert a buffers' worth for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++) @@ -160,7 +160,7 @@ bool flac_encoder::encode(INT16 *const *samples, UINT32 samples_per_channel, boo // process in batches of 2k samples FLAC__int32 converted_buffer[2048]; FLAC__int32 *dest = converted_buffer; - UINT32 cur_samples = std::min(UINT32(ARRAY_LENGTH(converted_buffer) / num_channels), samples_per_channel); + UINT32 cur_samples = (std::min)(ARRAY_LENGTH(converted_buffer) / num_channels, samples_per_channel); // convert a buffers' worth for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++, srcindex++) @@ -526,7 +526,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s UINT32 outputpos = 0; if (outputpos < *bytes && m_compressed_offset < m_compressed_length) { - UINT32 bytes_to_copy = std::min(UINT32(*bytes - outputpos), m_compressed_length - m_compressed_offset); + UINT32 bytes_to_copy = (std::min)(*bytes - outputpos, m_compressed_length - m_compressed_offset); memcpy(&buffer[outputpos], m_compressed_start + m_compressed_offset, bytes_to_copy); outputpos += bytes_to_copy; m_compressed_offset += bytes_to_copy; @@ -535,7 +535,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s // once we're out of that, copy from the secondary buffer if (outputpos < *bytes && m_compressed_offset < m_compressed_length + m_compressed2_length) { - UINT32 bytes_to_copy = std::min(UINT32(*bytes - outputpos), m_compressed2_length - (m_compressed_offset - m_compressed_length)); + UINT32 bytes_to_copy = (std::min)(*bytes - outputpos, m_compressed2_length - (m_compressed_offset - m_compressed_length)); memcpy(&buffer[outputpos], m_compressed2_start + m_compressed_offset - m_compressed_length, bytes_to_copy); outputpos += bytes_to_copy; m_compressed_offset += bytes_to_copy; diff --git a/src/lib/util/palette.cpp b/src/lib/util/palette.cpp index e918bb7adb2..196031d3694 100644 --- a/src/lib/util/palette.cpp +++ b/src/lib/util/palette.cpp @@ -514,8 +514,8 @@ void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_m { rgb_t rgb = m_entry_color[index]; UINT32 y = 299 * rgb.r() + 587 * rgb.g() + 114 * rgb.b(); - ymin = std::min(ymin, y); - ymax = std::max(ymax, y); + ymin = (std::min)(ymin, y); + ymax = (std::max)(ymax, y); } // determine target minimum/maximum diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index 9c6206c39f7..2f96452e14c 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -253,8 +253,8 @@ READ8_MEMBER( prestige_state::mouse_r ) break; } - data = std::min(data, INT16(+127)); - data = std::min(data, INT16(-127)); + data = (std::min)(data, INT16(+127)); + data = (std::max)(data, INT16(-127)); return 0x80 + data; } diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index 6c4e5b0a2e1..de1c65f90cb 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -65,8 +65,8 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : set_maxwidth(bounds.right - bounds.left); // position the window at the bottom-right - int const bestwidth = std::min(int(maxwidth()), int(work_bounds.right - work_bounds.left)); - int const bestheight = std::min(500, int(work_bounds.bottom - work_bounds.top)); + int const bestwidth = (std::min)(maxwidth(), work_bounds.right - work_bounds.left); + int const bestheight = (std::min)(500, work_bounds.bottom - work_bounds.top); SetWindowPos(window(), HWND_TOP, work_bounds.right - bestwidth, work_bounds.bottom - bestheight, bestwidth, bestheight, diff --git a/src/tools/imgtool/modules/fat.cpp b/src/tools/imgtool/modules/fat.cpp index 4de934819b9..ad75a206193 100644 --- a/src/tools/imgtool/modules/fat.cpp +++ b/src/tools/imgtool/modules/fat.cpp @@ -1957,7 +1957,7 @@ static imgtoolerr_t fat_partition_writefile(imgtool_partition *partition, const while(bytes_left > 0) { - len = std::min(bytes_left, UINT32(sizeof(buffer))); + len = (std::min)(bytes_left, sizeof(buffer)); stream_read(sourcef, buffer, len); err = fat_write_file(partition, &file, buffer, len, NULL); diff --git a/src/tools/imgtool/modules/os9.cpp b/src/tools/imgtool/modules/os9.cpp index 15e737a1658..0e165f6d881 100644 --- a/src/tools/imgtool/modules/os9.cpp +++ b/src/tools/imgtool/modules/os9.cpp @@ -275,7 +275,7 @@ static imgtoolerr_t os9_decode_file_header(imgtool_image *image, /* read all sector map entries */ max_entries = (disk_info->sector_size - 16) / 5; - max_entries = std::min(max_entries, int(ARRAY_LENGTH(info->sector_map) - 1)); + max_entries = (std::min)(max_entries, ARRAY_LENGTH(info->sector_map) - 1); for (i = 0; i < max_entries; i++) { lsn = pick_integer_be(header, 16 + (i * 5) + 0, 3); @@ -461,7 +461,7 @@ static imgtoolerr_t os9_set_file_size(imgtool_image *image, /* do we have to write the sector map? */ if (sector_map_length >= 0) { - for (i = 0; i < std::min(sector_map_length + 1, int(ARRAY_LENGTH(file_info->sector_map))); i++) + for (i = 0; i < (std::min)(sector_map_length + 1, ARRAY_LENGTH(file_info->sector_map)); i++) { place_integer_be(header, 16 + (i * 5) + 0, 3, file_info->sector_map[i].lsn); place_integer_be(header, 16 + (i * 5) + 3, 2, file_info->sector_map[i].count); @@ -1055,7 +1055,7 @@ static imgtoolerr_t os9_diskimage_writefile(imgtool_partition *partition, const while(sz > 0) { - write_size = std::min(size_t(sz), size_t(disk_info->sector_size)); + write_size = (std::min)(sz, disk_info->sector_size); stream_read(sourcef, &buf[0], write_size);