From b9a99a897d6e669c43b9faa39300db5a5efac118 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Dec 2018 20:35:54 -0800 Subject: GLK: Further fixes for Buildbot warnings --- engines/glk/conf.cpp | 4 ++-- engines/glk/screen.cpp | 6 +++--- engines/glk/sound.cpp | 9 ++++++--- engines/glk/streams.cpp | 6 ++++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp index efd16874b2..0d2c33fc04 100644 --- a/engines/glk/conf.cpp +++ b/engines/glk/conf.cpp @@ -94,9 +94,9 @@ Conf::Conf(InterpreterType interpType) { get("cols", _cols, 60); if (ConfMan.hasKey("leading")) - _leading = atof(ConfMan.get("leading").c_str()) + 0.5; + _leading = static_cast(atof(ConfMan.get("leading").c_str()) + 0.5); if (ConfMan.hasKey("baseline")) - _baseLine = atof(ConfMan.get("baseline").c_str()) + 0.5; + _baseLine = static_cast(atof(ConfMan.get("baseline").c_str()) + 0.5); if (ConfMan.hasKey("minrows")) _rows = MAX(_rows, strToInt(ConfMan.get("minrows").c_str())); diff --git a/engines/glk/screen.cpp b/engines/glk/screen.cpp index 6768360df1..2276998b8f 100644 --- a/engines/glk/screen.cpp +++ b/engines/glk/screen.cpp @@ -48,8 +48,8 @@ void Screen::initialize() { double baseLine = (double)r1.bottom; double leading = (double)r2.bottom + 2; - g_conf->_leading = MAX((double)g_conf->_leading, leading); - g_conf->_baseLine = MAX((double)g_conf->_baseLine, baseLine); + g_conf->_leading = static_cast(MAX((double)g_conf->_leading, leading)); + g_conf->_baseLine = static_cast(MAX((double)g_conf->_baseLine, baseLine)); g_conf->_cellW = _fonts[0]->getStringWidth("0"); g_conf->_cellH = g_conf->_leading; } @@ -157,7 +157,7 @@ const Graphics::Font *Screen::loadFont(FACES face, Common::Archive *archive, dou if (!f.open(FILENAMES[face], *archive)) error("Could not load font"); - return Graphics::loadTTFFont(f, size, Graphics::kTTFSizeModeCharacter); + return Graphics::loadTTFFont(f, (int)size, Graphics::kTTFSizeModeCharacter); } FACES Screen::getFontId(const Common::String &name) { diff --git a/engines/glk/sound.cpp b/engines/glk/sound.cpp index 0e3fbf48ee..b2b07782db 100644 --- a/engines/glk/sound.cpp +++ b/engines/glk/sound.cpp @@ -26,8 +26,8 @@ #include "common/file.h" #include "audio/audiostream.h" #include "audio/decoders/aiff.h" -#include "audio/decoders/raw.h" #include "audio/decoders/mp3.h" +#include "audio/decoders/raw.h" #include "audio/decoders/wave.h" namespace Glk { @@ -91,9 +91,11 @@ glui32 SoundChannel::play(glui32 soundNum, glui32 repeats, glui32 notify) { Audio::AudioStream *stream; Common::File f; Common::String nameSnd = Common::String::format("sound%u.snd", soundNum); - Common::String nameMp3 = Common::String::format("sound%u.mp3", soundNum); Common::String nameWav = Common::String::format("sound%u.wav", soundNum); Common::String nameAiff = Common::String::format("sound%u.aiff", soundNum); +#ifdef USE_MAD + Common::String nameMp3 = Common::String::format("sound%u.mp3", soundNum); +#endif if (f.exists(nameSnd) && f.open(nameSnd)) { if (f.readUint16BE() != (f.size() - 2)) @@ -107,10 +109,11 @@ glui32 SoundChannel::play(glui32 soundNum, glui32 repeats, glui32 notify) { Common::SeekableReadStream *s = f.readStream(size); stream = Audio::makeRawStream(s, freq, Audio::FLAG_UNSIGNED); +#ifdef USE_MAD } else if (f.exists(nameMp3) && f.open(nameMp3)) { Common::SeekableReadStream *s = f.readStream(f.size()); stream = Audio::makeMP3Stream(s, DisposeAfterUse::YES); - +#endif } else if (f.exists(nameWav) && f.open(nameWav)) { Common::SeekableReadStream *s = f.readStream(f.size()); stream = Audio::makeWAVStream(s, DisposeAfterUse::YES); diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp index d6c71cab3a..42aa79060e 100644 --- a/engines/glk/streams.cpp +++ b/engines/glk/streams.cpp @@ -469,8 +469,10 @@ void MemoryStream::setPosition(glsi32 pos, glui32 seekMode) { pos = ((unsigned char *)_bufPtr - (unsigned char *)_buf) + pos; else if (seekMode == seekmode_End) pos = ((unsigned char *)_bufEof - (unsigned char *)_buf) + pos; - else - /* pos = pos */; + else { + // pos = pos + } + if (pos < 0) pos = 0; if (pos > ((unsigned char *)_bufEof - (unsigned char *)_buf)) -- cgit v1.2.3