From 5acafa5a87e1a4411aa540a879f6814ec5baf5db Mon Sep 17 00:00:00 2001 From: filpAM Date: Sat, 16 May 2020 00:20:52 +0000 Subject: [PATCH 1/3] Fix visplane getting allocated twice --- src/r_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_plane.c b/src/r_plane.c index db5bfbda..659481ec 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -402,7 +402,7 @@ static visplane_t *new_visplane(unsigned hash) visplane_t *check = freetail; if (!check) { - check = calloc(2, sizeof (*check)); + check = calloc(1, sizeof (*check)); if (check == NULL) I_Error("%s: Out of memory", "new_visplane"); // FIXME: ugly } else From 290abe4fced997e47730318e2d3b87cc66db9a99 Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 20 May 2020 11:37:38 +0100 Subject: [PATCH 2/3] D_ModifierKeyResponder is unused now so remove it. --- src/d_main.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 5acfb610..85b363e0 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -187,35 +187,6 @@ UINT8 shiftdown = 0; // 0x1 left, 0x2 right UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right boolean capslock = 0; // gee i wonder what this does. -// -// D_ModifierKeyResponder -// Sets global shift/ctrl/alt variables, never actually eats events -// -static inline void D_ModifierKeyResponder(event_t *ev) -{ - if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1) - { - case KEY_LSHIFT: shiftdown |= 0x1; return; - case KEY_RSHIFT: shiftdown |= 0x2; return; - case KEY_LCTRL: ctrldown |= 0x1; return; - case KEY_RCTRL: ctrldown |= 0x2; return; - case KEY_LALT: altdown |= 0x1; return; - case KEY_RALT: altdown |= 0x2; return; - case KEY_CAPSLOCK: capslock = !capslock; return; - - default: return; - } - else if (ev->type == ev_keyup) switch (ev->data1) - { - case KEY_LSHIFT: shiftdown &= ~0x1; return; - case KEY_RSHIFT: shiftdown &= ~0x2; return; - case KEY_LCTRL: ctrldown &= ~0x1; return; - case KEY_RCTRL: ctrldown &= ~0x2; return; - case KEY_LALT: altdown &= ~0x1; return; - case KEY_RALT: altdown &= ~0x2; return; - default: return; - } -} // // D_ProcessEvents @@ -282,7 +253,7 @@ static void D_Display(void) { if (nodrawers) return; // for comparative timing/profiling - + // check for change of screen size (video mode) if (setmodeneeded && !wipe) SCR_SetMode(); // change video mode From 66930a0277919e75b95545e5cf24aa665769e80b Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 20 May 2020 11:47:22 +0100 Subject: [PATCH 3/3] Initialise these to 0 just to stop GCC 4.4 from complaining. This should be okay since 0 generally means "nothing" for these, and they should always be set before being used later on. --- src/hardware/r_opengl/r_opengl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 5dc46099..e0503ba0 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -823,7 +823,7 @@ EXPORT boolean HWRAPI(LoadShaders) (void) #ifdef GL_SHADERS GLuint gl_vertShader, gl_fragShader; GLint i, result; - + if (!pglUseProgram) return false; gl_customvertexshaders[0] = NULL; @@ -2002,11 +2002,11 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall boolean stopFlag = false; boolean changeState = false; boolean changeShader = false; - GLuint nextShader; + GLuint nextShader = 0U; boolean changeTexture = false; - GLuint nextTexture; + GLuint nextTexture = 0U; boolean changePolyFlags = false; - FBITFIELD nextPolyFlags; + FBITFIELD nextPolyFlags = 0U; boolean changeSurfaceInfo = false; FSurfaceInfo nextSurfaceInfo; @@ -2307,7 +2307,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI pglColor4ubv((GLubyte*)&pSurf->PolyColor.s); } - + // Tint color tint.red = byte2float[pSurf->TintColor.s.red]; tint.green = byte2float[pSurf->TintColor.s.green];