You've already forked godot
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:
@@ -805,7 +805,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||
Vector2 coord((int)(mb->get_position().x / (spacing + size.x)), (int)(mb->get_position().y / (spacing + size.y)));
|
||||
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
|
||||
pos = mb->get_position() - pos;
|
||||
uint16_t bit;
|
||||
uint16_t bit = 0;
|
||||
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
|
||||
if (pos.x < size.x / 2) {
|
||||
if (pos.y < size.y / 2) {
|
||||
@@ -868,7 +868,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||
Vector2 coord((int)(mm->get_position().x / (spacing + size.x)), (int)(mm->get_position().y / (spacing + size.y)));
|
||||
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
|
||||
pos = mm->get_position() - pos;
|
||||
uint16_t bit;
|
||||
uint16_t bit = 0;
|
||||
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
|
||||
if (pos.x < size.x / 2) {
|
||||
if (pos.y < size.y / 2) {
|
||||
@@ -1146,7 +1146,7 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
|
||||
case EDITMODE_COLLISION: {
|
||||
if (!edited_collision_shape.is_null()) {
|
||||
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(get_current_tile());
|
||||
int index;
|
||||
int index = -1;
|
||||
for (int i = 0; i < sd.size(); i++) {
|
||||
if (sd[i].shape == edited_collision_shape) {
|
||||
index = i;
|
||||
|
||||
Reference in New Issue
Block a user