Fixed various type conversion/comparison warnings.

This commit is contained in:
Lukas Dürrenberger 2017-12-07 14:46:19 +01:00
parent 714ed41b6f
commit 6f3282623f
8 changed files with 19 additions and 19 deletions

View File

@ -188,7 +188,7 @@ bool Music::onGetData(SoundStream::Chunk& data)
// This will trip an "onLoop()" call from the underlying SoundStream,
// and we can then take action.
if (getLoop() && (m_loopSpan.length != 0) && (currentOffset <= loopEnd) && (currentOffset + toFill > loopEnd))
toFill = loopEnd - currentOffset;
toFill = static_cast<std::size_t>(loopEnd - currentOffset);
// Fill the chunk parameters
data.samples = &m_samples[0];

View File

@ -284,14 +284,14 @@ Uint64 SoundFileReaderFlac::read(Int16* samples, Uint64 maxCount)
assert(m_decoder);
// If there are leftovers from previous call, use it first
Uint64 left = m_clientData.leftovers.size();
std::size_t left = m_clientData.leftovers.size();
if (left > 0)
{
if (left > maxCount)
{
// There are more leftovers than needed
std::copy(m_clientData.leftovers.begin(), m_clientData.leftovers.begin() + maxCount, samples);
std::vector<Int16> leftovers(m_clientData.leftovers.begin() + maxCount, m_clientData.leftovers.end());
std::copy(m_clientData.leftovers.begin(), m_clientData.leftovers.begin() + static_cast<std::size_t>(maxCount), samples);
std::vector<Int16> leftovers(m_clientData.leftovers.begin() + static_cast<std::size_t>(maxCount), m_clientData.leftovers.end());
m_clientData.leftovers.swap(leftovers);
return maxCount;
}

View File

@ -155,7 +155,7 @@ Uint64 SoundFileReaderWav::read(Int16* samples, Uint64 maxCount)
assert(m_stream);
Uint64 count = 0;
while ((count < maxCount) && (m_stream->tell() < m_dataEnd))
while ((count < maxCount) && (static_cast<Uint64>(m_stream->tell()) < m_dataEnd))
{
switch (m_bytesPerSample)
{

View File

@ -631,9 +631,9 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
if (bitmap.pixel_mode == FT_PIXEL_MODE_MONO)
{
// Pixels are 1 bit monochrome values
for (int y = padding; y < height - padding; ++y)
for (unsigned int y = padding; y < height - padding; ++y)
{
for (int x = padding; x < width - padding; ++x)
for (unsigned int x = padding; x < width - padding; ++x)
{
// The color channels remain white, just fill the alpha channel
std::size_t index = x + y * width;
@ -645,9 +645,9 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
else
{
// Pixels are 8 bits gray levels
for (int y = padding; y < height - padding; ++y)
for (unsigned int y = padding; y < height - padding; ++y)
{
for (int x = padding; x < width - padding; ++x)
for (unsigned int x = padding; x < width - padding; ++x)
{
// The color channels remain white, just fill the alpha channel
std::size_t index = x + y * width;

View File

@ -298,7 +298,7 @@ void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount,
GLenum mode = modes[type];
// Draw the primitives
glCheck(glDrawArrays(mode, 0, vertexCount));
glCheck(glDrawArrays(mode, 0, static_cast<GLsizei>(vertexCount)));
// Unbind the shader, if any
if (states.shader)

View File

@ -593,7 +593,7 @@ void Shader::setUniformArray(const std::string& name, const float* scalarArray,
{
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniform1fv(binder.location, length, scalarArray));
glCheck(GLEXT_glUniform1fv(binder.location, static_cast<GLsizei>(length), scalarArray));
}
@ -604,7 +604,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec2* vectorAr
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniform2fv(binder.location, length, &contiguous[0]));
glCheck(GLEXT_glUniform2fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
}
@ -615,7 +615,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec3* vectorAr
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniform3fv(binder.location, length, &contiguous[0]));
glCheck(GLEXT_glUniform3fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
}
@ -626,7 +626,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec4* vectorAr
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniform4fv(binder.location, length, &contiguous[0]));
glCheck(GLEXT_glUniform4fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
}
@ -641,7 +641,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat3* matrixAr
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniformMatrix3fv(binder.location, length, GL_FALSE, &contiguous[0]));
glCheck(GLEXT_glUniformMatrix3fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, &contiguous[0]));
}
@ -656,7 +656,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat4* matrixAr
UniformBinder binder(*this, name);
if (binder.location != -1)
glCheck(GLEXT_glUniformMatrix4fv(binder.location, length, GL_FALSE, &contiguous[0]));
glCheck(GLEXT_glUniformMatrix4fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, &contiguous[0]));
}

View File

@ -463,7 +463,7 @@ Ftp::Response Ftp::getResponse()
}
// Save the remaining data for the next time getResponse() is called
m_receiveBuffer.assign(buffer + in.tellg(), length - in.tellg());
m_receiveBuffer.assign(buffer + static_cast<std::streamoff>(in.tellg()), length - static_cast<std::size_t>(in.tellg()));
// Return the response code and message
return Response(static_cast<Response::Status>(code), message);
@ -631,7 +631,7 @@ void Ftp::DataChannel::send(std::istream& stream)
break;
}
count = stream.gcount();
count = static_cast<std::size_t>(stream.gcount());
if (count > 0)
{

View File

@ -95,7 +95,7 @@ Int64 FileInputStream::seek(Int64 position)
#else
if (m_file)
{
if (std::fseek(m_file, static_cast<std::size_t>(position), SEEK_SET))
if (std::fseek(m_file, static_cast<long>(position), SEEK_SET))
return -1;
return tell();