From bda1d1e725de9b7a857bdb800e07b23c002a7097 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Tue, 18 Aug 2020 23:21:26 +0300 Subject: [PATCH] Convince the compiler that I know what I'm doing, I think --- src/hardware/hw_md2.c | 4 +++- src/hardware/r_opengl/r_opengl.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 05afff37f..5f5130896 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1410,7 +1410,9 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) // If so, uvs need to be readjusted. // Comparing floats with the != operator here should be okay because they // are just copies of glpatches' max_s and max_t values. - if (gpatch->max_s != md2->model->max_s || gpatch->max_t != md2->model->max_t) + // Instead of the != operator, memcmp is used to avoid a compiler warning. + if (memcmp(&(gpatch->max_s), &(md2->model->max_s), sizeof(md2->model->max_s)) != 0 || + memcmp(&(gpatch->max_t), &(md2->model->max_t), sizeof(md2->model->max_t)) != 0) adjustTextureCoords(md2->model, gpatch); HWR_GetMappedPatch(gpatch, spr->colormap); } diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 195f3d6f7..da86dc0fd 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2772,7 +2772,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32 // (Can happen when model uses a sprite as a texture and the sprite changes) // Comparing floats with the != operator here should be okay because they // are just copies of glpatches' max_s and max_t values. - if (model->vbo_max_s != model->max_s || model->vbo_max_t != model->max_t) + // Instead of the != operator, memcmp is used to avoid a compiler warning. + if (memcmp(&(model->vbo_max_s), &(model->max_s), sizeof(model->max_s)) != 0 || + memcmp(&(model->vbo_max_t), &(model->max_t), sizeof(model->max_t)) != 0) useVBO = false; pglEnableClientState(GL_NORMAL_ARRAY);