Fix more warnings;

This commit is contained in:
bjorn 2019-04-20 18:42:25 -07:00
parent 7af5b9816a
commit c021afedae
6 changed files with 7 additions and 8 deletions

View File

@ -41,7 +41,7 @@ void luax_readattachments(lua_State* L, int index, Attachment* attachments, int*
int top = table ? -1 : lua_gettop(L);
int n;
if (lua_istable(L, index)) {
if (table) {
n = luax_len(L, index);
n = MIN(n, 3 * MAX_CANVAS_ATTACHMENTS);
for (int i = 0; i < n; i++) {

View File

@ -177,7 +177,7 @@ static int l_lovrColliderSetMassData(lua_State* L) {
} else {
for (int i = 6; i < 12; i++) {
if (lua_isnumber(L, i)) {
inertia[i] = lua_tonumber(L, i);
inertia[i - 6] = lua_tonumber(L, i);
} else {
return luaL_argerror(L, i, "Expected 6 numbers or a table with 6 numbers");
}

View File

@ -120,7 +120,7 @@ ModelData* lovrModelDataInitGltf(ModelData* model, Blob* source) {
gltfHeader* header = (gltfHeader*) data;
bool glb = header->magic == MAGIC_glTF;
const char *json, *binData;
size_t jsonLength, binLength;
size_t jsonLength;
ptrdiff_t binOffset;
char filename[1024];
@ -142,13 +142,11 @@ ModelData* lovrModelDataInitGltf(ModelData* model, Blob* source) {
lovrAssert(binHeader->type == MAGIC_BIN, "Invalid BIN header");
binData = (char*) &binHeader[1];
binLength = binHeader->length;
binOffset = (char*) binData - (char*) source->data;
} else {
json = (char*) data;
jsonLength = source->size;
binData = NULL;
binLength = 0;
binOffset = 0;
}

View File

@ -1136,6 +1136,7 @@ void lovrGpuStencil(StencilAction action, int replaceValue, StencilCallback call
case STENCIL_INCREMENT_WRAP: glAction = GL_INCR_WRAP; break;
case STENCIL_DECREMENT_WRAP: glAction = GL_DECR_WRAP; break;
case STENCIL_INVERT: glAction = GL_INVERT; break;
default: lovrThrow("Unreachable");
}
glStencilFunc(GL_ALWAYS, replaceValue, 0xff);

View File

@ -98,8 +98,8 @@ bool lovrPlatformCreateWindow(WindowFlags* flags) {
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
uint32_t width = flags->width ? flags->width : mode->width;
uint32_t height = flags->height ? flags->height : mode->height;
uint32_t width = flags->width ? flags->width : (uint32_t) mode->width;
uint32_t height = flags->height ? flags->height : (uint32_t) mode->height;
if (flags->fullscreen) {
glfwWindowHint(GLFW_RED_BITS, mode->redBits);

View File

@ -30,7 +30,7 @@
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define CLAMP(x, min, max) MAX(min, MIN(max, x))
#define ALIGN(p, n) ((uintptr_t) p & -n)
#define ALIGN(p, n) ((uintptr_t) (p) & -n)
#ifndef M_PI
#define M_PI 3.14159265358979323846264f