diff --git a/src/SFML/Audio/SoundFileReaderFlac.cpp b/src/SFML/Audio/SoundFileReaderFlac.cpp index a2091ac12..779672d2f 100644 --- a/src/SFML/Audio/SoundFileReaderFlac.cpp +++ b/src/SFML/Audio/SoundFileReaderFlac.cpp @@ -122,16 +122,16 @@ namespace switch (frame->header.bits_per_sample) { case 8: - sample = buffer[j][i] << 8; + sample = static_cast(buffer[j][i] << 8); break; case 16: - sample = buffer[j][i]; + sample = static_cast(buffer[j][i]); break; case 24: - sample = buffer[j][i] >> 8; + sample = static_cast(buffer[j][i] >> 8); break; case 32: - sample = buffer[j][i] >> 16; + sample = static_cast(buffer[j][i] >> 16); break; default: assert(false); diff --git a/src/SFML/Audio/SoundFileReaderWav.cpp b/src/SFML/Audio/SoundFileReaderWav.cpp index 84075166d..c206c16d3 100644 --- a/src/SFML/Audio/SoundFileReaderWav.cpp +++ b/src/SFML/Audio/SoundFileReaderWav.cpp @@ -187,7 +187,7 @@ Uint64 SoundFileReaderWav::read(Int16* samples, Uint64 maxCount) { Uint32 sample = 0; if (decode24bit(*m_stream, sample)) - *samples++ = sample >> 8; + *samples++ = static_cast(sample >> 8); else return count; break; @@ -197,7 +197,7 @@ Uint64 SoundFileReaderWav::read(Int16* samples, Uint64 maxCount) { Uint32 sample = 0; if (decode(*m_stream, sample)) - *samples++ = sample >> 16; + *samples++ = static_cast(sample >> 16); else return count; break; diff --git a/src/SFML/Audio/SoundFileWriterFlac.cpp b/src/SFML/Audio/SoundFileWriterFlac.cpp index 3c8ca830e..e857f47d0 100644 --- a/src/SFML/Audio/SoundFileWriterFlac.cpp +++ b/src/SFML/Audio/SoundFileWriterFlac.cpp @@ -32,6 +32,14 @@ #include +namespace +{ + unsigned char toLower(unsigned char character) + { + return static_cast(std::tolower(character)); + } +} + namespace sf { namespace priv @@ -40,7 +48,7 @@ namespace priv bool SoundFileWriterFlac::check(const std::string& filename) { std::string extension = filename.substr(filename.find_last_of('.') + 1); - std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); + std::transform(extension.begin(), extension.end(), extension.begin(), toLower); return extension == "flac"; } diff --git a/src/SFML/Audio/SoundFileWriterOgg.cpp b/src/SFML/Audio/SoundFileWriterOgg.cpp index 7fec8c007..4f2daba61 100644 --- a/src/SFML/Audio/SoundFileWriterOgg.cpp +++ b/src/SFML/Audio/SoundFileWriterOgg.cpp @@ -33,6 +33,14 @@ #include +namespace +{ + unsigned char toLower(unsigned char character) + { + return static_cast(std::tolower(character)); + } +} + namespace sf { namespace priv @@ -41,7 +49,7 @@ namespace priv bool SoundFileWriterOgg::check(const std::string& filename) { std::string extension = filename.substr(filename.find_last_of('.') + 1); - std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); + std::transform(extension.begin(), extension.end(), extension.begin(), toLower); return extension == "ogg"; } @@ -149,7 +157,7 @@ void SoundFileWriterOgg::write(const Int16* samples, Uint64 count) // Tell the library how many samples we've written vorbis_analysis_wrote(&m_state, std::min(frameCount, bufferSize)); - + frameCount -= bufferSize; // Flush any produced block diff --git a/src/SFML/Audio/SoundFileWriterWav.cpp b/src/SFML/Audio/SoundFileWriterWav.cpp index 781c76af2..75f04dcb8 100644 --- a/src/SFML/Audio/SoundFileWriterWav.cpp +++ b/src/SFML/Audio/SoundFileWriterWav.cpp @@ -68,6 +68,11 @@ namespace }; stream.write(reinterpret_cast(bytes), sizeof(bytes)); } + + unsigned char toLower(unsigned char character) + { + return static_cast(std::tolower(character)); + } } namespace sf @@ -78,7 +83,7 @@ namespace priv bool SoundFileWriterWav::check(const std::string& filename) { std::string extension = filename.substr(filename.find_last_of('.') + 1); - std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); + std::transform(extension.begin(), extension.end(), extension.begin(), toLower); return extension == "wav"; } @@ -160,7 +165,7 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann encode(m_file, static_cast(sampleRate)); Uint32 byteRate = sampleRate * channelCount * 2; encode(m_file, byteRate); - Uint16 blockAlign = channelCount * 2; + Uint16 blockAlign = static_cast(channelCount * 2); encode(m_file, blockAlign); Uint16 bitsPerSample = 16; encode(m_file, bitsPerSample);