diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/camera/camera_osx.mm | 24 | ||||
-rw-r--r-- | modules/csg/csg_shape.cpp | 12 | ||||
-rw-r--r-- | modules/csg/doc_classes/CSGMesh3D.xml | 2 | ||||
-rw-r--r-- | modules/fbx/editor_scene_importer_fbx.cpp | 2 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXAnimation.cpp | 2 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXDocument.h | 4 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXDocumentUtil.cpp | 8 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXMeshGeometry.h | 2 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXParser.cpp | 4 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXProperties.cpp | 2 | ||||
-rw-r--r-- | modules/fbx/tools/import_utils.h | 4 | ||||
-rw-r--r-- | modules/gdnative/tests/test_variant.h | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 2 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 12 | ||||
-rw-r--r-- | modules/mbedtls/stream_peer_mbedtls.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_export.cpp | 2 | ||||
-rw-r--r-- | modules/mono/mono_gd/support/ios_support.mm | 8 | ||||
-rw-r--r-- | modules/visual_script/visual_script.cpp | 2 | ||||
-rw-r--r-- | modules/websocket/websocket_multiplayer_peer.cpp | 2 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.cpp | 2 |
20 files changed, 55 insertions, 45 deletions
diff --git a/modules/camera/camera_osx.mm b/modules/camera/camera_osx.mm index 3d2053ad23..9b59b68075 100644 --- a/modules/camera/camera_osx.mm +++ b/modules/camera/camera_osx.mm @@ -106,15 +106,15 @@ if (input) { [self removeInput:input]; // don't release this - input = NULL; + input = nullptr; } // free up our output if (output) { [self removeOutput:output]; - [output setSampleBufferDelegate:nil queue:NULL]; + [output setSampleBufferDelegate:nil queue:nullptr]; [output release]; - output = NULL; + output = nullptr; } [self commitConfiguration]; @@ -141,9 +141,9 @@ // get our buffers unsigned char *dataY = (unsigned char *)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0); unsigned char *dataCbCr = (unsigned char *)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1); - if (dataY == NULL) { + if (dataY == nullptr) { print_line("Couldn't access Y pixel buffer data"); - } else if (dataCbCr == NULL) { + } else if (dataCbCr == nullptr) { print_line("Couldn't access CbCr pixel buffer data"); } else { Ref<Image> img[2]; @@ -220,8 +220,8 @@ AVCaptureDevice *CameraFeedOSX::get_device() const { }; CameraFeedOSX::CameraFeedOSX() { - device = NULL; - capture_session = NULL; + device = nullptr; + capture_session = nullptr; }; void CameraFeedOSX::set_device(AVCaptureDevice *p_device) { @@ -240,14 +240,14 @@ void CameraFeedOSX::set_device(AVCaptureDevice *p_device) { }; CameraFeedOSX::~CameraFeedOSX() { - if (capture_session != NULL) { + if (capture_session != nullptr) { [capture_session release]; - capture_session = NULL; + capture_session = nullptr; }; - if (device != NULL) { + if (device != nullptr) { [device release]; - device = NULL; + device = nullptr; }; }; @@ -267,7 +267,7 @@ void CameraFeedOSX::deactivate_feed() { if (capture_session) { [capture_session cleanup]; [capture_session release]; - capture_session = NULL; + capture_session = nullptr; }; }; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 05927dafc0..e448891eb6 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -89,6 +89,7 @@ uint32_t CSGShape3D::get_collision_mask() const { } void CSGShape3D::set_collision_mask_bit(int p_bit, bool p_value) { + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision mask bit must be between 0 and 31 inclusive."); uint32_t mask = get_collision_mask(); if (p_value) { mask |= 1 << p_bit; @@ -99,20 +100,23 @@ void CSGShape3D::set_collision_mask_bit(int p_bit, bool p_value) { } bool CSGShape3D::get_collision_mask_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision mask bit must be between 0 and 31 inclusive."); return get_collision_mask() & (1 << p_bit); } void CSGShape3D::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_collision_layer(); + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision layer bit must be between 0 and 31 inclusive."); + uint32_t layer = get_collision_layer(); if (p_value) { - mask |= 1 << p_bit; + layer |= 1 << p_bit; } else { - mask &= ~(1 << p_bit); + layer &= ~(1 << p_bit); } - set_collision_layer(mask); + set_collision_layer(layer); } bool CSGShape3D::get_collision_layer_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision layer bit must be between 0 and 31 inclusive."); return get_collision_layer() & (1 << p_bit); } diff --git a/modules/csg/doc_classes/CSGMesh3D.xml b/modules/csg/doc_classes/CSGMesh3D.xml index babdac0e98..5fa8427843 100644 --- a/modules/csg/doc_classes/CSGMesh3D.xml +++ b/modules/csg/doc_classes/CSGMesh3D.xml @@ -4,7 +4,7 @@ A CSG Mesh shape that uses a mesh resource. </brief_description> <description> - This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not self-intersect, does not contain internal faces and has no edges that connect to more then two faces. + This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not self-intersect, does not contain internal faces and has no edges that connect to more than two faces. </description> <tutorials> </tutorials> diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp index edea1963a7..ccbea21541 100644 --- a/modules/fbx/editor_scene_importer_fbx.cpp +++ b/modules/fbx/editor_scene_importer_fbx.cpp @@ -104,7 +104,7 @@ Node3D *EditorSceneImporterFBX::import_scene(const String &p_path, uint32_t p_fl bool is_binary = false; data.resize(f->get_len()); - ERR_FAIL_COND_V(data.size() < 64, NULL); + ERR_FAIL_COND_V(data.size() < 64, nullptr); f->get_buffer(data.ptrw(), data.size()); PackedByteArray fbx_header; diff --git a/modules/fbx/fbx_parser/FBXAnimation.cpp b/modules/fbx/fbx_parser/FBXAnimation.cpp index 1690df6943..0fbff035fd 100644 --- a/modules/fbx/fbx_parser/FBXAnimation.cpp +++ b/modules/fbx/fbx_parser/FBXAnimation.cpp @@ -128,7 +128,7 @@ AnimationCurve::~AnimationCurve() { // ------------------------------------------------------------------------------------------------ AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name, - const Document &doc, const char *const *target_prop_whitelist /*= NULL*/, + const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/, size_t whitelist_size /*= 0*/) : Object(id, element, name), target(), doc(doc) { // find target node diff --git a/modules/fbx/fbx_parser/FBXDocument.h b/modules/fbx/fbx_parser/FBXDocument.h index 49b7c11c31..9664cd763a 100644 --- a/modules/fbx/fbx_parser/FBXDocument.h +++ b/modules/fbx/fbx_parser/FBXDocument.h @@ -759,7 +759,7 @@ public: const AnimationMap &Curves() const; - /** Object the curve is assigned to, this can be NULL if the + /** Object the curve is assigned to, this can be nullptr if the * target object has no DOM representation or could not * be read for other reasons.*/ Object *Target() const { @@ -989,7 +989,7 @@ public: // note: a connection ensures that the source and dest objects exist, but // not that they have DOM representations, so the return value of one of - // these functions can still be NULL. + // these functions can still be nullptr. Object *SourceObject() const; Object *DestinationObject() const; diff --git a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp index 3930e005c3..4a33024969 100644 --- a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp +++ b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp @@ -95,14 +95,14 @@ void DOMError(const std::string &message, const std::shared_ptr<Token> token) { print_error("[FBX-DOM]" + String(message.c_str()) + ";" + String(token->StringContents().c_str())); } -void DOMError(const std::string &message, const Element *element /*= NULL*/) { +void DOMError(const std::string &message, const Element *element /*= nullptr*/) { if (element) { DOMError(message, element->KeyToken()); } print_error("[FBX-DOM] " + String(message.c_str())); } -void DOMError(const std::string &message, const std::shared_ptr<Element> element /*= NULL*/) { +void DOMError(const std::string &message, const std::shared_ptr<Element> element /*= nullptr*/) { if (element) { DOMError(message, element->KeyToken()); } @@ -117,7 +117,7 @@ void DOMWarning(const std::string &message, const Token *token) { print_verbose("[FBX-DOM] warning:" + String(message.c_str()) + ";" + String(token->StringContents().c_str())); } -void DOMWarning(const std::string &message, const Element *element /*= NULL*/) { +void DOMWarning(const std::string &message, const Element *element /*= nullptr*/) { if (element) { DOMWarning(message, element->KeyToken()); return; @@ -129,7 +129,7 @@ void DOMWarning(const std::string &message, const std::shared_ptr<Token> token) print_verbose("[FBX-DOM] warning:" + String(message.c_str()) + ";" + String(token->StringContents().c_str())); } -void DOMWarning(const std::string &message, const std::shared_ptr<Element> element /*= NULL*/) { +void DOMWarning(const std::string &message, const std::shared_ptr<Element> element /*= nullptr*/) { if (element) { DOMWarning(message, element->KeyToken()); return; diff --git a/modules/fbx/fbx_parser/FBXMeshGeometry.h b/modules/fbx/fbx_parser/FBXMeshGeometry.h index 710e644c68..05493c4aec 100644 --- a/modules/fbx/fbx_parser/FBXMeshGeometry.h +++ b/modules/fbx/fbx_parser/FBXMeshGeometry.h @@ -96,7 +96,7 @@ public: Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc); virtual ~Geometry(); - /** Get the Skin attached to this geometry or NULL */ + /** Get the Skin attached to this geometry or nullptr */ const Skin *DeformerSkin() const; const std::vector<const BlendShape *> &get_blend_shapes() const; diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp index 2a76c3f67c..98435b5c0f 100644 --- a/modules/fbx/fbx_parser/FBXParser.cpp +++ b/modules/fbx/fbx_parser/FBXParser.cpp @@ -1206,7 +1206,7 @@ std::string ParseTokenAsString(const TokenPtr t) { // ------------------------------------------------------------------------------------------------ // extract a required element from a scope, abort if the element cannot be found -ElementPtr GetRequiredElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= NULL*/) { +ElementPtr GetRequiredElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= nullptr*/) { const ElementPtr el = sc->GetElement(index); TokenPtr token = el->KeyToken(); ERR_FAIL_COND_V(!token, nullptr); @@ -1227,7 +1227,7 @@ bool HasElement(const ScopePtr sc, const std::string &index) { // ------------------------------------------------------------------------------------------------ // extract a required element from a scope, abort if the element cannot be found -ElementPtr GetOptionalElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= NULL*/) { +ElementPtr GetOptionalElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= nullptr*/) { const ElementPtr el = sc->GetElement(index); return el; } diff --git a/modules/fbx/fbx_parser/FBXProperties.cpp b/modules/fbx/fbx_parser/FBXProperties.cpp index 1b3f29ec04..37717e9109 100644 --- a/modules/fbx/fbx_parser/FBXProperties.cpp +++ b/modules/fbx/fbx_parser/FBXProperties.cpp @@ -94,7 +94,7 @@ Property::~Property() { namespace { // ------------------------------------------------------------------------------------------------ -// read a typed property out of a FBX element. The return value is NULL if the property cannot be read. +// read a typed property out of a FBX element. The return value is nullptr if the property cannot be read. PropertyPtr ReadTypedProperty(const ElementPtr element) { //ai_assert(element.KeyToken().StringContents() == "P"); diff --git a/modules/fbx/tools/import_utils.h b/modules/fbx/tools/import_utils.h index bea28ffeda..cf0f811e35 100644 --- a/modules/fbx/tools/import_utils.h +++ b/modules/fbx/tools/import_utils.h @@ -267,7 +267,7 @@ public: */ // static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) { // ERR_FAIL_COND(texture.is_null()); - // ERR_FAIL_COND(map_mode == NULL); + // ERR_FAIL_COND(map_mode == nullptr); // aiTextureMapMode tex_mode = map_mode[0]; // int32_t flags = Texture::FLAGS_DEFAULT; @@ -382,7 +382,7 @@ public: // String &path, // AssimpImageData &image_state) { // aiString ai_filename = aiString(); - // if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, NULL, NULL, NULL, NULL, image_state.map_mode)) { + // if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, nullptr, nullptr, nullptr, nullptr, image_state.map_mode)) { // return CreateAssimpTexture(state, ai_filename, filename, path, image_state); // } diff --git a/modules/gdnative/tests/test_variant.h b/modules/gdnative/tests/test_variant.h index aeceb6e68f..2850036604 100644 --- a/modules/gdnative/tests/test_variant.h +++ b/modules/gdnative/tests/test_variant.h @@ -107,7 +107,7 @@ TEST_CASE("[GDNative Variant] Variant call") { godot_string_name_new_with_latin1_chars(&method, "is_valid_identifier"); godot_variant_call_error error; - godot_variant_call(&self, &method, NULL, 0, &ret, &error); + godot_variant_call(&self, &method, nullptr, 0, &ret, &error); CHECK(godot_variant_get_type(&ret) == GODOT_VARIANT_TYPE_BOOL); CHECK(godot_variant_as_bool(&ret)); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index ae3b16a9d7..f70020d165 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3070,7 +3070,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol // We cannot determine the exact nature of the identifier here // Otherwise these codes would work StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true); - if (enumName != NULL) { + if (enumName != nullptr) { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM; r_result.class_name = "@GlobalScope"; r_result.class_member = enumName; diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 4e4f88ed6a..eaceaac33c 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -152,6 +152,7 @@ uint32_t GridMap::get_collision_mask() const { } void GridMap::set_collision_mask_bit(int p_bit, bool p_value) { + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision mask bit must be between 0 and 31 inclusive."); uint32_t mask = get_collision_mask(); if (p_value) { mask |= 1 << p_bit; @@ -162,20 +163,23 @@ void GridMap::set_collision_mask_bit(int p_bit, bool p_value) { } bool GridMap::get_collision_mask_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision mask bit must be between 0 and 31 inclusive."); return get_collision_mask() & (1 << p_bit); } void GridMap::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_collision_layer(); + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision layer bit must be between 0 and 31 inclusive."); + uint32_t layer = get_collision_layer(); if (p_value) { - mask |= 1 << p_bit; + layer |= 1 << p_bit; } else { - mask &= ~(1 << p_bit); + layer &= ~(1 << p_bit); } - set_collision_layer(mask); + set_collision_layer(layer); } bool GridMap::get_collision_layer_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision layer bit must be between 0 and 31 inclusive."); return get_collision_layer() & (1 << p_bit); } diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp index b39a6ecc2f..8e40451806 100644 --- a/modules/mbedtls/stream_peer_mbedtls.cpp +++ b/modules/mbedtls/stream_peer_mbedtls.cpp @@ -242,7 +242,7 @@ void StreamPeerMbedTLS::poll() { return; } - // We could pass NULL as second parameter, but some behaviour sanitizers don't seem to like that. + // We could pass nullptr as second parameter, but some behaviour sanitizers don't seem to like that. // Passing a 1 byte buffer to workaround it. uint8_t byte; int ret = mbedtls_ssl_read(ssl_ctx->get_context(), &byte, 0); diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp index 4b858c0e82..54dbaebf38 100644 --- a/modules/mono/editor/godotsharp_export.cpp +++ b/modules/mono/editor/godotsharp_export.cpp @@ -91,7 +91,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, MonoAssemblyName *re mono_assembly_get_assemblyref(image, i, reusable_aname); - GDMonoAssembly *ref_assembly = NULL; + GDMonoAssembly *ref_assembly = nullptr; if (!GDMono::get_singleton()->load_assembly(ref_name, reusable_aname, &ref_assembly, /* refonly: */ true, p_search_dirs)) { ERR_FAIL_V_MSG(ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + ref_name + "'."); } diff --git a/modules/mono/mono_gd/support/ios_support.mm b/modules/mono/mono_gd/support/ios_support.mm index cdee04edcf..23424fbaf9 100644 --- a/modules/mono/mono_gd/support/ios_support.mm +++ b/modules/mono/mono_gd/support/ios_support.mm @@ -57,9 +57,9 @@ void ios_mono_log_callback(const char *log_domain, const char *log_level, const } void initialize() { - mono_dllmap_insert(NULL, "System.Native", NULL, "__Internal", NULL); - mono_dllmap_insert(NULL, "System.IO.Compression.Native", NULL, "__Internal", NULL); - mono_dllmap_insert(NULL, "System.Security.Cryptography.Native.Apple", NULL, "__Internal", NULL); + mono_dllmap_insert(nullptr, "System.Native", nullptr, "__Internal", nullptr); + mono_dllmap_insert(nullptr, "System.IO.Compression.Native", nullptr, "__Internal", nullptr); + mono_dllmap_insert(nullptr, "System.Security.Cryptography.Native.Apple", nullptr, "__Internal", nullptr); #ifdef IOS_DEVICE // This function is defined in an auto-generated source file @@ -85,7 +85,7 @@ void cleanup() { GD_PINVOKE_EXPORT const char *xamarin_get_locale_country_code() { NSLocale *locale = [NSLocale currentLocale]; NSString *countryCode = [locale objectForKey:NSLocaleCountryCode]; - if (countryCode == NULL) { + if (countryCode == nullptr) { return strdup("US"); } return strdup([countryCode UTF8String]); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 05ecdee9fc..765a5fe023 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1607,7 +1607,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p } next = node->sequence_outputs[output]; - VSDEBUG("GOT NEXT NODE - " + (next ? itos(next->get_id()) : "NULL")); + VSDEBUG("GOT NEXT NODE - " + (next ? itos(next->get_id()) : "Null")); } if (flow_stack) { diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp index 369d53bca4..fa0ef7060f 100644 --- a/modules/websocket/websocket_multiplayer_peer.cpp +++ b/modules/websocket/websocket_multiplayer_peer.cpp @@ -99,6 +99,8 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff _current_packet.data = nullptr; } + ERR_FAIL_COND_V(_incoming_packets.size() == 0, ERR_UNAVAILABLE); + _current_packet = _incoming_packets.front()->get(); _incoming_packets.pop_front(); diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 4dce2c2b23..06f3fe6284 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -253,7 +253,7 @@ bool WebXRInterfaceJS::initialize() { void WebXRInterfaceJS::uninitialize() { if (initialized) { XRServer *xr_server = XRServer::get_singleton(); - if (xr_server != NULL) { + if (xr_server != nullptr) { // no longer our primary interface xr_server->clear_primary_interface_if(this); } |