summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-16 16:55:07 +0100
committerGitHub <noreply@github.com>2022-02-16 16:55:07 +0100
commit51a00c2855009ce4cd6475c09209ebd22641f448 (patch)
tree56b249dbe446b5e24946c16ee13bd8241a119de6 /modules
parent33c7f52f361961c64432cfd772909ed3ba76cd51 (diff)
parentb8b45804485f7ca18f035f1eeb7a1ac0cf591cac (diff)
Merge pull request #58182 from akien-mga/style-cleanup-if-semicolons-deadcode
Diffstat (limited to 'modules')
-rw-r--r--modules/basis_universal/register_types.cpp2
-rw-r--r--modules/basis_universal/texture_basisu.cpp218
-rw-r--r--modules/basis_universal/texture_basisu.h80
-rw-r--r--modules/bullet/slider_joint_bullet.cpp1
-rw-r--r--modules/fbx/fbx_parser/FBXMeshGeometry.cpp26
-rw-r--r--modules/mono/csharp_script.h3
-rw-r--r--modules/mono/editor/bindings_generator.cpp3
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp9
-rw-r--r--modules/mono/mono_gd/support/android_support.cpp89
-rw-r--r--modules/mono/mono_gd/support/ios_support.mm3
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp38
-rw-r--r--modules/mono/utils/path_utils.cpp9
-rw-r--r--modules/visual_script/visual_script.cpp2
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp4
-rw-r--r--modules/websocket/emws_client.cpp10
-rw-r--r--modules/websocket/emws_peer.cpp6
-rw-r--r--modules/webxr/webxr_interface_js.cpp3
17 files changed, 118 insertions, 388 deletions
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp
index 12f9c6fc00..a3c662ba08 100644
--- a/modules/basis_universal/register_types.cpp
+++ b/modules/basis_universal/register_types.cpp
@@ -32,7 +32,6 @@
#include "core/os/os.h"
#include "servers/rendering_server.h"
-#include "texture_basisu.h"
#ifdef TOOLS_ENABLED
#include <encoder/basisu_comp.h>
@@ -272,7 +271,6 @@ void register_basis_universal_types() {
Image::basis_universal_packer = basis_universal_packer;
#endif
Image::basis_universal_unpacker = basis_universal_unpacker;
- //GDREGISTER_CLASS(TextureBasisU);
}
void unregister_basis_universal_types() {
diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp
deleted file mode 100644
index 1ac4df8d19..0000000000
--- a/modules/basis_universal/texture_basisu.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*************************************************************************/
-/* texture_basisu.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "texture_basisu.h"
-#if 0
-#include "core/os/os.h"
-
-#ifdef TOOLS_ENABLED
-#include <encoder/basisu_comp.h>
-#endif
-
-#include <transcoder/basisu_transcoder.h>
-
-void TextureBasisU::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_basisu_data", "data"), &TextureBasisU::set_basisu_data);
- ClassDB::bind_method(D_METHOD("get_basisu_data"), &TextureBasisU::get_data);
- ClassDB::bind_method(D_METHOD("import"), &TextureBasisU::import);
-
- ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "basisu_data"), "set_basisu_data", "get_basisu_data");
-};
-
-int TextureBasisU::get_width() const {
- return tex_size.x;
-};
-
-int TextureBasisU::get_height() const {
- return tex_size.y;
-};
-
-RID TextureBasisU::get_rid() const {
- return texture;
-};
-
-
-bool TextureBasisU::has_alpha() const {
- return false;
-};
-
-void TextureBasisU::set_flags(uint32_t p_flags) {
- flags = p_flags;
- RenderingServer::get_singleton()->texture_set_flags(texture, p_flags);
-};
-
-uint32_t TextureBasisU::get_flags() const {
- return flags;
-};
-
-
-void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) {
-
-#ifdef TOOLS_ENABLED
- data = p_data;
-#endif
-
- const uint8_t* r = p_data.ptr();
- const void* ptr = r.ptr();
- int size = p_data.size();
-
- basist::transcoder_texture_format format;
- Image::Format imgfmt;
-
- if (OS::get_singleton()->has_feature("s3tc")) {
- format = basist::cTFBC3; // get this from renderer
- imgfmt = Image::FORMAT_DXT5;
-
- } else if (OS::get_singleton()->has_feature("etc2")) {
- format = basist::cTFETC2;
- imgfmt = Image::FORMAT_ETC2_RGBA8;
- };
-
- basist::basisu_transcoder tr(nullptr);
-
- ERR_FAIL_COND(!tr.validate_header(ptr, size));
-
- basist::basisu_image_info info;
- tr.get_image_info(ptr, size, info, 0);
- tex_size = Size2(info.m_width, info.m_height);
-
- int block_size = basist::basis_get_bytes_per_block(format);
- Vector<uint8_t> gpudata;
- gpudata.resize(info.m_total_blocks * block_size);
-
- {
- uint8_t* w = gpudata.ptrw();
- uint8_t* dst = w.ptr();
- for (int i=0; i<gpudata.size(); i++)
- dst[i] = 0x00;
-
- int ofs = 0;
- tr.start_transcoding(ptr, size);
- for (int i=0; i<info.m_total_levels; i++) {
- basist::basisu_image_level_info level;
- tr.get_image_level_info(ptr, size, level, 0, i);
-
- bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format);
- if (!ret) {
- printf("failed! on level %i\n", i);
- break;
- };
-
- ofs += level.m_total_blocks * block_size;
- };
- };
-
- Ref<Image> img;
- img.instantiate();
- img->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
-
- RenderingServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), RS::TEXTURE_TYPE_2D, flags);
- RenderingServer::get_singleton()->texture_set_data(texture, img);
-};
-
-Error TextureBasisU::import(const Ref<Image>& p_img) {
-
-#ifdef TOOLS_ENABLED
-
- Vector<uint8_t> budata;
-
- {
- Image::Format format = p_img->get_format();
- if (format != Image::FORMAT_RGB8 && format != Image::FORMAT_RGBA8) {
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- return ERR_INVALID_PARAMETER;
- };
-
- Ref<Image> copy = p_img->duplicate();
- if (format == Image::FORMAT_RGB8)
- copy->convert(Image::FORMAT_RGBA8);
-
- basisu::image buimg(p_img->get_width(), p_img->get_height());
- int size = p_img->get_width() * p_img->get_height() * 4;
-
- Vector<uint8_t> vec = copy->get_data();
- {
- const uint8_t* r = vec.ptr();
- memcpy(buimg.get_ptr(), r.ptr(), size);
- };
-
- basisu::basis_compressor_params params;
- params.m_max_endpoint_clusters = 512;
- params.m_max_selector_clusters = 512;
- params.m_multithreading = true;
-
- basisu::job_pool jpool(1);
- params.m_pJob_pool = &jpool;
-
- params.m_mip_gen = p_img->get_mipmap_count() > 0;
- params.m_source_images.push_back(buimg);
-
- basisu::basis_compressor c;
- c.init(params);
-
- int buerr = c.process();
- if (buerr != basisu::basis_compressor::cECSuccess) {
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- return ERR_INVALID_PARAMETER;
- };
-
- const basisu::uint8_vec& buvec = c.get_output_basis_file();
- budata.resize(buvec.size());
-
- {
- uint8_t* w = budata.ptrw();
- memcpy(w.ptr(), &buvec[0], budata.size());
- };
- };
-
- set_basisu_data(budata);
-
- return OK;
-#else
-
- return ERR_UNAVAILABLE;
-#endif
-};
-
-
-Vector<uint8_t> TextureBasisU::get_basisu_data() const {
- return data;
-};
-
-TextureBasisU::TextureBasisU() {
- texture = RenderingServer::get_singleton()->texture_create();
-};
-
-
-TextureBasisU::~TextureBasisU() {
- RenderingServer::get_singleton()->free(texture);
-};
-
-#endif
diff --git a/modules/basis_universal/texture_basisu.h b/modules/basis_universal/texture_basisu.h
deleted file mode 100644
index 8c8be68254..0000000000
--- a/modules/basis_universal/texture_basisu.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************/
-/* texture_basisu.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef BASIS_UNIVERSAL_TEXTURE_BASISU_H
-#define BASIS_UNIVERSAL_TEXTURE_BASISU_H
-
-#include "scene/resources/texture.h"
-
-#ifdef TOOLS_ENABLED
-#include <encoder/basisu_comp.h>
-#endif
-
-#include <transcoder/basisu_transcoder.h>
-
-#if 0
-class TextureBasisU : public Texture {
- GDCLASS(TextureBasisU, Texture);
- RES_BASE_EXTENSION("butex");
-
- RID texture;
- Size2 tex_size;
-
- uint32_t flags = FLAGS_DEFAULT;
-
- Vector<uint8_t> data;
-
- static void _bind_methods();
-
-public:
-
- virtual int get_width() const;
- virtual int get_height() const;
- virtual RID get_rid() const;
- virtual bool has_alpha() const;
-
- virtual void set_flags(uint32_t p_flags);
- virtual uint32_t get_flags() const;
-
-
- Error import(const Ref<Image> &p_img);
-
- void set_basisu_data(const Vector<uint8_t>& p_data);
-
- Vector<uint8_t> get_basisu_data() const;
- String get_img_path() const;
-
- TextureBasisU();
- ~TextureBasisU();
-};
-
-#endif
-
-#endif // BASIS_UNIVERSAL_TEXTURE_BASISU_H
diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp
index 61c3b3b0a3..b06cdeaa6a 100644
--- a/modules/bullet/slider_joint_bullet.cpp
+++ b/modules/bullet/slider_joint_bullet.cpp
@@ -334,7 +334,6 @@ real_t SliderJointBullet::getMaxAngMotorForce() {
real_t SliderJointBullet::getLinearPos() {
return sliderConstraint->getLinearPos();
- ;
}
void SliderJointBullet::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) {
diff --git a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
index b3956af762..591f2e5503 100644
--- a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
+++ b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp
@@ -212,32 +212,6 @@ MeshGeometry::MeshGeometry(uint64_t id, const ElementPtr element, const std::str
m_normals = resolve_vertex_data_array<Vector3>(layer_scope, MappingInformationType, ReferenceInformationType, "Normals");
} else if (layer_type_name == "LayerElementColor") {
m_colors = resolve_vertex_data_array<Color>(layer_scope, MappingInformationType, ReferenceInformationType, "Colors", "ColorIndex");
- // NOTE: this is a useful sanity check to ensure you're getting any color data which is not default.
- // const Color first_color_check = m_colors.data[0];
- // bool colors_are_all_the_same = true;
- // size_t i = 1;
- // for(i = 1; i < m_colors.data.size(); i++)
- // {
- // const Color current_color = m_colors.data[i];
- // if(current_color.is_equal_approx(first_color_check))
- // {
- // continue;
- // }
- // else
- // {
- // colors_are_all_the_same = false;
- // break;
- // }
- // }
- //
- // if(colors_are_all_the_same)
- // {
- // print_error("Color serialisation is not working for vertex colors some should be different in the test asset.");
- // }
- // else
- // {
- // print_verbose("Color array has unique colors at index: " + itos(i));
- // }
}
}
}
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 2de923c125..d6cd9e6e57 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -53,8 +53,9 @@ class CSharpLanguage;
#ifdef NO_SAFE_CAST
template <typename TScriptInstance, typename TScriptLanguage>
TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
- if (!p_inst)
+ if (!p_inst) {
return nullptr;
+ }
return p_inst->get_language() == TScriptLanguage::get_singleton() ? static_cast<TScriptInstance *>(p_inst) : nullptr;
}
#else
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index f345dff333..07128770b7 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -2149,8 +2149,9 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
}
output.append("#ifdef TOOLS_ENABLED\n");
- for (const InternalCall &internal_call : editor_custom_icalls)
+ for (const InternalCall &internal_call : editor_custom_icalls) {
ADD_INTERNAL_CALL_REGISTRATION(internal_call);
+ }
output.append("#endif // TOOLS_ENABLED\n");
for (const InternalCall &internal_call : method_icalls) {
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index a7269d7f87..4cd4772d2c 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -151,8 +151,9 @@ void gd_mono_debug_init() {
.utf8();
}
#else
- if (da_args.length() == 0)
+ if (da_args.length() == 0) {
return; // Exported games don't use the project settings to setup the debugger agent
+ }
#endif
// Debugging enabled
@@ -226,8 +227,9 @@ void GDMono::add_mono_shared_libs_dir_to_path() {
path_value += mono_reg_info.bin_dir;
}
#else
- if (DirAccess::exists(bundled_bin_dir))
+ if (DirAccess::exists(bundled_bin_dir)) {
path_value += bundled_bin_dir;
+ }
#endif // TOOLS_ENABLED
#else
@@ -1269,8 +1271,9 @@ GDMono::~GDMono() {
print_verbose("Mono: Finalizing scripts domain...");
- if (mono_domain_get() != root_domain)
+ if (mono_domain_get() != root_domain) {
mono_domain_set(root_domain, true);
+ }
finalizing_scripts_domain = true;
diff --git a/modules/mono/mono_gd/support/android_support.cpp b/modules/mono/mono_gd/support/android_support.cpp
index eb8bbab948..4797d5dae1 100644
--- a/modules/mono/mono_gd/support/android_support.cpp
+++ b/modules/mono/mono_gd/support/android_support.cpp
@@ -134,8 +134,9 @@ String determine_app_native_lib_dir() {
}
String get_app_native_lib_dir() {
- if (app_native_lib_dir_cache.is_empty())
+ if (app_native_lib_dir_cache.is_empty()) {
app_native_lib_dir_cache = determine_app_native_lib_dir();
+ }
return app_native_lib_dir_cache;
}
@@ -144,10 +145,11 @@ int gd_mono_convert_dl_flags(int flags) {
int lflags = flags & MONO_DL_LOCAL ? 0 : RTLD_GLOBAL;
- if (flags & MONO_DL_LAZY)
+ if (flags & MONO_DL_LAZY) {
lflags |= RTLD_LAZY;
- else
+ } else {
lflags |= RTLD_NOW;
+ }
return lflags;
}
@@ -164,8 +166,9 @@ void *godot_dl_handle = nullptr;
void *try_dlopen(const String &p_so_path, int p_flags) {
if (!FileAccess::exists(p_so_path)) {
- if (OS::get_singleton()->is_stdout_verbose())
+ if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Cannot find shared library: '%s'\n", p_so_path.utf8().get_data());
+ }
return nullptr;
}
@@ -174,13 +177,15 @@ void *try_dlopen(const String &p_so_path, int p_flags) {
void *handle = dlopen(p_so_path.utf8().get_data(), lflags);
if (!handle) {
- if (OS::get_singleton()->is_stdout_verbose())
+ if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Failed to open shared library: '%s'. Error: '%s'\n", p_so_path.utf8().get_data(), dlerror());
+ }
return nullptr;
}
- if (OS::get_singleton()->is_stdout_verbose())
+ if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Successfully loaded shared library: '%s'\n", p_so_path.utf8().get_data());
+ }
return handle;
}
@@ -217,20 +222,23 @@ void *gd_mono_android_dlopen(const char *p_name, int p_flags, char **r_err, void
void *gd_mono_android_dlsym(void *p_handle, const char *p_name, char **r_err, void *p_user_data) {
void *sym_addr = dlsym(p_handle, p_name);
- if (sym_addr)
+ if (sym_addr) {
return sym_addr;
+ }
if (p_handle == mono_dl_handle && godot_dl_handle) {
// Looking up for '__Internal' P/Invoke. We want to search in both the Mono and Godot shared libraries.
// This is needed to resolve the monodroid P/Invoke functions that are defined at the bottom of the file.
sym_addr = dlsym(godot_dl_handle, p_name);
- if (sym_addr)
+ if (sym_addr) {
return sym_addr;
+ }
}
- if (r_err)
+ if (r_err) {
*r_err = str_format_new("%s\n", dlerror());
+ }
return nullptr;
}
@@ -239,8 +247,9 @@ void *gd_mono_android_dlclose(void *p_handle, void *p_user_data) {
dlclose(p_handle);
// Not sure if this ever happens. Does Mono close the handle for the main module?
- if (p_handle == mono_dl_handle)
+ if (p_handle == mono_dl_handle) {
mono_dl_handle = nullptr;
+ }
return nullptr;
}
@@ -292,13 +301,15 @@ MonoBoolean _gd_mono_init_cert_store() {
ScopedLocalRef<jobject> certStoreLocal(env, env->CallStaticObjectMethod(keyStoreClass, getInstance, androidCAStoreString.get()));
- if (jni_exception_check(env))
+ if (jni_exception_check(env)) {
return 0;
+ }
env->CallVoidMethod(certStoreLocal, load, nullptr);
- if (jni_exception_check(env))
+ if (jni_exception_check(env)) {
return 0;
+ }
certStore = env->NewGlobalRef(certStoreLocal);
@@ -309,8 +320,9 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) {
// The JNI code is the equivalent of:
//
// Certificate certificate = certStore.getCertificate(alias);
- // if (certificate == null)
+ // if (certificate == null) {
// return null;
+ // }
// return certificate.getEncoded();
MonoError mono_error;
@@ -340,8 +352,9 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) {
ScopedLocalRef<jobject> certificate(env, env->CallObjectMethod(certStore, getCertificate, js_alias.get()));
- if (!certificate)
+ if (!certificate) {
return nullptr;
+ }
ScopedLocalRef<jbyteArray> encoded(env, (jbyteArray)env->CallObjectMethod(certificate, getEncoded));
jsize encodedLength = env->GetArrayLength(encoded);
@@ -374,11 +387,13 @@ void initialize() {
void cleanup() {
// This is called after shutting down the Mono runtime
- if (mono_dl_handle)
+ if (mono_dl_handle) {
gd_mono_android_dlclose(mono_dl_handle, nullptr);
+ }
- if (godot_dl_handle)
+ if (godot_dl_handle) {
gd_mono_android_dlclose(godot_dl_handle, nullptr);
+ }
JNIEnv *env = get_jni_env();
@@ -431,8 +446,9 @@ GD_PINVOKE_EXPORT mono_bool _monodroid_get_network_interface_up_state(const char
//
// NetworkInterface.getByName(p_ifname).isUp()
- if (!r_is_up || !p_ifname || strlen(p_ifname) == 0)
+ if (!r_is_up || !p_ifname || strlen(p_ifname) == 0) {
return 0;
+ }
*r_is_up = 0;
@@ -450,8 +466,9 @@ GD_PINVOKE_EXPORT mono_bool _monodroid_get_network_interface_up_state(const char
ScopedLocalRef<jstring> js_ifname(env, env->NewStringUTF(p_ifname));
ScopedLocalRef<jobject> networkInterface(env, env->CallStaticObjectMethod(networkInterfaceClass, getByName, js_ifname.get()));
- if (!networkInterface)
+ if (!networkInterface) {
return 0;
+ }
*r_is_up = (mono_bool)env->CallBooleanMethod(networkInterface, isUp);
@@ -463,8 +480,9 @@ GD_PINVOKE_EXPORT mono_bool _monodroid_get_network_interface_supports_multicast(
//
// NetworkInterface.getByName(p_ifname).supportsMulticast()
- if (!r_supports_multicast || !p_ifname || strlen(p_ifname) == 0)
+ if (!r_supports_multicast || !p_ifname || strlen(p_ifname) == 0) {
return 0;
+ }
*r_supports_multicast = 0;
@@ -482,8 +500,9 @@ GD_PINVOKE_EXPORT mono_bool _monodroid_get_network_interface_supports_multicast(
ScopedLocalRef<jstring> js_ifname(env, env->NewStringUTF(p_ifname));
ScopedLocalRef<jobject> networkInterface(env, env->CallStaticObjectMethod(networkInterfaceClass, getByName, js_ifname.get()));
- if (!networkInterface)
+ if (!networkInterface) {
return 0;
+ }
*r_supports_multicast = (mono_bool)env->CallBooleanMethod(networkInterface, supportsMulticast);
@@ -528,8 +547,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
ScopedLocalRef<jobject> connectivityManager(env, env->CallObjectMethod(applicationContext, getSystemService, connectivityServiceString.get()));
- if (!connectivityManager)
+ if (!connectivityManager) {
return;
+ }
ScopedLocalRef<jclass> connectivityManagerClass(env, env->FindClass("android/net/ConnectivityManager"));
ERR_FAIL_NULL(connectivityManagerClass);
@@ -539,8 +559,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
ScopedLocalRef<jobject> activeNetwork(env, env->CallObjectMethod(connectivityManager, getActiveNetwork));
- if (!activeNetwork)
+ if (!activeNetwork) {
return;
+ }
jmethodID getLinkProperties = env->GetMethodID(connectivityManagerClass,
"getLinkProperties", "(Landroid/net/Network;)Landroid/net/LinkProperties;");
@@ -548,8 +569,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
ScopedLocalRef<jobject> linkProperties(env, env->CallObjectMethod(connectivityManager, getLinkProperties, activeNetwork.get()));
- if (!linkProperties)
+ if (!linkProperties) {
return;
+ }
ScopedLocalRef<jclass> linkPropertiesClass(env, env->FindClass("android/net/LinkProperties"));
ERR_FAIL_NULL(linkPropertiesClass);
@@ -559,8 +581,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
ScopedLocalRef<jobject> dnsServers(env, env->CallObjectMethod(linkProperties, getDnsServers));
- if (!dnsServers)
+ if (!dnsServers) {
return;
+ }
ScopedLocalRef<jclass> listClass(env, env->FindClass("java/util/List"));
ERR_FAIL_NULL(listClass);
@@ -570,11 +593,13 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
int dnsServersCount = env->CallIntMethod(dnsServers, listSize);
- if (dnsServersCount > dns_servers_len)
+ if (dnsServersCount > dns_servers_len) {
dnsServersCount = dns_servers_len;
+ }
- if (dnsServersCount <= 0)
+ if (dnsServersCount <= 0) {
return;
+ }
jmethodID listGet = env->GetMethodID(listClass, "get", "(I)Ljava/lang/Object;");
ERR_FAIL_NULL(listGet);
@@ -587,8 +612,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
for (int i = 0; i < dnsServersCount; i++) {
ScopedLocalRef<jobject> dnsServer(env, env->CallObjectMethod(dnsServers, listGet, (jint)i));
- if (!dnsServer)
+ if (!dnsServer) {
continue;
+ }
ScopedLocalRef<jstring> hostAddress(env, (jstring)env->CallObjectMethod(dnsServer, getHostAddress));
const char *host_address = env->GetStringUTFChars(hostAddress, 0);
@@ -603,8 +629,9 @@ static void interop_get_active_network_dns_servers(char **r_dns_servers, int *dn
}
GD_PINVOKE_EXPORT int32_t _monodroid_get_dns_servers(void **r_dns_servers_array) {
- if (!r_dns_servers_array)
+ if (!r_dns_servers_array) {
return -1;
+ }
*r_dns_servers_array = nullptr;
@@ -661,13 +688,15 @@ GD_PINVOKE_EXPORT const char *_monodroid_timezone_get_default_id() {
ScopedLocalRef<jobject> defaultTimeZone(env, env->CallStaticObjectMethod(timeZoneClass, getDefault));
- if (!defaultTimeZone)
+ if (!defaultTimeZone) {
return nullptr;
+ }
ScopedLocalRef<jstring> defaultTimeZoneID(env, (jstring)env->CallObjectMethod(defaultTimeZone, getID));
- if (!defaultTimeZoneID)
+ if (!defaultTimeZoneID) {
return nullptr;
+ }
const char *default_time_zone_id = env->GetStringUTFChars(defaultTimeZoneID, 0);
diff --git a/modules/mono/mono_gd/support/ios_support.mm b/modules/mono/mono_gd/support/ios_support.mm
index e66b88db32..df97dfba49 100644
--- a/modules/mono/mono_gd/support/ios_support.mm
+++ b/modules/mono/mono_gd/support/ios_support.mm
@@ -94,8 +94,9 @@ GD_PINVOKE_EXPORT const char *xamarin_get_locale_country_code() {
GD_PINVOKE_EXPORT void xamarin_log(const uint16_t *p_unicode_message) {
int length = 0;
const uint16_t *ptr = p_unicode_message;
- while (*ptr++)
+ while (*ptr++) {
length += sizeof(uint16_t);
+ }
NSString *msg = [[NSString alloc] initWithBytes:p_unicode_message length:length encoding:NSUTF16LittleEndianStringEncoding];
os_log_info(OS_LOG_DEFAULT, "%{public}@", msg);
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index f388661207..8e37e6943c 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -60,8 +60,9 @@ REGSAM _get_bitness_sam() {
LONG _RegOpenKey(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult) {
LONG res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, phkResult);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ | _get_bitness_sam(), phkResult);
+ }
return res;
}
@@ -92,31 +93,37 @@ LONG _find_mono_in_reg(const String &p_subkey, MonoRegInfo &r_info, bool p_old_r
HKEY hKey;
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, (LPCWSTR)(p_subkey.utf16().get_data()), &hKey);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
if (!p_old_reg) {
res = _RegKeyQueryString(hKey, "Version", r_info.version);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
}
res = _RegKeyQueryString(hKey, "SdkInstallRoot", r_info.install_root_dir);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
res = _RegKeyQueryString(hKey, "FrameworkAssemblyDirectory", r_info.assembly_dir);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
res = _RegKeyQueryString(hKey, "MonoConfigDir", r_info.config_dir);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
- if (r_info.install_root_dir.ends_with("\\"))
+ if (r_info.install_root_dir.ends_with("\\")) {
r_info.bin_dir = r_info.install_root_dir + "bin";
- else
+ } else {
r_info.bin_dir = r_info.install_root_dir + "\\bin";
+ }
cleanup:
RegCloseKey(hKey);
@@ -129,8 +136,9 @@ LONG _find_mono_in_reg_old(const String &p_subkey, MonoRegInfo &r_info) {
HKEY hKey;
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, (LPCWSTR)(p_subkey.utf16().get_data()), &hKey);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
res = _RegKeyQueryString(hKey, "DefaultCLR", default_clr);
@@ -147,11 +155,13 @@ cleanup:
MonoRegInfo find_mono() {
MonoRegInfo info;
- if (_find_mono_in_reg("Software\\Mono", info) == ERROR_SUCCESS)
+ if (_find_mono_in_reg("Software\\Mono", info) == ERROR_SUCCESS) {
return info;
+ }
- if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS)
+ if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS) {
return info;
+ }
return MonoRegInfo();
}
@@ -212,13 +222,15 @@ String find_msbuild_tools_path() {
HKEY hKey;
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\14.0", &hKey);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
res = _RegKeyQueryString(hKey, "MSBuildToolsPath", msbuild_tools_path);
- if (res != ERROR_SUCCESS)
+ if (res != ERROR_SUCCESS) {
goto cleanup;
+ }
cleanup:
RegCloseKey(hKey);
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 89851fc4d3..15a0b28181 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -57,8 +57,9 @@ String cwd() {
Char16String buffer;
buffer.resize((int)expected_size);
- if (::GetCurrentDirectoryW(expected_size, (wchar_t *)buffer.ptrw()) == 0)
+ if (::GetCurrentDirectoryW(expected_size, (wchar_t *)buffer.ptrw()) == 0) {
return ".";
+ }
String result;
if (result.parse_utf16(buffer.ptr())) {
@@ -95,8 +96,9 @@ String realpath(const String &p_path) {
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
- if (hFile == INVALID_HANDLE_VALUE)
+ if (hFile == INVALID_HANDLE_VALUE) {
return p_path;
+ }
const DWORD expected_size = ::GetFinalPathNameByHandleW(hFile, nullptr, 0, FILE_NAME_NORMALIZED);
@@ -177,8 +179,9 @@ String relative_to_impl(const String &p_path, const String &p_relative_to) {
#ifdef WINDOWS_ENABLED
String get_drive_letter(const String &p_norm_path) {
int idx = p_norm_path.find(":/");
- if (idx != -1 && idx < p_norm_path.find("/"))
+ if (idx != -1 && idx < p_norm_path.find("/")) {
return p_norm_path.substr(0, idx + 1);
+ }
return String();
}
#endif
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 88445f2f98..9549137aef 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -930,8 +930,6 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
get_variable_list(&vars);
for (const StringName &E : vars) {
- //if (!variables[E]._export)
- // continue;
PropertyInfo pi = variables[E].info;
pi.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
p_list->push_back(pi);
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp
index 4c41a4c7ee..0fb074b0c2 100644
--- a/modules/webrtc/webrtc_data_channel_js.cpp
+++ b/modules/webrtc/webrtc_data_channel_js.cpp
@@ -31,6 +31,7 @@
#ifdef JAVASCRIPT_ENABLED
#include "webrtc_data_channel_js.h"
+
#include "emscripten.h"
extern "C" {
@@ -104,8 +105,9 @@ int WebRTCDataChannelJS::get_available_packet_count() const {
Error WebRTCDataChannelJS::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(get_ready_state() != STATE_OPEN, ERR_UNCONFIGURED);
- if (queue_count == 0)
+ if (queue_count == 0) {
return ERR_UNAVAILABLE;
+ }
uint32_t to_read = 0;
uint32_t left = 0;
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 2d029dfbbc..e051a3b564 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -31,6 +31,7 @@
#ifdef JAVASCRIPT_ENABLED
#include "emws_client.h"
+
#include "core/config/project_settings.h"
#include "core/io/ip.h"
#include "emscripten.h"
@@ -45,8 +46,9 @@ void EMWSClient::_esws_on_message(void *obj, const uint8_t *p_data, int p_data_s
EMWSClient *client = static_cast<EMWSClient *>(obj);
Error err = static_cast<EMWSPeer *>(*client->get_peer(1))->read_msg(p_data, p_data_size, p_is_string == 1);
- if (err == OK)
+ if (err == OK) {
client->_on_peer_packet();
+ }
}
void EMWSClient::_esws_on_error(void *obj) {
@@ -71,8 +73,9 @@ Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
String proto_string;
for (int i = 0; i < p_protocols.size(); i++) {
- if (i != 0)
+ if (i != 0) {
proto_string += ",";
+ }
proto_string += p_protocols[i];
}
@@ -109,8 +112,9 @@ Ref<WebSocketPeer> EMWSClient::get_peer(int p_peer_id) const {
MultiplayerPeer::ConnectionStatus EMWSClient::get_connection_status() const {
if (_peer->is_connected_to_host()) {
- if (_is_connecting)
+ if (_is_connecting) {
return CONNECTION_CONNECTING;
+ }
return CONNECTION_CONNECTED;
}
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index 77a96c8e4f..86169f88e9 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -31,6 +31,7 @@
#ifdef JAVASCRIPT_ENABLED
#include "emws_peer.h"
+
#include "core/io/ip.h"
void EMWSPeer::set_sock(int p_sock, unsigned int p_in_buf_size, unsigned int p_in_pkt_size, unsigned int p_out_buf_size) {
@@ -66,8 +67,9 @@ Error EMWSPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
}
Error EMWSPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
- if (_in_buffer.packets_left() == 0)
+ if (_in_buffer.packets_left() == 0) {
return ERR_UNAVAILABLE;
+ }
int read = 0;
Error err = _in_buffer.read_packet(_packet_buffer.ptrw(), _packet_buffer.size(), &_is_string, read);
@@ -109,7 +111,7 @@ void EMWSPeer::close(int p_code, String p_reason) {
IPAddress EMWSPeer::get_connected_host() const {
ERR_FAIL_V_MSG(IPAddress(), "Not supported in HTML5 export.");
-};
+}
uint16_t EMWSPeer::get_connected_port() const {
ERR_FAIL_V_MSG(0, "Not supported in HTML5 export.");
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index 86b857f72c..06b0e31801 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -31,11 +31,13 @@
#ifdef JAVASCRIPT_ENABLED
#include "webxr_interface_js.h"
+
#include "core/input/input.h"
#include "core/os/os.h"
#include "emscripten.h"
#include "godot_webxr.h"
#include "servers/rendering/renderer_compositor.h"
+
#include <stdlib.h>
void _emwebxr_on_session_supported(char *p_session_mode, int p_supported) {
@@ -481,7 +483,6 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) {
sprintf(name, "axis_%i", i);
float value = *((float *)axes + (i + 1));
- ;
tracker->set_input(name, value);
}
free(axes);