diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/etc/texture_loader_pkm.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 | ||||
-rw-r--r-- | modules/hdr/image_loader_hdr.cpp | 9 | ||||
-rw-r--r-- | modules/webp/image_loader_webp.cpp | 7 | ||||
-rw-r--r-- | modules/websocket/wsl_client.cpp | 26 | ||||
-rw-r--r-- | modules/websocket/wsl_server.cpp | 25 | ||||
-rw-r--r-- | modules/xatlas_unwrap/register_types.cpp | 3 |
8 files changed, 34 insertions, 44 deletions
diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index 3337460dfc..dd61d816d4 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -62,10 +62,8 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, f->set_endian_swap(true); ETC1Header h; - ERR_EXPLAIN("Invalid or Unsupported PKM texture file: " + p_path); f->get_buffer((uint8_t *)&h.tag, sizeof(h.tag)); - if (strncmp(h.tag, "PKM 10", sizeof(h.tag))) - ERR_FAIL_V(RES()); + ERR_FAIL_COND_V_MSG(strncmp(h.tag, "PKM 10", sizeof(h.tag)), RES(), "Invalid or unsupported PKM texture file: " + p_path + "."); h.format = f->get_16(); h.texWidth = f->get_16(); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 9f65a9fff1..7c01e85ff7 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -634,7 +634,7 @@ static GDScriptCompletionIdentifier _type_from_gdtype(const GDScriptDataType &p_ switch (p_gdtype.kind) { case GDScriptDataType::UNINITIALIZED: { - ERR_EXPLAIN("Uninitialized completion. Please report a bug."); + ERR_PRINT("Uninitialized completion. Please report a bug."); } break; case GDScriptDataType::BUILTIN: { ci.type.kind = GDScriptParser::DataType::BUILTIN; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 9a25e788c7..764f57aaa1 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -5761,7 +5761,7 @@ GDScriptParser::DataType GDScriptParser::_type_from_gdtype(const GDScriptDataTyp switch (p_gdtype.kind) { case GDScriptDataType::UNINITIALIZED: { - ERR_EXPLAIN("Uninitialized datatype. Please report a bug."); + ERR_PRINT("Uninitialized datatype. Please report a bug."); } break; case GDScriptDataType::BUILTIN: { result.kind = DataType::BUILTIN; diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp index e610619b54..1abf26bfee 100644 --- a/modules/hdr/image_loader_hdr.cpp +++ b/modules/hdr/image_loader_hdr.cpp @@ -37,7 +37,7 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force String header = f->get_token(); - ERR_FAIL_COND_V(header != "#?RADIANCE" && header != "#?RGBE", ERR_FILE_UNRECOGNIZED); + ERR_FAIL_COND_V_MSG(header != "#?RADIANCE" && header != "#?RGBE", ERR_FILE_UNRECOGNIZED, "Unsupported header information in HDR: " + header + "."); while (true) { String line = f->get_line(); @@ -45,12 +45,9 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force if (line == "") // empty line indicates end of header break; if (line.begins_with("FORMAT=")) { // leave option to implement other commands - if (line != "FORMAT=32-bit_rle_rgbe") { - ERR_EXPLAIN("Only 32-bit_rle_rgbe is supported for HDR files."); - return ERR_FILE_UNRECOGNIZED; - } + ERR_FAIL_COND_V_MSG(line != "FORMAT=32-bit_rle_rgbe", ERR_FILE_UNRECOGNIZED, "Only 32-bit_rle_rgbe is supported for HDR files."); } else if (!line.begins_with("#")) { // not comment - WARN_PRINTS("Ignoring unsupported header information in HDR : " + line); + WARN_PRINTS("Ignoring unsupported header information in HDR: " + line + "."); } } diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 8986e49cf0..d1bfa20842 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -106,8 +106,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { errdec = WebPDecodeRGBInto(&r[4], size, dst_w.ptr(), datasize, 3 * features.width) == NULL; } - //ERR_EXPLAIN("Error decoding webp! - "+p_file); - ERR_FAIL_COND_V(errdec, Ref<Image>()); + ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image."); dst_w.release(); @@ -121,7 +120,6 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p WebPBitstreamFeatures features; if (WebPGetFeatures(p_buffer, p_buffer_len, &features) != VP8_STATUS_OK) { - // ERR_EXPLAIN("Error decoding WEBP image"); ERR_FAIL_V(ERR_FILE_CORRUPT); } @@ -138,8 +136,7 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p } dst_w.release(); - //ERR_EXPLAIN("Error decoding webp!"); - ERR_FAIL_COND_V(errdec, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V_MSG(errdec, ERR_FILE_CORRUPT, "Failed decoding WebP image."); p_image->create(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image); diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp index cf2ad55b4a..0006a057e0 100644 --- a/modules/websocket/wsl_client.cpp +++ b/modules/websocket/wsl_client.cpp @@ -121,17 +121,17 @@ bool WSLClient::_verify_headers(String &r_protocol) { headers[name] = value; } -#define _WLS_EXPLAIN(NAME, VALUE) \ - ERR_EXPLAIN("Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'"); -#define _WLS_CHECK(NAME, VALUE) \ - _WLS_EXPLAIN(NAME, VALUE); \ - ERR_FAIL_COND_V(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false); -#define _WLS_CHECK_NC(NAME, VALUE) \ - _WLS_EXPLAIN(NAME, VALUE); \ - ERR_FAIL_COND_V(!headers.has(NAME) || headers[NAME] != VALUE, false); - _WLS_CHECK("connection", "upgrade"); - _WLS_CHECK("upgrade", "websocket"); - _WLS_CHECK_NC("sec-websocket-accept", WSLPeer::compute_key_response(_key)); +#define _WSL_CHECK(NAME, VALUE) \ + ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \ + "Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'."); +#define _WSL_CHECK_NC(NAME, VALUE) \ + ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME] != VALUE, false, \ + "Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'."); + _WSL_CHECK("connection", "upgrade"); + _WSL_CHECK("upgrade", "websocket"); + _WSL_CHECK_NC("sec-websocket-accept", WSLPeer::compute_key_response(_key)); +#undef _WSL_CHECK_NC +#undef _WSL_CHECK if (_protocols.size() == 0) { // We didn't request a custom protocol ERR_FAIL_COND_V(headers.has("sec-websocket-protocol"), false); @@ -148,10 +148,6 @@ bool WSLClient::_verify_headers(String &r_protocol) { if (!valid) return false; } -#undef _WLS_CHECK_NC -#undef _WLS_CHECK -#undef _WLS_EXPLAIN - return true; } diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp index 1feae420b9..efb526eed1 100644 --- a/modules/websocket/wsl_server.cpp +++ b/modules/websocket/wsl_server.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* lws_server.cpp */ +/* wsl_server.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -64,18 +64,17 @@ bool WSLServer::PendingPeer::_parse_request(const PoolStringArray p_protocols) { else headers[name] = value; } -#define _WLS_CHECK(NAME, VALUE) \ - ERR_EXPLAIN("Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'"); \ - ERR_FAIL_COND_V(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false); -#define _WLS_CHECK_EX(NAME) \ - ERR_EXPLAIN("Missing header '" + String(NAME) + "'."); \ - ERR_FAIL_COND_V(!headers.has(NAME), false); - _WLS_CHECK("upgrade", "websocket"); - _WLS_CHECK("sec-websocket-version", "13"); - _WLS_CHECK_EX("sec-websocket-key"); - _WLS_CHECK_EX("connection"); -#undef _WLS_CHECK_EX -#undef _WLS_CHECK +#define _WSL_CHECK(NAME, VALUE) \ + ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \ + "Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'."); +#define _WSL_CHECK_EX(NAME) \ + ERR_FAIL_COND_V_MSG(!headers.has(NAME), false, "Missing header '" + String(NAME) + "'."); + _WSL_CHECK("upgrade", "websocket"); + _WSL_CHECK("sec-websocket-version", "13"); + _WSL_CHECK_EX("sec-websocket-key"); + _WSL_CHECK_EX("connection"); +#undef _WSL_CHECK_EX +#undef _WSL_CHECK key = headers["sec-websocket-key"]; if (headers.has("sec-websocket-protocol")) { Vector<String> protos = headers["sec-websocket-protocol"].split(","); diff --git a/modules/xatlas_unwrap/register_types.cpp b/modules/xatlas_unwrap/register_types.cpp index c18aa04336..04911301ff 100644 --- a/modules/xatlas_unwrap/register_types.cpp +++ b/modules/xatlas_unwrap/register_types.cpp @@ -29,11 +29,14 @@ /*************************************************************************/ #include "register_types.h" + #include "core/error_macros.h" + #include "thirdparty/xatlas/xatlas.h" #include <stdio.h> #include <stdlib.h> + extern bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y); bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) { |