diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-11 09:27:53 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-11 09:27:53 +0200 |
commit | 6d9d220d64cc87a9b2f59292eafafe6834dfdfc3 (patch) | |
tree | a6b4eaa695178a808b10e81b6c9b4b7fe54f68eb | |
parent | 422c3989628e4d60046385865674eca633d65be7 (diff) | |
parent | fe56c1ff757d34747e6db07917b707534f09fe3a (diff) |
Merge pull request #67224 from Mickeon/jason
Use `JSON::stringify` where possible
-rw-r--r-- | core/variant/variant.cpp | 3 | ||||
-rw-r--r-- | editor/debugger/debug_adapter/debug_adapter_protocol.cpp | 2 | ||||
-rw-r--r-- | editor/editor_build_profile.cpp | 3 | ||||
-rw-r--r-- | modules/mono/class_db_api_json.cpp | 3 | ||||
-rw-r--r-- | platform/android/export/export_plugin.cpp | 3 |
5 files changed, 5 insertions, 9 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index c14df58281..b4528e67d1 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1853,8 +1853,7 @@ String Variant::stringify(int recursion_count) const { } String Variant::to_json_string() const { - JSON json; - return json.stringify(*this); + return JSON::stringify(*this); } Variant::operator Vector2() const { diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp index 809c0c2cff..ae8752eb6d 100644 --- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp @@ -656,7 +656,7 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { bool DebugAdapterProtocol::process_message(const String &p_text) { JSON json; - ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Mal-formed message!"); + ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Malformed message!"); Dictionary params = json.get_data(); bool completed = true; diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp index 0f0ab4a339..7fd27692b0 100644 --- a/editor/editor_build_profile.cpp +++ b/editor/editor_build_profile.cpp @@ -255,8 +255,7 @@ Error EditorBuildProfile::save_to_file(const String &p_path) { Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE); ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_CREATE, "Cannot create file '" + p_path + "'."); - JSON json; - String text = json.stringify(data, "\t"); + String text = JSON::stringify(data, "\t"); f->store_string(text); return OK; } diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp index c4547b4323..1f4b085bfb 100644 --- a/modules/mono/class_db_api_json.cpp +++ b/modules/mono/class_db_api_json.cpp @@ -227,8 +227,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { Ref<FileAccess> f = FileAccess::open(p_output_file, FileAccess::WRITE); ERR_FAIL_COND_MSG(f.is_null(), "Cannot open file '" + p_output_file + "'."); - JSON json; - f->store_string(json.stringify(classes_dict, "\t")); + f->store_string(JSON::stringify(classes_dict, "\t")); print_line(String() + "ClassDB API JSON written to: " + ProjectSettings::get_singleton()->globalize_path(p_output_file)); } diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 366bd1c48c..ef3b79b630 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -2639,8 +2639,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP } if (user_data.libs.size() > 0) { Ref<FileAccess> fa = FileAccess::open(GDNATIVE_LIBS_PATH, FileAccess::WRITE); - JSON json; - fa->store_string(json.stringify(user_data.libs, "\t")); + fa->store_string(JSON::stringify(user_data.libs, "\t")); } } else { print_verbose("Saving apk expansion file.."); |