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
@@ -3802,7 +3802,6 @@
LOVE_NOMPG123,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
ios/include,
@@ -3844,7 +3843,6 @@
LOVE_NO_MODPLUG,
LOVE_NOMPG123,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
ios/include,
@@ -3887,7 +3885,6 @@
LOVE_NO_MODPLUG,
LOVE_NOMPG123,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
ios/include,
+6 -3
View File
@@ -330,19 +330,22 @@ int luax_table_insert(lua_State *L, int tindex, int vindex, int pos)
tindex = lua_gettop(L)+1+tindex;
if (vindex < 0)
vindex = lua_gettop(L)+1+vindex;
if (pos == -1)
{
lua_pushvalue(L, vindex);
lua_rawseti(L, tindex, lua_objlen(L, tindex)+1);
lua_rawseti(L, tindex, (int) lua_objlen(L, tindex)+1);
return 0;
}
else if (pos < 0)
pos = lua_objlen(L, tindex)+1+pos;
for (int i = lua_objlen(L, tindex)+1; i > pos; i--)
pos = (int) lua_objlen(L, tindex)+1+pos;
for (int i = (int) lua_objlen(L, tindex)+1; i > pos; i--)
{
lua_rawgeti(L, tindex, i-1);
lua_rawseti(L, tindex, i);
}
lua_pushvalue(L, vindex);
lua_rawseti(L, tindex, pos);
return 0;
+1 -1
View File
@@ -128,7 +128,7 @@ void Pool::update()
int Pool::getSourceCount() const
{
return playing.size();
return (int) playing.size();
}
int Pool::getMaxSources() const
+1 -1
View File
@@ -102,7 +102,7 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData)
if (fmt == 0)
throw InvalidFormatException(soundData->getChannels(), soundData->getBitDepth());
staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate()));
staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), (ALsizei) soundData->getSize(), soundData->getSampleRate()));
// The buffer has a +2 retain count right now, but we want it to have +1.
staticBuffer->release();
+1 -1
View File
@@ -373,7 +373,7 @@ FileData *Filesystem::newFileData(void *data, unsigned int size, const char *fil
FileData *Filesystem::newFileData(const char *b64, const char *filename) const
{
int size = strlen(b64);
int size = (int) strlen(b64);
int outsize = 0;
char *dst = b64_decode(b64, size, outsize);
FileData *fd = new FileData(outsize, std::string(filename));
+2 -2
View File
@@ -143,7 +143,7 @@ BMFontRasterizer::BMFontRasterizer(love::filesystem::FileData *fontdef, const st
fontFolder = filename.substr(0, separatorpos);
// The parseConfig function will try to load any missing page images.
for (size_t i = 0; i < imagelist.size(); i++)
for (int i = 0; i < (int) imagelist.size(); i++)
images[i] = imagelist[i];
std::string configtext((const char *) fontdef->getData(), fontdef->getSize());
@@ -178,7 +178,7 @@ void BMFontRasterizer::parseConfig(const std::string &configtext)
}
else if (tag == "page")
{
size_t pageindex = (size_t) cline.getAttributeInt("id");
int pageindex = cline.getAttributeInt("id");
std::string filename = cline.getAttributeString("file");
// The file name is relative to the font file's folder.
+1 -1
View File
@@ -73,7 +73,7 @@ Rasterizer *Font::newImageRasterizer(love::image::ImageData *data, const std::st
throw love::Exception("UTF-8 decoding error: %s", e.what());
}
return newImageRasterizer(data, &glyphs[0], glyphs.size());
return newImageRasterizer(data, &glyphs[0], (int) glyphs.size());
}
Rasterizer *Font::newImageRasterizer(love::image::ImageData *data, uint32 *glyphs, int numglyphs)
@@ -53,10 +53,10 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, love::Data *data, int
// Set global metrics
FT_Size_Metrics s = face->size->metrics;
metrics.advance = s.max_advance >> 6;
metrics.ascent = s.ascender >> 6;
metrics.descent = s.descender >> 6;
metrics.height = s.height >> 6;
metrics.advance = (int) (s.max_advance >> 6);
metrics.ascent = (int) (s.ascender >> 6);
metrics.descent = (int) (s.descender >> 6);
metrics.height = (int) (s.height >> 6);
}
TrueTypeRasterizer::~TrueTypeRasterizer()
@@ -100,7 +100,7 @@ GlyphData *TrueTypeRasterizer::getGlyphData(uint32 glyph) const
glyphMetrics.bearingY = bitmap_glyph->top;
glyphMetrics.height = bitmap.rows;
glyphMetrics.width = bitmap.width;
glyphMetrics.advance = ftglyph->advance.x >> 16;
glyphMetrics.advance = (int) (ftglyph->advance.x >> 16);
GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);
@@ -151,7 +151,7 @@ GlyphData *TrueTypeRasterizer::getGlyphData(uint32 glyph) const
int TrueTypeRasterizer::getGlyphCount() const
{
return face->num_glyphs;
return (int) face->num_glyphs;
}
bool TrueTypeRasterizer::hasGlyph(uint32 glyph) const
+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;
+1 -1
View File
@@ -49,7 +49,7 @@ void *CompressedData::getData() const
int CompressedData::getMipmapCount() const
{
return dataImages.size();
return (int) dataImages.size();
}
size_t CompressedData::getSize(int miplevel) const
+2 -2
View File
@@ -129,8 +129,8 @@ ImageIOHandler::DecodedImage ImageIOHandler::decode(love::filesystem::FileData *
if (!image)
throw love::Exception("Could not decode image!");
img.width = CGImageGetWidth(image);
img.height = CGImageGetHeight(image);
img.width = (int) CGImageGetWidth(image);
img.height = (int) CGImageGetHeight(image);
CGImageAlphaInfo alphainfo = CGImageGetAlphaInfo(image);
+3 -3
View File
@@ -34,7 +34,7 @@ CompressedData *luax_checkcompresseddata(lua_State *L, int idx)
int w_CompressedData_getWidth(lua_State *L)
{
CompressedData *t = luax_checkcompresseddata(L, 1);
int miplevel = luaL_optinteger(L, 2, 1);
int miplevel = luaL_optint(L, 2, 1);
int width = 0;
luax_catchexcept(L, [&](){ width = t->getWidth(miplevel - 1); });
@@ -46,7 +46,7 @@ int w_CompressedData_getWidth(lua_State *L)
int w_CompressedData_getHeight(lua_State *L)
{
CompressedData *t = luax_checkcompresseddata(L, 1);
int miplevel = luaL_optinteger(L, 2, 1);
int miplevel = luaL_optint(L, 2, 1);
int height = 0;
luax_catchexcept(L, [&](){ height = t->getHeight(miplevel - 1); });
@@ -58,7 +58,7 @@ int w_CompressedData_getHeight(lua_State *L)
int w_CompressedData_getDimensions(lua_State *L)
{
CompressedData *t = luax_checkcompresseddata(L, 1);
int miplevel = luaL_optinteger(L, 2, 1);
int miplevel = luaL_optint(L, 2, 1);
int width = 0, height = 0;
luax_catchexcept(L, [&]()
+2 -2
View File
@@ -84,7 +84,7 @@ love::joystick::Joystick *JoystickModule::getJoystick(int joyindex)
int JoystickModule::getIndex(const love::joystick::Joystick *joystick)
{
for (size_t i = 0; i < activeSticks.size(); i++)
for (int i = 0; i < (int) activeSticks.size(); i++)
{
if (activeSticks[i] == joystick)
return i;
@@ -132,7 +132,7 @@ love::joystick::Joystick *JoystickModule::addJoystick(int deviceindex)
if (!joystick)
{
joystick = new Joystick(joysticks.size());
joystick = new Joystick((int) joysticks.size());
joysticks.push_back(joystick);
}
+1 -1
View File
@@ -174,7 +174,7 @@ Vector BezierCurve::evaluate(double t) const
return points[0];
}
vector<Vector> BezierCurve::render(size_t accuracy) const
vector<Vector> BezierCurve::render(int accuracy) const
{
if (controlPoints.size() < 2)
throw Exception("Invalid Bezier curve: Not enough control points.");
+1 -1
View File
@@ -112,7 +112,7 @@ public:
* @param accuracy The 'fineness' of the curve.
* @returns A polygon chain that approximates the bezier curve.
**/
std::vector<Vector> render(size_t accuracy = 4) const;
std::vector<Vector> render(int accuracy = 4) const;
private:
std::vector<Vector> controlPoints;
+6 -6
View File
@@ -52,7 +52,7 @@ int w_BezierCurve_getDerivative(lua_State *L)
int w_BezierCurve_getControlPoint(lua_State *L)
{
BezierCurve *curve = luax_checkbeziercurve(L, 1);
int idx = luaL_checkinteger(L, 2);
int idx = luaL_checkint(L, 2);
if (idx > 0) // 1-indexing
idx--;
@@ -69,7 +69,7 @@ int w_BezierCurve_getControlPoint(lua_State *L)
int w_BezierCurve_setControlPoint(lua_State *L)
{
BezierCurve *curve = luax_checkbeziercurve(L, 1);
int idx = luaL_checkinteger(L, 2);
int idx = luaL_checkint(L, 2);
float vx = (float) luaL_checknumber(L, 3);
float vy = (float) luaL_checknumber(L, 4);
@@ -85,7 +85,7 @@ int w_BezierCurve_insertControlPoint(lua_State *L)
BezierCurve *curve = luax_checkbeziercurve(L, 1);
float vx = (float) luaL_checknumber(L, 2);
float vy = (float) luaL_checknumber(L, 3);
int idx = luaL_optinteger(L, 4, -1);
int idx = luaL_optint(L, 4, -1);
if (idx > 0) // 1-indexing
idx--;
@@ -148,13 +148,13 @@ int w_BezierCurve_evaluate(lua_State *L)
int w_BezierCurve_render(lua_State *L)
{
BezierCurve *curve = luax_checkbeziercurve(L, 1);
int accuracy = luaL_optinteger(L, 2, 5);
int accuracy = luaL_optint(L, 2, 5);
std::vector<Vector> points;
luax_catchexcept(L, [&](){ points = curve->render(accuracy); });
lua_createtable(L, points.size()*2, 0);
for (size_t i = 0; i < points.size(); ++i)
lua_createtable(L, (int) points.size() * 2, 0);
for (int i = 0; i < (int) points.size(); ++i)
{
lua_pushnumber(L, points[i].x);
lua_rawseti(L, -2, 2*i+1);
+13 -13
View File
@@ -110,9 +110,9 @@ int w_newBezierCurve(lua_State *L)
std::vector<Vector> points;
if (lua_istable(L, 1))
{
size_t top = lua_objlen(L, 1);
int top = (int) lua_objlen(L, 1);
points.reserve(top / 2);
for (size_t i = 1; i <= top; i += 2)
for (int i = 1; i <= top; i += 2)
{
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, i+1);
@@ -127,9 +127,9 @@ int w_newBezierCurve(lua_State *L)
}
else
{
size_t top = lua_gettop(L);
int top = (int) lua_gettop(L);
points.reserve(top / 2);
for (size_t i = 1; i <= top; i += 2)
for (int i = 1; i <= top; i += 2)
{
Vector v;
v.x = (float) luaL_checknumber(L, i);
@@ -149,9 +149,9 @@ int w_triangulate(lua_State *L)
std::vector<Vertex> vertices;
if (lua_istable(L, 1))
{
size_t top = lua_objlen(L, 1);
int top = (int) lua_objlen(L, 1);
vertices.reserve(top / 2);
for (size_t i = 1; i <= top; i += 2)
for (int i = 1; i <= top; i += 2)
{
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, i+1);
@@ -166,9 +166,9 @@ int w_triangulate(lua_State *L)
}
else
{
size_t top = lua_gettop(L);
int top = (int) lua_gettop(L);
vertices.reserve(top / 2);
for (size_t i = 1; i <= top; i += 2)
for (int i = 1; i <= top; i += 2)
{
Vertex v;
v.x = (float) luaL_checknumber(L, i);
@@ -189,8 +189,8 @@ int w_triangulate(lua_State *L)
triangles = Math::instance.triangulate(vertices);
});
lua_createtable(L, triangles.size(), 0);
for (size_t i = 0; i < triangles.size(); ++i)
lua_createtable(L, (int) triangles.size(), 0);
for (int i = 0; i < (int) triangles.size(); ++i)
{
const Triangle &tri = triangles[i];
@@ -219,9 +219,9 @@ int w_isConvex(lua_State *L)
std::vector<Vertex> vertices;
if (lua_istable(L, 1))
{
size_t top = lua_objlen(L, 1);
int top = (int) lua_objlen(L, 1);
vertices.reserve(top / 2);
for (size_t i = 1; i <= top; i += 2)
for (int i = 1; i <= top; i += 2)
{
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, i+1);
@@ -257,7 +257,7 @@ static int getGammaArgs(lua_State *L, float color[4])
if (lua_istable(L, 1))
{
int n = lua_objlen(L, 1);
int n = (int) lua_objlen(L, 1);
for (int i = 1; i <= n && i <= 4; i++)
{
lua_rawgeti(L, 1, i);
+3 -3
View File
@@ -97,7 +97,7 @@ int Physics::newPolygonShape(lua_State *L)
bool istable = lua_istable(L, 1);
if (istable)
argc = lua_objlen(L, 1);
argc = (int) lua_objlen(L, 1);
if (argc % 2 != 0)
return luaL_error(L, "Number of vertex components must be a multiple of two.");
@@ -158,12 +158,12 @@ int Physics::newChainShape(lua_State *L)
bool istable = lua_istable(L, 2);
if (istable)
argc = lua_objlen(L, 2);
argc = (int) lua_objlen(L, 2);
if (argc % 2 != 0)
return luaL_error(L, "Number of vertex components must be a multiple of two.");
int vcount = (int)argc/2;
int vcount = argc/2;
bool loop = luax_toboolean(L, 1);
b2Vec2 *vecs = new b2Vec2[vcount];
+1 -1
View File
@@ -176,7 +176,7 @@ int SoundData::getSampleRate() const
int SoundData::getSampleCount() const
{
return (size/channels)/(bitDepth/8);
return (int) ((size/channels)/(bitDepth/8));
}
float SoundData::getDuration() const
+3 -3
View File
@@ -144,7 +144,7 @@ VorbisDecoder::VorbisDecoder(Data *data, const std::string &ext, int bufferSize)
// Initialize OGG file
oggFile.dataPtr = (char *) data->getData();
oggFile.dataSize = data->getSize();
oggFile.dataSize = (int) data->getSize();
oggFile.dataRead = 0;
// Open Vorbis handle
@@ -188,7 +188,7 @@ int VorbisDecoder::decode()
while (size < bufferSize)
{
int result = ov_read(&handle, (char *) buffer + size, bufferSize - size, endian, (getBitDepth() == 16 ? 2 : 1), 1, 0);
long result = ov_read(&handle, (char *) buffer + size, bufferSize - size, endian, (getBitDepth() == 16 ? 2 : 1), 1, 0);
if (result == OV_HOLE)
continue;
@@ -250,7 +250,7 @@ int VorbisDecoder::getBitDepth() const
int VorbisDecoder::getSampleRate() const
{
return vorbisInfo->rate;
return (int) vorbisInfo->rate;
}
} // lullaby
+1 -1
View File
@@ -140,7 +140,7 @@ int WaveDecoder::decode()
size += bytes;
}
return size;
return (int) size;
}
bool WaveDecoder::seek(float s)
+1 -1
View File
@@ -176,7 +176,7 @@ Variant *Channel::peek()
int Channel::getCount()
{
Lock l(mutex);
return queue.size();
return (int) queue.size();
}
void Channel::clear()
+1 -1
View File
@@ -47,7 +47,7 @@ int w_getTouchIDs(lua_State *L)
// We use lightuserdata instead of a lua_Number (double) because doubles
// can't represent all possible id values on 64-bit systems.
lua_pushlightuserdata(L, (void *) (intptr_t) ids[i]);
lua_rawseti(L, -2, i + 1);
lua_rawseti(L, -2, (int) i + 1);
}
return 1;
+2 -2
View File
@@ -196,7 +196,7 @@ int w_getFullscreenModes(lua_State *L)
std::vector<Window::WindowSize> modes = instance()->getFullscreenSizes(displayindex);
lua_createtable(L, modes.size(), 0);
lua_createtable(L, (int) modes.size(), 0);
for (size_t i = 0; i < modes.size(); i++)
{
@@ -417,7 +417,7 @@ int w_showMessageBox(lua_State *L)
// Array of button names.
for (size_t i = 0; i < numbuttons; i++)
{
lua_rawgeti(L, 3, i + 1);
lua_rawgeti(L, 3, (int) i + 1);
data.buttons.push_back(luax_checkstring(L, -1));
lua_pop(L, 1);
}