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

@ -469,18 +469,18 @@ void EditorNode::_fs_changed() {
preset.unref();
}
if (preset.is_null()) {
String err = "Unknown export preset: " + export_defer.preset;
ERR_PRINTS(err);
String errstr = "Unknown export preset: " + export_defer.preset;
ERR_PRINTS(errstr);
} else {
Ref<EditorExportPlatform> platform = preset->get_platform();
if (platform.is_null()) {
String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
ERR_PRINTS(err);
String errstr = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
ERR_PRINTS(errstr);
} else {
// ensures export_project does not loop infinitely, because notifications may
// come during the export
export_defer.preset = "";
Error err;
Error err = OK;
if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
if (export_defer.path.ends_with(".zip")) {
err = platform->save_zip(preset, export_defer.path);