Fixed compiler warnings

This commit is contained in:
Daniel Wolf 2016-03-15 20:12:11 +01:00
parent a8900f80ec
commit 425f47491c
3 changed files with 8 additions and 3 deletions

View File

@ -36,8 +36,13 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(enableWarningsFlags "/W4") set(enableWarningsFlags "/W4")
set(disableWarningsFlags "/W0") set(disableWarningsFlags "/W0")
# Boost.Log causes this warning # Disable warning C4714: function '...' marked as __forceinline not inlined
# This is caused by Boost.Log
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4714") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4714")
# Disable warning C4456: declaration of '...' hides previous local declaration
# I'm doing that on purpose.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4458")
endif() endif()
# Enable project folders # Enable project folders

View File

@ -153,7 +153,7 @@ int WaveFileReader::getSampleIndex() {
void WaveFileReader::seek(int sampleIndex) { void WaveFileReader::seek(int sampleIndex) {
if (sampleIndex < 0 || sampleIndex >= sampleCount) throw std::invalid_argument("sampleIndex out of range."); if (sampleIndex < 0 || sampleIndex >= sampleCount) throw std::invalid_argument("sampleIndex out of range.");
file.seekg(dataOffset + sampleIndex * channelCount * bytesPerSample); file.seekg(dataOffset + static_cast<std::streamoff>(sampleIndex * channelCount * bytesPerSample));
this->sampleIndex = sampleIndex; this->sampleIndex = sampleIndex;
} }

View File

@ -34,6 +34,6 @@ private:
int frameCount; int frameCount;
int channelCount; int channelCount;
int sampleCount; int sampleCount;
size_t dataOffset; std::streampos dataOffset;
int sampleIndex; int sampleIndex;
}; };