mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 06:42:08 +00:00
addressed a few things pointed out by static analysis
* marking move assignments noexcept * using [[fallthrough]] consistently. * getting rid of alloca.
This commit is contained in:
parent
35e56d3f42
commit
f13ae3b706
9 changed files with 14 additions and 18 deletions
|
@ -193,7 +193,7 @@ void nsvgDelete(NSVGimage* image);
|
|||
#include <math.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push);
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
|
||||
|
@ -3099,7 +3099,7 @@ void nsvgDelete(NSVGimage* image)
|
|||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop);
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // NANOSVG_IMPLEMENTATION
|
||||
|
|
|
@ -819,11 +819,7 @@
|
|||
// [@CC_FALLTHROUGH{@]
|
||||
// \def ASMJIT_FALLTHROUGH
|
||||
// The code falls through annotation (switch / case).
|
||||
#if ASMJIT_CC_CLANG && __cplusplus >= 201103L
|
||||
# define ASMJIT_FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
# define ASMJIT_FALLTHROUGH (void)0
|
||||
#endif
|
||||
# define ASMJIT_FALLTHROUGH [[fallthrough]]
|
||||
// [@CC_FALLTHROUGH}@]
|
||||
|
||||
// [@CC_UNUSED{@]
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
FBitmap(const FBitmap &other) = delete; // disallow because in nearly all cases this creates an unwanted copy.
|
||||
|
||||
FBitmap(FBitmap &&other)
|
||||
FBitmap(FBitmap &&other) noexcept
|
||||
{
|
||||
data = other.data;
|
||||
Pitch = other.Pitch;
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
FBitmap &operator=(const FBitmap &other) = delete; // disallow because in nearly all cases this creates an unwanted copy. Use Copy instead.
|
||||
|
||||
FBitmap &operator=(FBitmap &&other)
|
||||
FBitmap &operator=(FBitmap &&other) noexcept
|
||||
{
|
||||
if (data != nullptr && FreeBuffer) delete[] data;
|
||||
data = other.data;
|
||||
|
|
|
@ -217,7 +217,7 @@ FString &FString::operator = (const FString &other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
FString &FString::operator = (FString &&other)
|
||||
FString &FString::operator = (FString &&other) noexcept
|
||||
{
|
||||
assert (Chars != NULL);
|
||||
|
||||
|
|
|
@ -1182,8 +1182,8 @@ bool MapLoader::LoadNodes (MapData * map)
|
|||
|
||||
auto &nodes = Level->nodes;
|
||||
nodes.Alloc(numnodes);
|
||||
used = (uint16_t *)alloca (sizeof(uint16_t)*numnodes);
|
||||
memset (used, 0, sizeof(uint16_t)*numnodes);
|
||||
TArray<uint16_t> used(numnodes, true);
|
||||
memset (used.data(), 0, sizeof(uint16_t) * numnodes);
|
||||
|
||||
auto mnp = map->Read(ML_NODES);
|
||||
mn = (nodetype*)(mnp.Data() + nodetype::NF_LUMPOFFSET);
|
||||
|
|
|
@ -155,7 +155,7 @@ void DFloor::Tick ()
|
|||
case genFloorChgT:
|
||||
case genFloorChg0:
|
||||
m_Sector->SetSpecial(&m_NewSpecial);
|
||||
//fall thru
|
||||
[[fallthrough]];
|
||||
case genFloorChg:
|
||||
m_Sector->SetTexture(sector_t::floor, m_Texture);
|
||||
break;
|
||||
|
@ -171,7 +171,7 @@ void DFloor::Tick ()
|
|||
case genFloorChgT:
|
||||
case genFloorChg0:
|
||||
m_Sector->SetSpecial(&m_NewSpecial);
|
||||
//fall thru
|
||||
[[fallthrough]];
|
||||
case genFloorChg:
|
||||
m_Sector->SetTexture(sector_t::floor, m_Texture);
|
||||
break;
|
||||
|
|
|
@ -400,7 +400,7 @@ static void GroupLinePortals(FLevelLocals *Level)
|
|||
|
||||
for (unsigned i = 0; i < Level->linePortals.Size(); i++)
|
||||
{
|
||||
auto port = Level->linePortals[i];
|
||||
const auto& port = Level->linePortals[i];
|
||||
bool gotsome;
|
||||
|
||||
if (tempindex[i] == -1)
|
||||
|
|
|
@ -44,7 +44,7 @@ void WarpBuffer(TYPE *Pixels, const TYPE *source, int width, int height, int xmu
|
|||
|
||||
if (warptype == 1)
|
||||
{
|
||||
TYPE *buffer = (TYPE *)alloca(sizeof(TYPE) * max(width, height));
|
||||
TArray<TYPE> buffer(max(width, height), true);
|
||||
// [mxd] Rewrote to fix animation for NPo2 textures
|
||||
unsigned timebase = unsigned(time * Speed * 32 / 28);
|
||||
for (y = height - 1; y >= 0; y--)
|
||||
|
|
|
@ -373,8 +373,8 @@ namespace swrenderer
|
|||
if ((abs(globalposz - dasprz) >> 10) >= abs(dazscale)) return;
|
||||
|
||||
x = 0; y = 0; j = max(mip->SizeX, mip->SizeY);
|
||||
fixed_t *ggxinc = (fixed_t *)alloca((j + 1) * sizeof(fixed_t) * 2);
|
||||
fixed_t *ggyinc = ggxinc + (j + 1);
|
||||
TArray<fixed_t> ggxinc((j + 1) * 2);
|
||||
fixed_t *ggyinc = ggxinc.data() + (j + 1);
|
||||
for (i = 0; i <= j; i++)
|
||||
{
|
||||
ggxinc[i] = x; x += gxinc;
|
||||
|
|
Loading…
Reference in a new issue