Fix warnings on newer versions of gcc;

This commit is contained in:
bjorn 2019-06-11 19:57:20 -07:00
parent 909ee1ad79
commit 79083c7df1
5 changed files with 8 additions and 8 deletions

View File

@ -55,7 +55,7 @@ static int l_lovrCanvasNewTextureData(lua_State* L) {
uint32_t index = luaL_optinteger(L, 2, 1) - 1;
uint32_t count;
lovrCanvasGetAttachments(canvas, &count);
lovrAssert(index >= 0 && index < count, "Can not create a TextureData from Texture #%d of Canvas (it only has %d textures)", index, count);
lovrAssert(index < count, "Can not create a TextureData from Texture #%d of Canvas (it only has %d textures)", index, count);
TextureData* textureData = lovrCanvasNewTextureData(canvas, index);
luax_pushtype(L, TextureData, textureData);
lovrRelease(TextureData, textureData);

View File

@ -1538,11 +1538,11 @@ static int l_lovrGraphicsNewTexture(lua_State* L) {
lua_pop(L, 1);
lua_getfield(L, index, "type");
type = lua_isnil(L, -1) ? type : luaL_checkoption(L, -1, NULL, TextureTypes);
type = lua_isnil(L, -1) ? type : (TextureType) luaL_checkoption(L, -1, NULL, TextureTypes);
lua_pop(L, 1);
lua_getfield(L, index, "format");
format = lua_isnil(L, -1) ? format : luaL_checkoption(L, -1, NULL, TextureFormats);
format = lua_isnil(L, -1) ? format : (TextureFormat) luaL_checkoption(L, -1, NULL, TextureFormats);
lua_pop(L, 1);
lua_getfield(L, index, "msaa");

View File

@ -174,7 +174,7 @@ static int l_lovrMeshGetVertex(lua_State* L) {
static int l_lovrMeshSetVertex(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t index = luaL_checkinteger(L, 2) - 1;
lovrAssert(index >= 0 && index < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex index: %d", index + 1);
lovrAssert(index < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex index: %d", index + 1);
bool table = lua_istable(L, 3);
if (!mesh->vertexBuffer || mesh->attributeCount == 0 || mesh->attributes[0].buffer != mesh->vertexBuffer) {
@ -222,7 +222,7 @@ static int l_lovrMeshGetVertexAttribute(lua_State* L) {
uint32_t attributeIndex = luaL_checkinteger(L, 3) - 1;
Buffer* buffer = lovrMeshGetVertexBuffer(mesh);
lovrAssert(lovrBufferIsReadable(buffer), "Mesh:getVertex can only be used if the Mesh was created with the readable flag");
lovrAssert(vertexIndex >= 0 && vertexIndex < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex: %d", vertexIndex + 1);
lovrAssert(vertexIndex < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex: %d", vertexIndex + 1);
lovrAssert(attributeIndex < mesh->attributeCount, "Invalid mesh attribute: %d", attributeIndex + 1);
lovrAssert(mesh->attributes[attributeIndex].buffer == mesh->vertexBuffer, "Invalid mesh attribute: %d", attributeIndex + 1);
MeshAttribute* attribute = &mesh->attributes[attributeIndex];
@ -246,7 +246,7 @@ static int l_lovrMeshSetVertexAttribute(lua_State* L) {
uint32_t vertexIndex = luaL_checkinteger(L, 2) - 1;
uint32_t attributeIndex = luaL_checkinteger(L, 3) - 1;
bool table = lua_istable(L, 4);
lovrAssert(vertexIndex >= 0 && vertexIndex < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex: %d", vertexIndex + 1);
lovrAssert(vertexIndex < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex: %d", vertexIndex + 1);
lovrAssert(attributeIndex < mesh->attributeCount, "Invalid mesh attribute: %d", attributeIndex + 1);
lovrAssert(mesh->attributes[attributeIndex].buffer == mesh->vertexBuffer, "Invalid mesh attribute: %d", attributeIndex + 1);
MeshAttribute* attribute = &mesh->attributes[attributeIndex];

View File

@ -28,6 +28,6 @@ static inline uint32_t ref_dec(Ref* ref) { return --*ref; }
void* _lovrAlloc(size_t size);
#define toRef(o) (Ref*) (o) - 1
#define lovrAlloc(T) (T*) _lovrAlloc(sizeof(T))
#define lovrRetain(o) o && !ref_inc(toRef(o))
#define lovrRetain(o) if (o && !ref_inc(toRef(o))) { lovrThrow("Refcount overflow in %s:%d", __FILE__, __LINE__); }
#define lovrRelease(T, o) if (o && !ref_dec(toRef(o))) lovr ## T ## Destroy(o), free(toRef(o));
#define _lovrRelease(o, f) if (o && !ref_dec(toRef(o))) f(o), free(toRef(o));

View File

@ -33,7 +33,7 @@
#define vec_push(v, val)\
( vec_expand_(vec_unpack_(v)) ? -1 :\
((v)->data[(v)->length++] = (val), 0), 0 )
((v)->data[(v)->length++] = (val), 0) )
#define vec_pop(v)\