some crap from asan

This commit is contained in:
Alug committed 2024-07-03 13:02:16 +02:00
1 parent 7f4a2f9943
commit eac5310f5e
7 files changed
+19 -10

No files matched your search

+4
View File
@@ -524,6 +524,10 @@ INT32 I_GetKey(void);
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef CLAMP
#define CLAMP(x, min_val, max_val) ((x) < (min_val) ? (min_val) : ((x) > (max_val) ? (max_val) : (x)))
#endif
#ifndef M_PIl
#define M_PIl 3.1415926535897932384626433832795029L
#endif
-4
View File
@@ -55,8 +55,6 @@
#define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel)
#define CLAMP(x, min_val, max_val) ((x) < (min_val) ? (min_val) : ((x) > (max_val) ? (max_val) : (x)))
// ==========================================================================
// the hardware driver object
// ==========================================================================
@@ -6125,6 +6123,4 @@ void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
}
#undef CLAMP
#endif // HWRENDER
+2 -3
View File
@@ -9556,11 +9556,10 @@ static void K_drawDriftGauge(void)
if (driftcharge >= driftval*4) // rainbow sparks
{
int index = CLAMP((leveltime % 18) + 1, 0, 18 - 1);
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
for (i = 0; i < 4; i++)
{
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[(leveltime % 18) + 1] + i*2) | V_NOSCALESTART|drifttrans);
}
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[index] + i*2) | V_NOSCALESTART|drifttrans);
}
else // none/blue/red
{
+5 -1
View File
@@ -453,9 +453,11 @@ static int lib_cvRegisterVar(lua_State *L)
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0"))))
{
char *temp = NULL;
if (!category)
{
char *temp = strdup(wadfiles[numwadfiles - 1]->filename);
temp = strdup(wadfiles[numwadfiles - 1]->filename);
nameonly(temp);
category = temp;
@@ -465,6 +467,8 @@ static int lib_cvRegisterVar(lua_State *L)
M_SlotCvarIntoModMenu(cvar, category, menu_name);
else
M_SlotCvarIntoModMenu(cvar, category, cvar->name);
free (temp);
}
// return cvar userdata
+5 -1
View File
@@ -40,13 +40,17 @@ void R_DrawColumn_8(void)
#endif
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
dest = &topleft[dc_yl*vid.width + dc_x];
count++;
// Determine scaling, which is the only mapping to be done.
fracstep = dc_iscale;
frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep);
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
+2 -1
View File
@@ -1374,7 +1374,8 @@ static void R_RenderSegLoop (void)
//SoM: Calculate offsets for Thick fake floors.
// calculate texture offset
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle),rw_distance);
// Mask 4095 to guarantee this index is within bounds
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095),rw_distance);
if (oldtexturecolumn != -1) {
rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn);
+1
View File
@@ -1115,6 +1115,7 @@ boolean I_LoadSong(char *data, size_t len)
if (!gme_open_data(inflatedData, inflatedLen, &gme, SAMPLERATE))
{
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
inflateEnd(&stream);
return true;
}
}