From 0ceae26bb4c631ff2538f3fcca7f15ccf0454843 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 1 Aug 2016 01:37:39 +1000 Subject: [PATCH] patch up on OSX --- src/osd/modules/debugger/osx/debugview.mm | 4 ++-- src/osd/modules/debugger/osx/debugwindowhandler.mm | 2 +- src/osd/modules/debugger/osx/errorlogviewer.mm | 2 +- src/osd/modules/sound/coreaudio_sound.cpp | 4 ++-- src/tools/imgtool/stream.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm index f4a7c8cd2cb..f9bf650a7ac 100644 --- a/src/osd/modules/debugger/osx/debugview.mm +++ b/src/osd/modules/debugger/osx/debugview.mm @@ -583,7 +583,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) if (wholeLineScroll) { CGFloat const clamp = [self bounds].size.height - fontHeight - proposedVisibleRect.size.height; - proposedVisibleRect.origin.y = std::min((int)proposedVisibleRect.origin.y, std::max((int)clamp, 0)); + proposedVisibleRect.origin.y = std::min(proposedVisibleRect.origin.y, std::max(clamp, CGFloat(0))); proposedVisibleRect.origin.y -= fmod(proposedVisibleRect.origin.y, fontHeight); } return proposedVisibleRect; @@ -668,7 +668,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) inTextContainer:textContainer]; if (start == 0) box.origin.x = 0; - box.size.width = std::max((int)([self bounds].size.width - box.origin.x), 0); + box.size.width = std::max([self bounds].size.width - box.origin.x, CGFloat(0)); [[self backgroundForAttribute:attr] set]; [NSBezierPath fillRect:NSMakeRect(box.origin.x, row * fontHeight, diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.mm b/src/osd/modules/debugger/osx/debugwindowhandler.mm index 18c17a3aef0..853fe8fd4b6 100644 --- a/src/osd/modules/debugger/osx/debugwindowhandler.mm +++ b/src/osd/modules/debugger/osx/debugwindowhandler.mm @@ -350,7 +350,7 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD windowFrame.size.height = std::min(windowFrame.size.height, available.size.height); // arbitrary additional height limit - windowFrame.size.height = std::min((int)windowFrame.size.height, 320); + windowFrame.size.height = std::min(windowFrame.size.height, CGFloat(320)); // place it in the bottom right corner and apply windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width; diff --git a/src/osd/modules/debugger/osx/errorlogviewer.mm b/src/osd/modules/debugger/osx/errorlogviewer.mm index cf8d7936c6b..56108223cb7 100644 --- a/src/osd/modules/debugger/osx/errorlogviewer.mm +++ b/src/osd/modules/debugger/osx/errorlogviewer.mm @@ -44,7 +44,7 @@ borderType:[logScroll borderType]]; // this thing starts with no content, so its prefered height may be very small - desired.height = std::max((int)desired.height, 240); + desired.height = std::max(desired.height, CGFloat(240)); [self cascadeWindowWithDesiredSize:desired forView:logScroll]; } diff --git a/src/osd/modules/sound/coreaudio_sound.cpp b/src/osd/modules/sound/coreaudio_sound.cpp index e445dc27059..483af364aa4 100644 --- a/src/osd/modules/sound/coreaudio_sound.cpp +++ b/src/osd/modules/sound/coreaudio_sound.cpp @@ -81,7 +81,7 @@ private: EFFECT_COUNT_MAX = 10 }; - UINT32 clamped_latency() const { return std::max(std::min(UINT32(m_audio_latency), UINT32(LATENCY_MAX)), UINT32(LATENCY_MIN)); } + UINT32 clamped_latency() const { return unsigned(std::max(std::min(m_audio_latency, int(LATENCY_MAX)), int(LATENCY_MIN))); } UINT32 buffer_avail() const { return ((m_writepos >= m_playpos) ? m_buffer_size : 0) + m_playpos - m_writepos; } UINT32 buffer_used() const { return ((m_playpos > m_writepos) ? m_buffer_size : 0) + m_writepos - m_playpos; } @@ -228,7 +228,7 @@ int sound_coreaudio::init(const osd_options &options) // Allocate buffer m_headroom = m_sample_bytes * (clamped_latency() * sample_rate() / 40); - m_buffer_size = m_sample_bytes * std::max(UINT32(sample_rate() * (clamped_latency() + 3) / 40), 256U); + m_buffer_size = m_sample_bytes * std::max(sample_rate() * (clamped_latency() + 3) / 40, 256U); m_buffer = global_alloc_array_clear(m_buffer_size); if (!m_buffer) { diff --git a/src/tools/imgtool/stream.cpp b/src/tools/imgtool/stream.cpp index 97dfba16800..8aea81031e5 100644 --- a/src/tools/imgtool/stream.cpp +++ b/src/tools/imgtool/stream.cpp @@ -444,12 +444,12 @@ UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz) char buf[1024]; outsz = 0; - memset(buf, b, std::min(sz, UINT64(sizeof(buf)))); + memset(buf, b, (std::min)(sz, sizeof(buf))); - while(sz) + while (sz) { - outsz += stream_write(f, buf, std::min(sz, UINT64(sizeof(buf)))); - sz -= std::min(sz, UINT64(sizeof(buf))); + outsz += stream_write(f, buf, (std::min)(sz, sizeof(buf))); + sz -= (std::min)(sz, sizeof(buf)); } return outsz; }