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

@ -194,8 +194,6 @@ void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_
Joypad js;
js.name = p_connected ? p_name : "";
js.uid = p_connected ? p_guid : "";
js.mapping = -1;
js.hat_current = 0;
if (p_connected) {
@ -797,12 +795,12 @@ InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
JoyEvent ret;
ret.type = -1;
ret.index = 0;
int i = 0;
while (buttons[i]) {
if (p_to == buttons[i]) {
//printf("mapping button %s\n", buttons[i]);
ret.type = TYPE_BUTTON;
ret.index = i;
ret.value = 0;