1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fix Coverity reports of uninitialized scalar variable

Fixes most current reports on Coverity Scan of uninitialized scalar
variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html

These happen most of the time (in our code) when instanciating structs
without a constructor (or with an incomplete one), and later returning
the instance. This is sometimes intended though, as some parameters are
only used in some situations and should not be double-initialized for
performance reasons (e.g. `constant` in ShaderLanguage::Token).
This commit is contained in:
Rémi Verschelde
2018-04-19 13:04:41 +02:00
parent 394e6d5ee1
commit bf7ca623a6
21 changed files with 48 additions and 66 deletions

View File

@@ -125,12 +125,11 @@ class TileMapEditor : public VBoxContainer {
bool yf;
bool tr;
CellOp() {
idx = -1;
xf = false;
yf = false;
tr = false;
}
CellOp() :
idx(TileMap::INVALID_CELL),
xf(false),
yf(false),
tr(false) {}
};
Map<Point2i, CellOp> paint_undo;
@@ -141,8 +140,12 @@ class TileMapEditor : public VBoxContainer {
bool flip_h;
bool flip_v;
bool transpose;
int auto_x;
int auto_y;
TileData() :
cell(TileMap::INVALID_CELL),
flip_h(false),
flip_v(false),
transpose(false) {}
};
List<TileData> copydata;