From d18b2e599d838201ecf14822d5823269859897da Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Mon, 11 Nov 2019 10:24:04 +0100 Subject: [PATCH] Remove all uses of ERR_EXPLAIN macros. --- core/os/memory.cpp | 9 +++------ drivers/png/png_driver_common.cpp | 9 ++++----- .../plugins/version_control_editor_plugin.cpp | 19 ++++--------------- .../assimp/editor_scene_importer_assimp.cpp | 5 +++-- modules/assimp/import_utils.h | 3 +-- .../language_server/gdscript_workspace.cpp | 3 +-- modules/xatlas_unwrap/register_types.cpp | 3 +-- 7 files changed, 17 insertions(+), 34 deletions(-) diff --git a/core/os/memory.cpp b/core/os/memory.cpp index d1de51f3dbd7..f4ed1d6e2729 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -50,20 +50,17 @@ void *operator new(size_t p_size, void *(*p_allocfunc)(size_t p_size)) { #ifdef _MSC_VER void operator delete(void *p_mem, const char *p_description) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } void operator delete(void *p_mem, void *(*p_allocfunc)(size_t p_size)) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } void operator delete(void *p_mem, void *p_pointer, size_t check, const char *p_description) { - ERR_EXPLAINC("Call to placement delete should not happen."); - CRASH_NOW(); + CRASH_NOW_MSG("Call to placement delete should not happen."); } #endif diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index 7deac1d118f1..46e45d07d34d 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -43,7 +43,6 @@ namespace PNGDriverCommon { static bool check_error(const png_image &image) { const png_uint_32 failed = PNG_IMAGE_FAILED(image); if (failed & PNG_IMAGE_ERROR) { - ERR_EXPLAINC(image.message); return true; } else if (failed) { #ifdef TOOLS_ENABLED @@ -67,7 +66,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref p_image) { // fetch image properties int success = png_image_begin_read_from_memory(&png_img, p_source, p_size); - ERR_FAIL_COND_V(check_error(png_img), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); // flags to be masked out of input format to give target format @@ -112,7 +111,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref p_image) { // read image data to buffer and release libpng resources success = png_image_finish_read(&png_img, NULL, writer.ptr(), stride, NULL); - ERR_FAIL_COND_V(check_error(png_img), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); p_image->create(png_img.width, png_img.height, 0, dest_format, buffer); @@ -176,7 +175,7 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { PoolVector::Write writer = p_buffer.write(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], &compressed_size, 0, reader.ptr(), 0, NULL); - ERR_FAIL_COND_V(check_error(png_img), FAILED); + ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); } if (!success) { @@ -190,7 +189,7 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { PoolVector::Write writer = p_buffer.write(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], &compressed_size, 0, reader.ptr(), 0, NULL); - ERR_FAIL_COND_V(check_error(png_img), FAILED); + ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); ERR_FAIL_COND_V(!success, FAILED); } diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 66b16b82a02b..783797ada4df 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -106,29 +106,20 @@ void VersionControlEditorPlugin::_initialize_vcs() { register_editor(); - if (EditorVCSInterface::get_singleton()) { - - ERR_EXPLAIN(EditorVCSInterface::get_singleton()->get_vcs_name() + " is already active"); - return; - } + ERR_FAIL_COND_MSG(EditorVCSInterface::get_singleton(), EditorVCSInterface::get_singleton()->get_vcs_name() + " is already active"); const int id = set_up_choice->get_selected_id(); String selected_addon = set_up_choice->get_item_text(id); String path = ScriptServer::get_global_class_path(selected_addon); Ref