summaryrefslogtreecommitdiff
path: root/editor/export
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-09-29 12:53:28 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-10-07 11:32:33 +0300
commit0103af1ddda6a2aa31227965141dd7d3a513e081 (patch)
treeb0965bb65919bc1495ee02204a91e5ed3a9b56a7 /editor/export
parent5b7f62af55b7f322192f95258d825b163cbf9dc1 (diff)
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
Diffstat (limited to 'editor/export')
-rw-r--r--editor/export/export_template_manager.cpp30
-rw-r--r--editor/export/project_export.cpp26
2 files changed, 28 insertions, 28 deletions
diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp
index ceb5b63293..9ebf4d795a 100644
--- a/editor/export/export_template_manager.cpp
+++ b/editor/export/export_template_manager.cpp
@@ -265,9 +265,9 @@ void ExportTemplateManager::_refresh_mirrors_completed(int p_status, int p_code,
mirrors_available = false;
- Dictionary data = json.get_data();
- if (data.has("mirrors")) {
- Array mirrors = data["mirrors"];
+ Dictionary mirror_data = json.get_data();
+ if (mirror_data.has("mirrors")) {
+ Array mirrors = mirror_data["mirrors"];
for (int i = 0; i < mirrors.size(); i++) {
Dictionary m = mirrors[i];
@@ -401,17 +401,17 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
String file = String::utf8(fname);
if (file.ends_with("version.txt")) {
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
+ Vector<uint8_t> uncomp_data;
+ uncomp_data.resize(info.uncompressed_size);
// Read.
unzOpenCurrentFile(pkg);
- ret = unzReadCurrentFile(pkg, data.ptrw(), data.size());
+ ret = unzReadCurrentFile(pkg, uncomp_data.ptrw(), uncomp_data.size());
ERR_BREAK_MSG(ret < 0, vformat("An error occurred while attempting to read from file: %s. This file will not be used.", file));
unzCloseCurrentFile(pkg);
String data_str;
- data_str.parse_utf8((const char *)data.ptr(), data.size());
+ data_str.parse_utf8((const char *)uncomp_data.ptr(), uncomp_data.size());
data_str = data_str.strip_edges();
// Version number should be of the form major.minor[.patch].status[.module_config]
@@ -473,12 +473,12 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
continue;
}
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
+ Vector<uint8_t> uncomp_data;
+ uncomp_data.resize(info.uncompressed_size);
// Read
unzOpenCurrentFile(pkg);
- ret = unzReadCurrentFile(pkg, data.ptrw(), data.size());
+ ret = unzReadCurrentFile(pkg, uncomp_data.ptrw(), uncomp_data.size());
ERR_BREAK_MSG(ret < 0, vformat("An error occurred while attempting to read from file: %s. This file will not be used.", file));
unzCloseCurrentFile(pkg);
@@ -512,7 +512,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
ERR_CONTINUE_MSG(true, "Can't open file from path '" + String(to_write) + "'.");
}
- f->store_buffer(data.ptr(), data.size());
+ f->store_buffer(uncomp_data.ptr(), uncomp_data.size());
f.unref(); // close file.
#ifndef WINDOWS_ENABLED
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
@@ -714,12 +714,12 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_
String base_dir = path.get_base_dir();
if (!path.ends_with("/")) {
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
+ Vector<uint8_t> uncomp_data;
+ uncomp_data.resize(info.uncompressed_size);
// Read.
unzOpenCurrentFile(pkg);
- unzReadCurrentFile(pkg, data.ptrw(), data.size());
+ unzReadCurrentFile(pkg, uncomp_data.ptrw(), uncomp_data.size());
unzCloseCurrentFile(pkg);
if (!dirs_tested.has(base_dir)) {
@@ -730,7 +730,7 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_
String to_write = String("res://android/build").path_join(path);
Ref<FileAccess> f = FileAccess::open(to_write, FileAccess::WRITE);
if (f.is_valid()) {
- f->store_buffer(data.ptr(), data.size());
+ f->store_buffer(uncomp_data.ptr(), uncomp_data.size());
f.unref(); // close file.
#ifndef WINDOWS_ENABLED
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 43aac5e981..05a17c9951 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -94,7 +94,7 @@ void ProjectExportDialog::_add_preset(int p_platform) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_platform(p_platform)->create_preset();
ERR_FAIL_COND(!preset.is_valid());
- String name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name();
+ String preset_name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name();
bool make_runnable = true;
int attempt = 1;
while (true) {
@@ -105,7 +105,7 @@ void ProjectExportDialog::_add_preset(int p_platform) {
if (p->get_platform() == preset->get_platform() && p->is_runnable()) {
make_runnable = false;
}
- if (p->get_name() == name) {
+ if (p->get_name() == preset_name) {
valid = false;
break;
}
@@ -116,10 +116,10 @@ void ProjectExportDialog::_add_preset(int p_platform) {
}
attempt++;
- name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name() + " " + itos(attempt);
+ preset_name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name() + " " + itos(attempt);
}
- preset->set_name(name);
+ preset->set_name(preset_name);
if (make_runnable) {
preset->set_runnable(make_runnable);
}
@@ -154,12 +154,12 @@ void ProjectExportDialog::_update_presets() {
current_idx = i;
}
- String name = preset->get_name();
+ String preset_name = preset->get_name();
if (preset->is_runnable()) {
- name += " (" + TTR("Runnable") + ")";
+ preset_name += " (" + TTR("Runnable") + ")";
}
preset->update_files_to_export();
- presets->add_item(name, preset->get_platform()->get_logo());
+ presets->add_item(preset_name, preset->get_platform()->get_logo());
}
if (current_idx != -1) {
@@ -552,7 +552,7 @@ void ProjectExportDialog::_duplicate_preset() {
Ref<EditorExportPreset> preset = current->get_platform()->create_preset();
ERR_FAIL_COND(!preset.is_valid());
- String name = current->get_name() + " (copy)";
+ String preset_name = current->get_name() + " (copy)";
bool make_runnable = true;
while (true) {
bool valid = true;
@@ -562,7 +562,7 @@ void ProjectExportDialog::_duplicate_preset() {
if (p->get_platform() == preset->get_platform() && p->is_runnable()) {
make_runnable = false;
}
- if (p->get_name() == name) {
+ if (p->get_name() == preset_name) {
valid = false;
break;
}
@@ -572,10 +572,10 @@ void ProjectExportDialog::_duplicate_preset() {
break;
}
- name += " (copy)";
+ preset_name += " (copy)";
}
- preset->set_name(name);
+ preset->set_name(preset_name);
if (make_runnable) {
preset->set_runnable(make_runnable);
}
@@ -945,8 +945,8 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
}
void ProjectExportDialog::_export_all(bool p_debug) {
- String mode = p_debug ? TTR("Debug") : TTR("Release");
- EditorProgress ep("exportall", TTR("Exporting All") + " " + mode, EditorExport::get_singleton()->get_export_preset_count(), true);
+ String export_target = p_debug ? TTR("Debug") : TTR("Release");
+ EditorProgress ep("exportall", TTR("Exporting All") + " " + export_target, EditorExport::get_singleton()->get_export_preset_count(), true);
bool show_dialog = false;
result_dialog_log->clear();