Browse Source

Fix all visible compilation warnings in Visual Studio.

legacy
Sam Hocevar 6 years ago
parent
commit
4a4fb5f91c
17 changed files with 34 additions and 85 deletions
  1. +2
    -2
      src/Makefile.am
  2. +0
    -22
      src/base/enum.cpp
  3. +2
    -2
      src/base/log.cpp
  4. +1
    -1
      src/gpu/renderer.cpp
  5. +1
    -1
      src/gpu/shader.cpp
  6. +2
    -2
      src/image/codec/oric-image.cpp
  7. +2
    -2
      src/image/dither/dbs.cpp
  8. +2
    -2
      src/image/dither/ordered.cpp
  9. +2
    -2
      src/image/kernel.cpp
  10. +4
    -4
      src/image/pixel.cpp
  11. +6
    -6
      src/input/controller.cpp
  12. +0
    -2
      src/lol-core.vcxproj
  13. +0
    -6
      src/lol-core.vcxproj.filter
  14. +3
    -3
      src/lol/math/real.h
  15. +0
    -21
      src/math/constants.cpp
  16. +3
    -3
      src/mesh/mesh.cpp
  17. +4
    -4
      src/sys/file.cpp

+ 2
- 2
src/Makefile.am View File

@@ -88,10 +88,10 @@ liblol_core_sources = \
easymesh/shinydebuglighting.lolfx easymesh/shinydebugnormal.lolfx \
easymesh/shinydebugUV.lolfx easymesh/shiny_SK.lolfx \
\
base/assert.cpp base/log.cpp base/string.cpp base/enum.cpp \
base/assert.cpp base/log.cpp base/string.cpp \
\
math/vector.cpp math/matrix.cpp math/transform.cpp math/half.cpp \
math/constants.cpp math/geometry.cpp math/real.cpp \
math/geometry.cpp math/real.cpp \
\
gpu/shader.cpp gpu/indexbuffer.cpp gpu/vertexbuffer.cpp \
gpu/framebuffer.cpp gpu/texture.cpp gpu/renderer.cpp \


+ 0
- 22
src/base/enum.cpp View File

@@ -1,22 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

namespace lol
{

/*
* Safe enum helpers
*/


} /* namespace lol */


+ 2
- 2
src/base/log.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -111,7 +111,7 @@ void msg::helper(MessageType type, char const *fmt, va_list ap)

array<WCHAR> widechar;
widechar.resize(buf.length() + 1);
MultiByteToWideChar(CP_UTF8, 0, buf.c_str(), buf.length() + 1, widechar.data(), widechar.count());
MultiByteToWideChar(CP_UTF8, 0, buf.c_str(), (int)buf.length() + 1, widechar.data(), widechar.count());
OutputDebugStringW(widechar.data());
# else
fprintf(stderr, "%s: ", prefix[(int)type]);


+ 1
- 1
src/gpu/renderer.cpp View File

@@ -545,7 +545,7 @@ void Renderer::SetScissorRect(vec4 rect)
m_data->m_scissor_rect = rect;
if (m_data->m_scissor_mode == ScissorMode::Enabled)
{
glScissor((int)rect.x, (int)Video::GetSize().y - rect.w, (int)(rect.z - rect.x), (int)(rect.w - rect.y));
glScissor((int)rect.x, (int)(Video::GetSize().y - rect.w), (int)(rect.z - rect.x), (int)(rect.w - rect.y));
//glScissor((int)rect.x, (int)rect.y, (int)(rect.z - rect.x), (int)(rect.w - rect.y));
}
}


+ 1
- 1
src/gpu/shader.cpp View File

@@ -369,7 +369,7 @@ Shader::Shader(std::string const &name,

int Shader::GetAttribCount() const
{
return data->attrib_locations.size();
return (int)data->attrib_locations.size();
}

ShaderAttrib Shader::GetAttribLocation(VertexUsage usage, int index) const


+ 2
- 2
src/image/codec/oric-image.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -66,7 +66,7 @@ ResourceCodecData* OricImageCodec::Load(std::string const &path)
if (screen.length() == 0)
return nullptr;

auto data = new ResourceImageData(new image(ivec2(WIDTH, screen.length() * 6 / WIDTH)));
auto data = new ResourceImageData(new image(ivec2(WIDTH, (int)screen.length() * 6 / WIDTH)));
auto img = data->m_image;

u8vec4 *pixels = img->lock<PixelFormat::RGBA_8>();


+ 2
- 2
src/image/dither/dbs.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2004—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2004—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -37,7 +37,7 @@ image image::dither_dbs() const
for (int j = 0; j < NN; j++)
for (int i = 0; i < NN; i++)
{
vec2 v = vec2(i - N, j - N);
vec2 v = vec2((float)(i - N), (float)(j - N));
ker[i][j] = exp(-sqlength(v / 1.6f) / 2.f)
+ exp(-sqlength(v / 0.6f) / 2.f);
t += ker[i][j];


+ 2
- 2
src/image/dither/ordered.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2004—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2004—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -33,7 +33,7 @@ image image::dither_halftone(float radius, float angle) const
* like crap. So we create a kernel PRECISION times larger, and ask
* the ditherer to scale it by 1/PRECISION. */
float const PRECISION = 4.f;
int k = (radius * PRECISION * lol::sqrt(2.f) + 0.5f);
int k = (int)std::round(radius * PRECISION * lol::sqrt(2.f));
array2d<float> ker = image::kernel::halftone(ivec2(k, k));

return dither_helper(*this, ker, 1.f / PRECISION, angle + F_PI / 4.f);


+ 2
- 2
src/image/kernel.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2004—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2004—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -110,7 +110,7 @@ array2d<float> image::kernel::blue_noise(ivec2 size, ivec2 gsize)

auto best = [&] (float val, float mul) -> ivec2
{
float maxval = -size.x * size.y;
float maxval = -(float)(size.x * size.y);
ivec2 coord(0, 0);
for (int y = 0; y < size.y; ++y)
for (int x = 0; x < size.x; ++x)


+ 4
- 4
src/image/pixel.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2004—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2004—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -223,7 +223,7 @@ void image::set_format(PixelFormat fmt)
/* Lossless conversions: u8 to float */
else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::Y_F32)
{
float *src = (float *)m_data->m_pixels[(int)old_fmt]->data();
uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data();
float *dest = (float *)m_data->m_pixels[(int)fmt]->data();

for (int n = 0; n < count; ++n)
@@ -231,7 +231,7 @@ void image::set_format(PixelFormat fmt)
}
else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::RGB_F32)
{
float *src = (float *)m_data->m_pixels[(int)old_fmt]->data();
uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data();
vec3 *dest = (vec3 *)m_data->m_pixels[(int)fmt]->data();

for (int n = 0; n < count; ++n)
@@ -255,7 +255,7 @@ void image::set_format(PixelFormat fmt)
}
else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::RGBA_F32)
{
float *src = (float *)m_data->m_pixels[(int)old_fmt]->data();
uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data();
vec4 *dest = (vec4 *)m_data->m_pixels[(int)fmt]->data();

for (int n = 0; n < count; ++n)


+ 6
- 6
src/input/controller.cpp View File

@@ -2,7 +2,7 @@
// Lol Engine
//
// Copyright © 2010—2015 Benjamin Litzelmann
// © 2017—2018 Sam Hocevar <sam@hocevar.net>
// © 2017—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -32,7 +32,7 @@ void KeyBinding::Bind(const std::string& device_name, const std::string& key_nam
return;
}

int keyindex = device->GetKeyIndex(key_name);
int keyindex = (int)device->GetKeyIndex(key_name);
if (keyindex < 0)
{
msg::warn("trying to bind nonexistent key %s.%s\n",
@@ -77,7 +77,7 @@ void AxisBinding::Bind(const std::string& device_name, const std::string& axis_n
return;
}

int axisindex = device->GetAxisIndex(axis_name);
int axisindex = (int)device->GetAxisIndex(axis_name);
if (axisindex < 0)
{
msg::warn("trying to bind nonexistent axis %s.%s\n",
@@ -98,7 +98,7 @@ void AxisBinding::BindKey(const std::string& device_name, const std::string& key
return;
}

int keyindex = device->GetKeyIndex(key_name);
int keyindex = (int)device->GetKeyIndex(key_name);
if (keyindex < 0)
{
msg::warn("trying to bind nonexistent axis key %s.%s\n",
@@ -119,7 +119,7 @@ void AxisBinding::BindKeys(const std::string& device_name, const std::string& mi
return;
}

int minkeyindex = device->GetKeyIndex(min_key_name);
int minkeyindex = (int)device->GetKeyIndex(min_key_name);
if (minkeyindex < 0)
{
msg::warn("trying to bind nonexistent axis key %s.%s\n",
@@ -127,7 +127,7 @@ void AxisBinding::BindKeys(const std::string& device_name, const std::string& mi
return;
}

int maxkeyindex = device->GetKeyIndex(max_key_name);
int maxkeyindex = (int)device->GetKeyIndex(max_key_name);
if (maxkeyindex < 0)
{
msg::warn("trying to bind nonexistent axis key %s.%s\n",


+ 0
- 2
src/lol-core.vcxproj View File

@@ -85,7 +85,6 @@
<ClCompile Include="audio\sample.cpp" />
<ClCompile Include="camera.cpp" />
<ClCompile Include="base\assert.cpp" />
<ClCompile Include="base\enum.cpp" />
<ClCompile Include="base\log.cpp" />
<ClCompile Include="base\string.cpp" />
<ClCompile Include="debug\fps.cpp" />
@@ -152,7 +151,6 @@
<ClCompile Include="light.cpp" />
<ClCompile Include="lolimgui.cpp" />
<ClCompile Include="lolua\baselua.cpp" />
<ClCompile Include="math\constants.cpp" />
<ClCompile Include="math\geometry.cpp" />
<ClCompile Include="math\half.cpp" />
<ClCompile Include="math\matrix.cpp" />


+ 0
- 6
src/lol-core.vcxproj.filter View File

@@ -243,9 +243,6 @@
<ClCompile Include="base\assert.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="base\enum.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="base\string.cpp">
<Filter>base</Filter>
</ClCompile>
@@ -288,9 +285,6 @@
<ClCompile Include="MessageService.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="math\constants.cpp">
<Filter>math</Filter>
</ClCompile>
<ClCompile Include="easymesh\easymeshrender.cpp">
<Filter>easymesh</Filter>
</ClCompile>


+ 3
- 3
src/lol/math/real.h View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -231,8 +231,8 @@ private:
public:
static int DEFAULT_BIGIT_COUNT;

static inline int bigit_bits() { return 8 * sizeof(bigit_t); }
inline int bigit_count() const { return m_mantissa.size(); }
static inline int bigit_bits() { return 8 * (int)sizeof(bigit_t); }
inline int bigit_count() const { return (int)m_mantissa.size(); }
inline int total_bits() const { return bigit_count() * bigit_bits(); }
};



+ 0
- 21
src/math/constants.cpp View File

@@ -1,21 +0,0 @@
//
// Lol Engine
//
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

namespace lol {

// There is nothing here for now.
extern int unused_file_constants_cpp;

}; /* namespace lol */


+ 3
- 3
src/mesh/mesh.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -111,7 +111,7 @@ void SubMesh::AddTexture(std::string const &name, Texture* texture)

void SubMesh::Render()
{
int vertex_count = 0;
size_t vertex_count = 0;

for (int i = 0; i < m_vbos.count(); ++i)
{
@@ -148,7 +148,7 @@ void SubMesh::Render()

m_ibo->Bind();
m_vdecl->Bind();
m_vdecl->DrawIndexedElements(MeshPrimitive::Triangles, m_ibo->GetSize() / sizeof(uint16_t));
m_vdecl->DrawIndexedElements(MeshPrimitive::Triangles, (int)(m_ibo->GetSize() / sizeof(uint16_t)));
m_vdecl->Unbind();
m_ibo->Unbind();
}


+ 4
- 4
src/sys/file.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -140,7 +140,7 @@ class FileData
if (done <= 0)
break;

int oldsize = ret.length();
size_t oldsize = ret.length();
ret.resize(oldsize + done);
memcpy(&ret[oldsize], &buf[0], done);

@@ -159,7 +159,7 @@ class FileData
if (done <= 0)
return -1;

return done;
return (int)done;
#else
return 0;
#endif
@@ -310,7 +310,7 @@ int File::Write(void const *buf, int count)
//--
int File::Write(std::string const &buf)
{
return m_data->Write(buf.c_str(), buf.length());
return m_data->Write(buf.c_str(), (int)buf.length());
}

//--


Loading…
Cancel
Save