From 340faef1ecd9a5cf99ad2ea07a1b0c7e34007941 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 13 Feb 2016 13:37:28 +0100 Subject: [PATCH] - fixed a few 64-bit warnings. --- game-music-emu/gme/Fir_Resampler.cpp | 2 +- src/sound/mpg123_decoder.cpp | 4 ++-- src/sound/oalsound.cpp | 4 ++-- src/sound/sndfile_decoder.cpp | 2 +- src/thingdef/thingdef_data.cpp | 4 ++-- src/win32/st_start.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/game-music-emu/gme/Fir_Resampler.cpp b/game-music-emu/gme/Fir_Resampler.cpp index fa426c78c..7f0deeca3 100644 --- a/game-music-emu/gme/Fir_Resampler.cpp +++ b/game-music-emu/gme/Fir_Resampler.cpp @@ -156,7 +156,7 @@ int Fir_Resampler_::input_needed( blargg_long output_count ) const output_count -= 2; } - long input_extra = input_count - (write_pos - &buf [(width_ - 1) * stereo]); + long input_extra = (long)(input_count - (write_pos - &buf [(width_ - 1) * stereo])); if ( input_extra < 0 ) input_extra = 0; return input_extra; diff --git a/src/sound/mpg123_decoder.cpp b/src/sound/mpg123_decoder.cpp index 5b33100a5..0f0afa299 100644 --- a/src/sound/mpg123_decoder.cpp +++ b/src/sound/mpg123_decoder.cpp @@ -38,7 +38,7 @@ off_t MPG123Decoder::file_lseek(void *handle, off_t offset, int whence) ssize_t MPG123Decoder::file_read(void *handle, void *buffer, size_t bytes) { FileReader *reader = reinterpret_cast(handle)->Reader; - return reader->Read(buffer, bytes); + return (ssize_t)reader->Read(buffer, (long)bytes); } @@ -183,7 +183,7 @@ bool MPG123Decoder::seek(size_t ms_offset) if(mpg123_getformat(MPG123, &srate, &channels, &enc) == MPG123_OK) { size_t smp_offset = (size_t)((double)ms_offset / 1000. * srate); - if(mpg123_seek(MPG123, smp_offset, SEEK_SET) >= 0) + if(mpg123_seek(MPG123, (off_t)smp_offset, SEEK_SET) >= 0) { Done = false; return true; diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 1eec34c1b..768e7b7ba 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -617,7 +617,7 @@ public: SampleRate = srate; Looping = loop; - Data.Resize((size_t)(0.2 * SampleRate) * FrameSize); + Data.Resize((SampleRate / 5) * FrameSize); return true; } @@ -782,7 +782,7 @@ OpenALSoundRenderer::OpenALSoundRenderer() alcGetIntegerv(Device, ALC_STEREO_SOURCES, 1, &numStereo); Sources.Resize(MIN(MAX(*snd_channels, 2), numMono+numStereo)); - for(size_t i = 0;i < Sources.Size();i++) + for(unsigned i = 0;i < Sources.Size();i++) { alGenSources(1, &Sources[i]); if(getALError() != AL_NO_ERROR) diff --git a/src/sound/sndfile_decoder.cpp b/src/sound/sndfile_decoder.cpp index 52376a6c7..382b22ab6 100644 --- a/src/sound/sndfile_decoder.cpp +++ b/src/sound/sndfile_decoder.cpp @@ -126,7 +126,7 @@ TArray SndFileDecoder::readAll() output.Resize((unsigned)(SndInfo.frames * framesize)); size_t got = read(&output[0], output.Size()); - output.Resize(got); + output.Resize((unsigned)got); return output; } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 82fe3a739..c972493d0 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -54,8 +54,8 @@ static TArray AFTable; //========================================================================== // [RH] Keep GCC quiet by not using offsetof on Actor types. -#define DEFINE_FLAG(prefix, name, type, variable) { prefix##_##name, #name, (int)(size_t)&((type*)1)->variable - 1, sizeof(((type *)0)->variable) } -#define DEFINE_FLAG2(symbol, name, type, variable) { symbol, #name, (int)(size_t)&((type*)1)->variable - 1, sizeof(((type *)0)->variable) } +#define DEFINE_FLAG(prefix, name, type, variable) { (unsigned int)prefix##_##name, #name, (int)(size_t)&((type*)1)->variable - 1, sizeof(((type *)0)->variable) } +#define DEFINE_FLAG2(symbol, name, type, variable) { (unsigned int)symbol, #name, (int)(size_t)&((type*)1)->variable - 1, sizeof(((type *)0)->variable) } #define DEFINE_DEPRECATED_FLAG(name) { DEPF_##name, #name, -1, 0 } #define DEFINE_DUMMY_FLAG(name) { DEPF_UNUSED, #name, -1, 0 } diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 69e00f586..b172b282f 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -1584,7 +1584,7 @@ void ST_Util_DrawChar (BITMAPINFO *screen, const BYTE *font, int x, int y, BYTE const BYTE fg = attrib & 0x0F; const BYTE fg_left = fg << 4; const BYTE bg = bg_left >> 4; - const BYTE color_array[4] = { bg_left | bg, attrib & 0x7F, fg_left | bg, fg_left | fg }; + const BYTE color_array[4] = { (BYTE)(bg_left | bg), (BYTE)(attrib & 0x7F), (BYTE)(fg_left | bg), (BYTE)(fg_left | fg) }; const BYTE *src = font + 1 + charnum * font[0]; int pitch = screen->bmiHeader.biWidth >> 1; BYTE *dest = ST_Util_BitsForBitmap(screen) + x*4 + y * font[0] * pitch;