Fix many warnings about implicit integer conversions when compiling for 64 bits.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-20 01:20:08 -04:00
parent 85de3c41fb
commit ebc68023a7
39 changed files with 114 additions and 114 deletions
+4 -4
View File
@@ -206,7 +206,7 @@ struct FramebufferStrategyCorePacked : public FramebufferStrategy
drawbuffers.push_back(GL_COLOR_ATTACHMENT0);
// Attach the canvas textures to the currently bound framebuffer.
for (size_t i = 0; i < canvases.size(); i++)
for (int i = 0; i < (int) canvases.size(); i++)
{
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1 + i,
GL_TEXTURE_2D, canvases[i]->getGLTexture(), 0);
@@ -214,7 +214,7 @@ struct FramebufferStrategyCorePacked : public FramebufferStrategy
}
// set up multiple render targets
glDrawBuffers(drawbuffers.size(), &drawbuffers[0]);
glDrawBuffers((int) drawbuffers.size(), &drawbuffers[0]);
}
};
@@ -364,7 +364,7 @@ struct FramebufferStrategyPackedEXT : public FramebufferStrategy
drawbuffers.push_back(GL_COLOR_ATTACHMENT0_EXT);
// Attach the canvas textures to the currently bound framebuffer.
for (size_t i = 0; i < canvases.size(); i++)
for (int i = 0; i < (int) canvases.size(); i++)
{
glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1_EXT + i,
GL_TEXTURE_2D, canvases[i]->getGLTexture(), 0);
@@ -372,7 +372,7 @@ struct FramebufferStrategyPackedEXT : public FramebufferStrategy
}
// set up multiple render targets
glDrawBuffers(drawbuffers.size(), &drawbuffers[0]);
glDrawBuffers((int) drawbuffers.size(), &drawbuffers[0]);
}
};
+1 -1
View File
@@ -457,7 +457,7 @@ std::vector<Font::DrawCommand> Font::generateVerticesFormatted(const std::string
offset.x = floorf((wrap - width) / 2.0f);
break;
case ALIGN_JUSTIFY:
numspaces = std::count(line.begin(), line.end(), ' ');
numspaces = (int) std::count(line.begin(), line.end(), ' ');
if (wrappedlines[i] && numspaces >= 1)
extraspacing = (wrap - width) / float(numspaces);
else
+1 -1
View File
@@ -1150,7 +1150,7 @@ void Graphics::polygon(DrawMode mode, const float *coords, size_t count)
gl.bindTexture(gl.getDefaultTexture());
glEnableVertexAttribArray(ATTRIB_POS);
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords);
gl.drawArrays(GL_TRIANGLE_FAN, 0, count/2-1); // opengl will close the polygon for us
gl.drawArrays(GL_TRIANGLE_FAN, 0, (int)count/2-1); // opengl will close the polygon for us
glDisableVertexAttribArray(ATTRIB_POS);
}
}
+2 -2
View File
@@ -358,7 +358,7 @@ void Mesh::draw(float x, float y, float angle, float sx, float sy, float ox, flo
// Make sure the index buffer isn't mapped (sends data to GPU if needed.)
ibo->unmap();
int max = element_count - 1;
int max = (int) element_count - 1;
if (range_max >= 0)
max = std::min(range_max, max);
@@ -373,7 +373,7 @@ void Mesh::draw(float x, float y, float angle, float sx, float sy, float ox, flo
}
else
{
int max = vertex_count - 1;
int max = (int) vertex_count - 1;
if (range_max >= 0)
max = std::min(range_max, max);
+1 -1
View File
@@ -116,7 +116,7 @@ void OpenGL::setupContext()
state.curTextureUnit = (int) curgltextureunit - GL_TEXTURE0;
// Retrieve currently bound textures for each texture unit.
for (size_t i = 0; i < state.textureUnits.size(); i++)
for (int i = 0; i < (int) state.textureUnits.size(); i++)
{
glActiveTexture(GL_TEXTURE0 + i);
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &state.textureUnits[i]);
@@ -889,7 +889,7 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
{
VertexBuffer::Bind ibo_bind(*ibo.getVertexBuffer());
gl.drawElements(GL_TRIANGLES, ibo.getIndexCount(pCount), ibo.getType(), ibo.getPointer(0));
gl.drawElements(GL_TRIANGLES, (GLsizei) ibo.getIndexCount(pCount), ibo.getType(), ibo.getPointer(0));
}
glDisableVertexAttribArray(ATTRIB_TEXCOORD);
@@ -990,7 +990,7 @@ void ParticleSystem::update(float dt)
{
s = t * (float) k; // [0:numquads-1] (clamped below)
i = (s > 0.0f) ? (size_t) s : 0;
p->quadIndex = (i < k) ? i : k - 1;
p->quadIndex = (int) ((i < k) ? i : k - 1);
}
// Next particle.
+4 -4
View File
@@ -369,9 +369,9 @@ void Polyline::draw()
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, vertices);
if (use_quad_indices)
gl.drawElements(draw_mode, (vertex_count / 4) * 6, GL_UNSIGNED_SHORT, indices);
gl.drawElements(draw_mode, (int) (vertex_count / 4) * 6, GL_UNSIGNED_SHORT, indices);
else
gl.drawArrays(draw_mode, 0, vertex_count);
gl.drawArrays(draw_mode, 0, (int) vertex_count);
if (overdraw)
{
@@ -385,9 +385,9 @@ void Polyline::draw()
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, overdraw);
if (use_quad_indices)
gl.drawElements(draw_mode, (overdraw_vertex_count / 4) * 6, GL_UNSIGNED_SHORT, indices);
gl.drawElements(draw_mode, (int) (overdraw_vertex_count / 4) * 6, GL_UNSIGNED_SHORT, indices);
else
gl.drawArrays(draw_mode, 0, overdraw_vertex_count);
gl.drawArrays(draw_mode, 0, (int) overdraw_vertex_count);
glDisableVertexAttribArray(ATTRIB_COLOR);
+3 -3
View File
@@ -401,7 +401,7 @@ void Shader::attach(bool temporary)
for (size_t i = 0; i < activeTexUnits.size(); ++i)
{
if (activeTexUnits[i] > 0)
gl.bindTextureToUnit(activeTexUnits[i], i + 1, false);
gl.bindTextureToUnit(activeTexUnits[i], (int) i + 1, false);
}
// We always want to use texture unit 0 for everyhing else.
@@ -589,7 +589,7 @@ int Shader::getTextureUnit(const std::string &name)
if (freeunit_it != textureCounters.end())
{
// we don't want to use unit 0
texunit = std::distance(textureCounters.begin(), freeunit_it) + 1;
texunit = (int) std::distance(textureCounters.begin(), freeunit_it) + 1;
}
else
{
@@ -600,7 +600,7 @@ int Shader::getTextureUnit(const std::string &name)
throw love::Exception("No more texture units available for shader.");
// we don't want to use unit 0
texunit = std::distance(activeTexUnits.begin(), nextunit_it) + 1;
texunit = (int) std::distance(activeTexUnits.begin(), nextunit_it) + 1;
}
texUnitPool[name] = texunit;
+1 -1
View File
@@ -263,7 +263,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float
glVertexAttribPointer(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), array_buf->getPointer(texel_offset));
gl.prepareDraw();
gl.drawElements(GL_TRIANGLES, element_buf.getIndexCount(next), element_buf.getType(), element_buf.getPointer(0));
gl.drawElements(GL_TRIANGLES, (GLsizei) element_buf.getIndexCount(next), element_buf.getType(), element_buf.getPointer(0));
glDisableVertexAttribArray(ATTRIB_TEXCOORD);
glDisableVertexAttribArray(ATTRIB_POS);
+6 -6
View File
@@ -365,13 +365,13 @@ void VertexIndex::fill()
for (size_t i = 0; i < maxSize; ++i)
{
indices[i*6+0] = i * 4 + 0;
indices[i*6+1] = i * 4 + 1;
indices[i*6+2] = i * 4 + 2;
indices[i*6+0] = T(i * 4 + 0);
indices[i*6+1] = T(i * 4 + 1);
indices[i*6+2] = T(i * 4 + 2);
indices[i*6+3] = i * 4 + 0;
indices[i*6+4] = i * 4 + 2;
indices[i*6+5] = i * 4 + 3;
indices[i*6+3] = T(i * 4 + 0);
indices[i*6+4] = T(i * 4 + 2);
indices[i*6+5] = T(i * 4 + 3);
}
}
+1 -1
View File
@@ -60,7 +60,7 @@ int w_Font_getWrap(lua_State *L)
luax_catchexcept(L, [&]() {
t->getWrap(str, wrap, lines, &widths);
numlines = lines.size();
numlines = (int) lines.size();
});
for (int width : widths)
@@ -526,7 +526,7 @@ int w_newMesh(lua_State *L)
// Get the vertices from the table.
for (size_t i = 1; i <= vertex_count; i++)
{
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, (int) i);
if (lua_type(L, -1) != LUA_TTABLE)
return luax_typerror(L, 1, "table of tables");
@@ -923,7 +923,7 @@ int w_setCanvas(lua_State *L)
if (is_table)
{
for (size_t i = 1; i <= lua_objlen(L, 1); i++)
for (int i = 1; i <= (int) lua_objlen(L, 1); i++)
{
lua_rawgeti(L, 1, i);
canvases.push_back(luax_checkcanvas(L, -1));
@@ -1259,7 +1259,7 @@ int w_line(lua_State *L)
bool is_table = false;
if (args == 1 && lua_istable(L, 1))
{
args = lua_objlen(L, 1);
args = (int) lua_objlen(L, 1);
is_table = true;
}
@@ -1360,7 +1360,7 @@ int w_polygon(lua_State *L)
float *coords;
if (args == 1 && lua_istable(L, 2))
{
args = lua_objlen(L, 2);
args = (int) lua_objlen(L, 2);
is_table = true;
}
+7 -7
View File
@@ -102,12 +102,12 @@ int w_Mesh_setVertices(lua_State *L)
{
Mesh *t = luax_checkmesh(L, 1);
size_t vertex_count = lua_objlen(L, 2);
int vertex_count = (int) lua_objlen(L, 2);
std::vector<Vertex> vertices;
vertices.reserve(vertex_count);
// Get the vertices from the table.
for (size_t i = 1; i <= vertex_count; i++)
for (int i = 1; i <= vertex_count; i++)
{
lua_rawgeti(L, 2, i);
@@ -144,13 +144,13 @@ int w_Mesh_getVertices(lua_State *L)
const Vertex *vertices = t->getVertices();
size_t count = t->getVertexCount();
int count = (int) t->getVertexCount();
lua_createtable(L, count, 0);
if (count == 0 || vertices == nullptr)
return 1;
for (size_t i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
// Create vertex table.
lua_createtable(L, 8, 0);
@@ -199,7 +199,7 @@ int w_Mesh_setVertexMap(lua_State *L)
Mesh *t = luax_checkmesh(L, 1);
bool is_table = lua_istable(L, 2);
int nargs = is_table ? lua_objlen(L, 2) : lua_gettop(L) - 1;
int nargs = is_table ? (int) lua_objlen(L, 2) : lua_gettop(L) - 1;
std::vector<uint32> vertexmap;
vertexmap.reserve(nargs);
@@ -227,11 +227,11 @@ int w_Mesh_getVertexMap(lua_State *L)
std::vector<uint32> vertex_map;
luax_catchexcept(L, [&](){ t->getVertexMap(vertex_map); });
size_t element_count = vertex_map.size();
int element_count = (int) vertex_map.size();
lua_createtable(L, element_count, 0);
for (size_t i = 0; i < element_count; i++)
for (int i = 0; i < element_count; i++)
{
lua_pushinteger(L, lua_Integer(vertex_map[i]) + 1);
lua_rawseti(L, -2, i + 1);
@@ -381,7 +381,7 @@ int w_ParticleSystem_setSizes(lua_State *L)
{
std::vector<float> sizes(nSizes);
for (size_t i = 0; i < nSizes; ++i)
sizes[i] = luax_checkfloat(L, 1 + i + 1);
sizes[i] = luax_checkfloat(L, (int) (1 + i + 1));
t->setSizes(sizes);
}
@@ -396,7 +396,7 @@ int w_ParticleSystem_getSizes(lua_State *L)
for (size_t i = 0; i < sizes.size(); i++)
lua_pushnumber(L, sizes[i]);
return sizes.size();
return (int) sizes.size();
}
int w_ParticleSystem_setSizeVariation(lua_State *L)
@@ -494,14 +494,14 @@ int w_ParticleSystem_setColors(lua_State *L)
if (lua_istable(L, 2)) // setColors({r,g,b,a}, {r,g,b,a}, ...)
{
size_t nColors = lua_gettop(L) - 1;
int nColors = (int) lua_gettop(L) - 1;
if (nColors > 8)
return luaL_error(L, "At most eight (8) colors may be used.");
std::vector<Color> colors(nColors);
for (size_t i = 0; i < nColors; i++)
for (int i = 0; i < nColors; i++)
{
luaL_checktype(L, i + 2, LUA_TTABLE);
@@ -528,7 +528,7 @@ int w_ParticleSystem_setColors(lua_State *L)
else // setColors(r,g,b,a, r,g,b,a, ...)
{
int cargs = lua_gettop(L) - 1;
size_t nColors = (cargs + 3) / 4; // nColors = ceil(color_args / 4)
int nColors = (cargs + 3) / 4; // nColors = ceil(color_args / 4)
if (cargs != 3 && (cargs % 4 != 0 || cargs == 0))
return luaL_error(L, "Expected red, green, blue, and alpha. Only got %d of 4 components.", cargs % 4);
@@ -547,7 +547,7 @@ int w_ParticleSystem_setColors(lua_State *L)
else
{
std::vector<Color> colors(nColors);
for (size_t i = 0; i < nColors; ++i)
for (int i = 0; i < nColors; ++i)
{
unsigned char r = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 1);
unsigned char g = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 2);
@@ -582,7 +582,7 @@ int w_ParticleSystem_getColors(lua_State *L)
lua_rawseti(L, -2, 4);
}
return colors.size();
return (int) colors.size();
}
int w_ParticleSystem_setQuads(lua_State *L)
@@ -592,7 +592,7 @@ int w_ParticleSystem_setQuads(lua_State *L)
if (lua_istable(L, 2))
{
for (size_t i = 1; i <= lua_objlen(L, 2); i++)
for (int i = 1; i <= (int) lua_objlen(L, 2); i++)
{
lua_rawgeti(L, 2, i);
@@ -622,7 +622,7 @@ int w_ParticleSystem_getQuads(lua_State *L)
lua_createtable(L, (int) quads.size(), 0);
for (size_t i = 0; i < quads.size(); i++)
for (int i = 0; i < (int) quads.size(); i++)
{
luax_pushtype(L, "Quad", GRAPHICS_QUAD_T, quads[i]);
lua_rawseti(L, -2, i + 1);
+8 -8
View File
@@ -87,7 +87,7 @@ static T *_getVectors(lua_State *L, int count, size_t &dimension)
return 0;
}
for (size_t k = 1; k <= dimension; ++k)
for (int k = 1; k <= (int) dimension; ++k)
{
lua_rawgeti(L, 3 + i, k);
if (lua_isnumber(L, -1))
@@ -132,7 +132,7 @@ int w_Shader_sendInt(lua_State *L)
bool should_error = false;
try
{
shader->sendInt(name, dimension, values, count);
shader->sendInt(name, (int) dimension, values, count);
}
catch (love::Exception &e)
{
@@ -173,7 +173,7 @@ int w_Shader_sendFloat(lua_State *L)
bool should_error = false;
try
{
shader->sendFloat(name, dimension, values, count);
shader->sendFloat(name, (int) dimension, values, count);
}
catch (love::Exception &e)
{
@@ -199,7 +199,7 @@ int w_Shader_sendMatrix(lua_State *L)
return luax_typerror(L, 3, "matrix table");
lua_getfield(L, 3, "dimension");
int dimension = lua_tointeger(L, -1);
int dimension = (int) lua_tointeger(L, -1);
lua_pop(L, 1);
if (dimension < 2 || dimension > 4)
@@ -217,7 +217,7 @@ int w_Shader_sendMatrix(lua_State *L)
// a dimension of mind. You're moving into a land of both shadow
// and substance, of things and ideas. You've just crossed over
// into... the Twilight Zone.
int other_dimension = lua_tointeger(L, -1);
int other_dimension = (int) lua_tointeger(L, -1);
delete[] values;
return luaL_error(L, "Invalid matrix size at argument %d: Expected size %dx%d, got %dx%d.",
3+i, dimension, dimension, other_dimension, other_dimension);
@@ -258,19 +258,19 @@ static void w_convertMatrices(lua_State *L, int idx)
for (int matrix = idx; matrix < idx + matrixcount; matrix++)
{
luaL_checktype(L, matrix, LUA_TTABLE);
int dimension = lua_objlen(L, matrix);
int dimension = (int) lua_objlen(L, matrix);
int newi = 1;
lua_createtable(L, dimension * dimension, 0);
// Collapse {{a,b,c}, {d,e,f}, ...} to {a,b,c, d,e,f, ...}
for (size_t i = 1; i <= lua_objlen(L, matrix); i++)
for (int i = 1; i <= (int) lua_objlen(L, matrix); i++)
{
// Push args[matrix][i] onto the stack.
lua_rawgeti(L, matrix, i);
luaL_checktype(L, -1, LUA_TTABLE);
for (size_t j = 1; j <= lua_objlen(L, -1); j++)
for (int j = 1; j <= (int) lua_objlen(L, -1); j++)
{
// Push args[matrix[i][j] onto the stack.
lua_rawgeti(L, -1, j);
@@ -78,7 +78,7 @@ int w_SpriteBatch_add(lua_State *L)
int w_SpriteBatch_set(lua_State *L)
{
SpriteBatch *t = luax_checkspritebatch(L, 1);
int id = luaL_checkinteger(L, 2);
int id = luaL_checkint(L, 2);
Quad *quad = nullptr;
int startidx = 3;