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