Core: Modernize C headers with C++ equivalents

This commit is contained in:
Thaddeus Crews 2025-04-28 16:05:13 -05:00
parent a8ece29adc
commit 01fc9aee6c
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
101 changed files with 126 additions and 168 deletions

View File

@ -1,6 +1,7 @@
Checks: Checks:
- -* - -*
- cppcoreguidelines-pro-type-member-init - cppcoreguidelines-pro-type-member-init
- modernize-deprecated-headers
- modernize-redundant-void-arg - modernize-redundant-void-arg
- modernize-use-bool-literals - modernize-use-bool-literals
- modernize-use-default-member-init - modernize-use-default-member-init
@ -14,6 +15,7 @@ FormatStyle: file
CheckOptions: CheckOptions:
cppcoreguidelines-pro-type-member-init.IgnoreArrays: true cppcoreguidelines-pro-type-member-init.IgnoreArrays: true
cppcoreguidelines-pro-type-member-init.UseAssignment: true cppcoreguidelines-pro-type-member-init.UseAssignment: true
modernize-deprecated-headers.CheckHeaderFile: true
modernize-use-bool-literals.IgnoreMacros: false modernize-use-bool-literals.IgnoreMacros: false
modernize-use-default-member-init.IgnoreMacros: false modernize-use-default-member-init.IgnoreMacros: false
modernize-use-default-member-init.UseAssignment: true modernize-use-default-member-init.UseAssignment: true

View File

@ -43,8 +43,6 @@
#include "core/variant/variant.h" #include "core/variant/variant.h"
#include "core/version.h" #include "core/version.h"
#include <string.h>
class CallableCustomExtension : public CallableCustom { class CallableCustomExtension : public CallableCustom {
void *userdata; void *userdata;
void *token; void *token;

View File

@ -34,15 +34,16 @@
* Together with the JSON file, you should be able to generate any binder. * Together with the JSON file, you should be able to generate any binder.
*/ */
#ifndef __cplusplus
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#ifndef __cplusplus
typedef uint32_t char32_t; typedef uint32_t char32_t;
typedef uint16_t char16_t; typedef uint16_t char16_t;
#endif #else
#include <cstddef>
#include <cstdint>
#ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -34,8 +34,6 @@ IPAddress::operator Variant() const {
return operator String(); return operator String();
}*/ }*/
#include <string.h>
IPAddress::operator String() const { IPAddress::operator String() const {
if (wildcard) { if (wildcard) {
return "*"; return "*";

View File

@ -35,7 +35,7 @@
#include "core/string/ustring.h" #include "core/string/ustring.h"
#include "core/templates/vector.h" #include "core/templates/vector.h"
#include <stdarg.h> #include <cstdarg>
class RegEx; class RegEx;

View File

@ -35,8 +35,8 @@
#include "core/object/script_language.h" #include "core/object/script_language.h"
#include "core/variant/container_type_validate.h" #include "core/variant/container_type_validate.h"
#include <limits.h> #include <climits>
#include <stdio.h> #include <cstdio>
void EncodedObjectAsID::_bind_methods() { void EncodedObjectAsID::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_object_id", "id"), &EncodedObjectAsID::set_object_id); ClassDB::bind_method(D_METHOD("set_object_id", "id"), &EncodedObjectAsID::set_object_id);

View File

@ -43,7 +43,8 @@
#include "core/math/vector3.h" #include "core/math/vector3.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"
#include "core/templates/pooled_list.h" #include "core/templates/pooled_list.h"
#include <limits.h>
#include <climits>
#define BVHABB_CLASS BVH_ABB<BOUNDS, POINT> #define BVHABB_CLASS BVH_ABB<BOUNDS, POINT>

View File

@ -88,7 +88,7 @@ subject to the following restrictions:
#endif #endif
#if defined(DEBUG_CONVEX_HULL) || defined(SHOW_ITERATIONS) #if defined(DEBUG_CONVEX_HULL) || defined(SHOW_ITERATIONS)
#include <stdio.h> #include <cstdio>
#endif #endif
// Convex hull implementation based on Preparata and Hong // Convex hull implementation based on Preparata and Hong

View File

@ -34,7 +34,7 @@
#include "core/object/class_db.h" #include "core/object/class_db.h"
#include "core/object/script_language.h" #include "core/object/script_language.h"
#include <stdio.h> #include <cstdio>
#ifdef DEV_ENABLED #ifdef DEV_ENABLED
// Includes safety checks to ensure that a queue set as a thread singleton override // Includes safety checks to ensure that a queue set as a thread singleton override

View File

@ -32,8 +32,7 @@
#include "core/templates/safe_refcount.h" #include "core/templates/safe_refcount.h"
#include <stdlib.h> #include <cstdlib>
#include <string.h>
void *operator new(size_t p_size, const char *p_description) { void *operator new(size_t p_size, const char *p_description) {
return Memory::alloc_static(p_size, false); return Memory::alloc_static(p_size, false);

View File

@ -33,7 +33,6 @@
#include "core/error/error_macros.h" #include "core/error/error_macros.h"
#include "core/templates/safe_refcount.h" #include "core/templates/safe_refcount.h"
#include <cstring>
#include <new> // IWYU pragma: keep // `new` operators. #include <new> // IWYU pragma: keep // `new` operators.
#include <type_traits> #include <type_traits>

View File

@ -37,7 +37,7 @@
#include "core/os/midi_driver.h" #include "core/os/midi_driver.h"
#include "core/version_generated.gen.h" #include "core/version_generated.gen.h"
#include <stdarg.h> #include <cstdarg>
#ifdef MINGW_ENABLED #ifdef MINGW_ENABLED
#define MINGW_STDTHREAD_REDUNDANCY_WARNING #define MINGW_STDTHREAD_REDUNDANCY_WARNING

View File

@ -38,7 +38,7 @@
#include "core/templates/list.h" #include "core/templates/list.h"
#include "core/templates/vector.h" #include "core/templates/vector.h"
#include <stdlib.h> #include <cstdlib>
class OS { class OS {
static OS *singleton; static OS *singleton;

View File

@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/ /**************************************************************************/
#include "time.h" #include "time.h" // NOLINT(modernize-deprecated-headers) False positive with C-Header of the same name.
#include "core/os/os.h" #include "core/os/os.h"

View File

@ -30,8 +30,6 @@
#include "string_builder.h" #include "string_builder.h"
#include <string.h>
StringBuilder &StringBuilder::append(const String &p_string) { StringBuilder &StringBuilder::append(const String &p_string) {
if (p_string.is_empty()) { if (p_string.is_empty()) {
return *this; return *this;

View File

@ -35,7 +35,6 @@
#include "core/templates/safe_refcount.h" #include "core/templates/safe_refcount.h"
#include "core/templates/span.h" #include "core/templates/span.h"
#include <string.h>
#include <initializer_list> #include <initializer_list>
#include <type_traits> #include <type_traits>

View File

@ -37,7 +37,7 @@
#include "core/templates/rid.h" #include "core/templates/rid.h"
#include "core/templates/safe_refcount.h" #include "core/templates/safe_refcount.h"
#include <stdio.h> #include <cstdio>
#include <typeinfo> // IWYU pragma: keep // Used in macro. #include <typeinfo> // IWYU pragma: keep // Used in macro.
#ifdef SANITIZERS_ENABLED #ifdef SANITIZERS_ENABLED

View File

@ -50,6 +50,7 @@ static_assert(__cplusplus >= 201703L, "Minimum of C++17 required.");
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <cstring>
#include <utility> #include <utility>
// IWYU pragma: end_exports // IWYU pragma: end_exports

View File

@ -40,7 +40,7 @@
#include "core/variant/variant.h" #include "core/variant/variant.h"
#include "core/variant/variant_internal.h" #include "core/variant/variant_internal.h"
#include <stdio.h> #include <cstdio>
// Variant cannot define an implicit cast operator for every Object subclass, so the // Variant cannot define an implicit cast operator for every Object subclass, so the
// casting is done here, to allow binding methods with parameters more specific than Object * // casting is done here, to allow binding methods with parameters more specific than Object *

View File

@ -32,7 +32,7 @@
#include "core/version_generated.gen.h" // IWYU pragma: export #include "core/version_generated.gen.h" // IWYU pragma: export
#include <stdint.h> #include <stdint.h> // NOLINT(modernize-deprecated-headers) FIXME: MinGW compilation fails when changing to C++ Header.
// Copied from typedefs.h to stay lean. // Copied from typedefs.h to stay lean.
#ifndef _STR #ifndef _STR

View File

@ -35,7 +35,7 @@
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "core/os/os.h" #include "core/os/os.h"
#include <errno.h> #include <cerrno>
#if defined(PULSEAUDIO_ENABLED) && defined(SOWRAP_ENABLED) #if defined(PULSEAUDIO_ENABLED) && defined(SOWRAP_ENABLED)
extern "C" { extern "C" {

View File

@ -34,7 +34,7 @@
#include "core/os/os.h" #include "core/os/os.h"
#include <errno.h> #include <cerrno>
MIDIDriverALSAMidi::InputConnection::InputConnection(int p_device_index, MIDIDriverALSAMidi::InputConnection::InputConnection(int p_device_index,
snd_rawmidi_t *p_rawmidi) : snd_rawmidi_t *p_rawmidi) :

View File

@ -37,7 +37,7 @@
#include "core/templates/vector.h" #include "core/templates/vector.h"
#import <CoreMIDI/CoreMIDI.h> #import <CoreMIDI/CoreMIDI.h>
#include <stdio.h> #include <cstdio>
class MIDIDriverCoreMidi : public MIDIDriver { class MIDIDriverCoreMidi : public MIDIDriver {
MIDIClientRef client = 0; MIDIClientRef client = 0;

View File

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <stdint.h> #include <cstdint>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -32,8 +32,6 @@
#include "drivers/png/png_driver_common.h" #include "drivers/png/png_driver_common.h"
#include <string.h>
Error ImageLoaderPNG::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) { Error ImageLoaderPNG::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) {
const uint64_t buffer_size = f->get_length(); const uint64_t buffer_size = f->get_length();
Vector<uint8_t> file_buffer; Vector<uint8_t> file_buffer;

View File

@ -33,7 +33,6 @@
#include "core/config/engine.h" #include "core/config/engine.h"
#include <png.h> #include <png.h>
#include <string.h>
namespace PNGDriverCommon { namespace PNGDriverCommon {

View File

@ -37,14 +37,13 @@
#include "core/string/print_string.h" #include "core/string/print_string.h"
#include "core/templates/list.h" #include "core/templates/list.h"
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#if __has_include(<mntent.h>) #if __has_include(<mntent.h>)
#include <mntent.h> #include <mntent.h>

View File

@ -35,15 +35,15 @@
#include "core/os/os.h" #include "core/os/os.h"
#include "core/string/print_string.h" #include "core/string/print_string.h"
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <cerrno>
#if defined(TOOLS_ENABLED) #if defined(TOOLS_ENABLED)
#include <limits.h> #include <climits>
#include <stdlib.h> #include <cstdlib>
#endif #endif
void FileAccessUnix::check_errors(bool p_write) const { void FileAccessUnix::check_errors(bool p_write) const {

View File

@ -33,7 +33,7 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/os/memory.h" #include "core/os/memory.h"
#include <stdio.h> #include <cstdio>
#if defined(UNIX_ENABLED) #if defined(UNIX_ENABLED)

View File

@ -35,12 +35,12 @@
#include "core/os/os.h" #include "core/os/os.h"
#include "core/string/print_string.h" #include "core/string/print_string.h"
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <cerrno>
Error FileAccessUnixPipe::open_existing(int p_rfd, int p_wfd, bool p_blocking) { Error FileAccessUnixPipe::open_existing(int p_rfd, int p_wfd, bool p_blocking) {
// Open pipe using handles created by pipe(fd) call in the OS.execute_with_pipe. // Open pipe using handles created by pipe(fd) call in the OS.execute_with_pipe.

View File

@ -33,7 +33,7 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/os/memory.h" #include "core/os/memory.h"
#include <stdio.h> #include <cstdio>
#if defined(UNIX_ENABLED) #if defined(UNIX_ENABLED)

View File

@ -54,8 +54,6 @@
#include <net/if.h> // Order is important on OpenBSD, leave as last. #include <net/if.h> // Order is important on OpenBSD, leave as last.
#include <string.h>
static IPAddress _sockaddr2ip(struct sockaddr *p_addr) { static IPAddress _sockaddr2ip(struct sockaddr *p_addr) {
IPAddress ip; IPAddress ip;

View File

@ -34,19 +34,18 @@
#include "net_socket_unix.h" #include "net_socket_unix.h"
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <poll.h> #include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#ifdef WEB_ENABLED #ifdef WEB_ENABLED
#include <arpa/inet.h> #include <arpa/inet.h>

View File

@ -69,19 +69,18 @@
#endif #endif
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h>
#include <poll.h> #include <poll.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#include <cerrno>
#include <csignal>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#ifndef RTLD_DEEPBIND #ifndef RTLD_DEEPBIND
#define RTLD_DEEPBIND 0 #define RTLD_DEEPBIND 0

View File

@ -33,7 +33,7 @@
#ifdef USE_VOLK #ifdef USE_VOLK
#include <volk.h> #include <volk.h>
#else #else
#include <stdint.h> #include <cstdint>
#define VK_NO_STDINT_H #define VK_NO_STDINT_H
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#endif #endif

View File

@ -38,8 +38,8 @@
#include "core/os/os.h" #include "core/os/os.h"
#include "core/string/print_string.h" #include "core/string/print_string.h"
#include <stdio.h> #include <cstdio>
#include <wchar.h> #include <cwchar>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -41,12 +41,12 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <errno.h>
#include <io.h> #include <io.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <tchar.h> #include <tchar.h>
#include <wchar.h> #include <cerrno>
#include <cwchar>
#ifdef _MSC_VER #ifdef _MSC_VER
#define S_ISREG(m) ((m) & _S_IFREG) #define S_ISREG(m) ((m) & _S_IFREG)

View File

@ -35,7 +35,7 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/os/memory.h" #include "core/os/memory.h"
#include <stdio.h> #include <cstdio>
class FileAccessWindows : public FileAccess { class FileAccessWindows : public FileAccess {
GDSOFTCLASS(FileAccessWindows, FileAccess); GDSOFTCLASS(FileAccessWindows, FileAccess);

View File

@ -39,9 +39,7 @@
#include <iphlpapi.h> #include <iphlpapi.h>
#include <stdio.h> #include <cstdio>
#include <string.h>
static IPAddress _sockaddr2ip(struct sockaddr *p_addr) { static IPAddress _sockaddr2ip(struct sockaddr *p_addr) {
IPAddress ip; IPAddress ip;

View File

@ -35,7 +35,7 @@
#include "core/os/midi_driver.h" #include "core/os/midi_driver.h"
#include "core/templates/vector.h" #include "core/templates/vector.h"
#include <stdio.h> #include <cstdio>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -40,7 +40,7 @@
#include "scene/gui/view_panner.h" #include "scene/gui/view_panner.h"
#include "scene/resources/text_line.h" #include "scene/resources/text_line.h"
#include <limits.h> #include <climits>
float AnimationBezierTrackEdit::_bezier_h_to_pixel(float p_h) { float AnimationBezierTrackEdit::_bezier_h_to_pixel(float p_h) {
float h = p_h; float h = p_h;
@ -1578,7 +1578,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
} }
if (scaling_selection && mb.is_valid() && !read_only && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { if (scaling_selection && mb.is_valid() && !read_only && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (abs(scaling_selection_scale.x - 1) > CMP_EPSILON || abs(scaling_selection_scale.y - 1) > CMP_EPSILON) { if (std::abs(scaling_selection_scale.x - 1) > CMP_EPSILON || std::abs(scaling_selection_scale.y - 1) > CMP_EPSILON) {
// Scale it. // Scale it.
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Scale Bezier Points")); undo_redo->create_action(TTR("Scale Bezier Points"));

View File

@ -180,7 +180,7 @@
#include "editor/gui/touch_actions_panel.h" #include "editor/gui/touch_actions_panel.h"
#endif // ANDROID_ENABLED #endif // ANDROID_ENABLED
#include <stdlib.h> #include <cstdlib>
EditorNode *EditorNode::singleton = nullptr; EditorNode *EditorNode::singleton = nullptr;

View File

@ -77,8 +77,8 @@
#define GLTF_IMPORT_DISCARD_MESHES_AND_MATERIALS 32 #define GLTF_IMPORT_DISCARD_MESHES_AND_MATERIALS 32
#define GLTF_IMPORT_FORCE_DISABLE_MESH_COMPRESSION 64 #define GLTF_IMPORT_FORCE_DISABLE_MESH_COMPRESSION 64
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
constexpr int COMPONENT_COUNT_FOR_ACCESSOR_TYPE[7] = { constexpr int COMPONENT_COUNT_FOR_ACCESSOR_TYPE[7] = {
1, 2, 3, 4, 4, 9, 16 1, 2, 3, 4, 4, 9, 16

View File

@ -42,7 +42,7 @@
#include "Jolt/RegisterTypes.h" #include "Jolt/RegisterTypes.h"
#include <stdarg.h> #include <cstdarg>
void *jolt_alloc(size_t p_size) { void *jolt_alloc(size_t p_size) {
return Memory::alloc_static(p_size); return Memory::alloc_static(p_size);

View File

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <stdint.h> #include <cstdint>
enum JoltJointWorldNode : int { enum JoltJointWorldNode : int {
JOLT_JOINT_WORLD_NODE_A, JOLT_JOINT_WORLD_NODE_A,

View File

@ -34,7 +34,7 @@
#include "Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h" #include "Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h"
#include <stdint.h> #include <cstdint>
namespace JoltBroadPhaseLayer { namespace JoltBroadPhaseLayer {

View File

@ -34,7 +34,7 @@
#include "Jolt/Core/TempAllocator.h" #include "Jolt/Core/TempAllocator.h"
#include <stdint.h> #include <cstdint>
class JoltTempAllocator final : public JPH::TempAllocator { class JoltTempAllocator final : public JPH::TempAllocator {
uint64_t capacity = 0; uint64_t capacity = 0;

View File

@ -32,8 +32,6 @@
#include <turbojpeg.h> #include <turbojpeg.h>
#include <string.h>
Error jpeg_turbo_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p_buffer_len) { Error jpeg_turbo_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p_buffer_len) {
tjhandle tj_instance = tj3Init(TJINIT_DECOMPRESS); tjhandle tj_instance = tj3Init(TJINIT_DECOMPRESS);
if (tj_instance == NULL) { if (tj_instance == NULL) {

View File

@ -36,9 +36,6 @@
extern "C" { extern "C" {
#endif #endif
#include <stdbool.h>
#include <stdint.h>
// This is taken from the old GDNative, which was removed. // This is taken from the old GDNative, which was removed.
#define GODOT_VARIANT_SIZE (sizeof(real_t) * 4 + sizeof(int64_t)) #define GODOT_VARIANT_SIZE (sizeof(real_t) * 4 + sizeof(int64_t))

View File

@ -35,7 +35,7 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/os/os.h" #include "core/os/os.h"
#include <stdlib.h> #include <cstdlib>
#ifdef WINDOWS_ENABLED #ifdef WINDOWS_ENABLED
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -43,8 +43,8 @@
#define ENV_PATH_SEP ";" #define ENV_PATH_SEP ";"
#else #else
#include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <climits>
#define ENV_PATH_SEP ":" #define ENV_PATH_SEP ":"
#endif #endif

View File

@ -32,8 +32,8 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
namespace { namespace {

View File

@ -33,7 +33,7 @@
#include "core/string/ustring.h" #include "core/string/ustring.h"
#include "core/variant/variant.h" #include "core/variant/variant.h"
#include <stdarg.h> #include <cstdarg>
String sformat(const String &p_text, const String &p1 = String(), const String &p2 = String(), String sformat(const String &p_text, const String &p1 = String(), const String &p2 = String(),
const String &p3 = String(), const String &p4 = String(), const String &p5 = String(), const String &p6 = String()); const String &p3 = String(), const String &p4 = String(), const String &p5 = String(), const String &p6 = String());

View File

@ -60,7 +60,7 @@ using namespace godot;
#include <freetype/otsvg.h> #include <freetype/otsvg.h>
#include <ft2build.h> #include <ft2build.h>
#include <stdlib.h> #include <cstdlib>
FT_Error tvg_svg_in_ot_init(FT_Pointer *p_state) { FT_Error tvg_svg_in_ot_init(FT_Pointer *p_state) {
*p_state = memnew(TVG_State); *p_state = memnew(TVG_State);

View File

@ -60,7 +60,7 @@ using namespace godot;
#include <freetype/otsvg.h> #include <freetype/otsvg.h>
#include <ft2build.h> #include <ft2build.h>
#include <stdlib.h> #include <cstdlib>
FT_Error tvg_svg_in_ot_init(FT_Pointer *p_state) { FT_Error tvg_svg_in_ot_init(FT_Pointer *p_state) {
*p_state = memnew(TVG_State); *p_state = memnew(TVG_State);

View File

@ -37,7 +37,7 @@
#include <miniupnpc/miniwget.h> #include <miniupnpc/miniwget.h>
#include <miniupnpc/upnpcommands.h> #include <miniupnpc/upnpcommands.h>
#include <stdlib.h> #include <cstdlib>
void UPNPMiniUPNP::make_default() { void UPNPMiniUPNP::make_default() {
UPNP::_create = UPNPMiniUPNP::_create; UPNP::_create = UPNPMiniUPNP::_create;

View File

@ -35,8 +35,6 @@
#include <webp/decode.h> #include <webp/decode.h>
#include <webp/encode.h> #include <webp/encode.h>
#include <string.h>
namespace WebPCommon { namespace WebPCommon {
Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quality) { Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quality) {
ERR_FAIL_COND_V(p_image.is_null() || p_image->is_empty(), Vector<uint8_t>()); ERR_FAIL_COND_V(p_image.is_null() || p_image->is_empty(), Vector<uint8_t>());

View File

@ -34,8 +34,6 @@
extern "C" { extern "C" {
#endif #endif
#include <stddef.h>
enum WebXRInputEvent { enum WebXRInputEvent {
WEBXR_INPUT_EVENT_SELECTSTART, WEBXR_INPUT_EVENT_SELECTSTART,
WEBXR_INPUT_EVENT_SELECTEND, WEBXR_INPUT_EVENT_SELECTEND,

View File

@ -45,7 +45,7 @@
#include "servers/xr/xr_hand_tracker.h" #include "servers/xr/xr_hand_tracker.h"
#include <emscripten.h> #include <emscripten.h>
#include <stdlib.h> #include <cstdlib>
void _emwebxr_on_session_supported(char *p_session_mode, int p_supported) { void _emwebxr_on_session_supported(char *p_session_mode, int p_supported) {
XRServer *xr_server = XRServer::get_singleton(); XRServer *xr_server = XRServer::get_singleton();

View File

@ -30,8 +30,6 @@
#include "audio_driver_opensl.h" #include "audio_driver_opensl.h"
#include <string.h>
#define MAX_NUMBER_INTERFACES 3 #define MAX_NUMBER_INTERFACES 3
#define MAX_NUMBER_OUTPUT_DEVICES 6 #define MAX_NUMBER_OUTPUT_DEVICES 6

View File

@ -35,7 +35,7 @@
#include "core/io/dir_access.h" #include "core/io/dir_access.h"
#include "drivers/unix/dir_access_unix.h" #include "drivers/unix/dir_access_unix.h"
#include <stdio.h> #include <cstdio>
/// Android implementation of the DirAccess interface used to provide access to /// Android implementation of the DirAccess interface used to provide access to
/// ACCESS_FILESYSTEM and ACCESS_RESOURCES directory resources. /// ACCESS_FILESYSTEM and ACCESS_RESOURCES directory resources.

View File

@ -61,8 +61,6 @@
#include "../os_android.h" #include "../os_android.h"
#endif #endif
#include <string.h>
static const char *ANDROID_PERMS[] = { static const char *ANDROID_PERMS[] = {
"ACCESS_CHECKIN_PROPERTIES", "ACCESS_CHECKIN_PROPERTIES",
"ACCESS_COARSE_LOCATION", "ACCESS_COARSE_LOCATION",

View File

@ -35,7 +35,7 @@
#include <android/asset_manager.h> #include <android/asset_manager.h>
#include <android/log.h> #include <android/log.h>
#include <jni.h> #include <jni.h>
#include <stdio.h> #include <cstdio>
class FileAccessAndroid : public FileAccess { class FileAccessAndroid : public FileAccess {
GDSOFTCLASS(FileAccessAndroid, FileAccess); GDSOFTCLASS(FileAccessAndroid, FileAccess);

View File

@ -45,7 +45,6 @@
#include "main/splash.gen.h" #include "main/splash.gen.h"
#include "scene/resources/image_texture.h" #include "scene/resources/image_texture.h"
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
// Optional environment variables for defining confidential information. If any // Optional environment variables for defining confidential information. If any

View File

@ -33,9 +33,8 @@
#include "core/string/ustring.h" #include "core/string/ustring.h"
#include "main/main.h" #include "main/main.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <cstdio>
static OS_IOS *os = nullptr; static OS_IOS *os = nullptr;

View File

@ -46,8 +46,8 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <execinfo.h> #include <execinfo.h>
#include <link.h> #include <link.h>
#include <signal.h> #include <csignal>
#include <stdlib.h> #include <cstdlib>
static void handle_crash(int sig) { static void handle_crash(int sig) {
signal(SIGSEGV, SIG_DFL); signal(SIGSEGV, SIG_DFL);

View File

@ -32,7 +32,7 @@
#ifdef DBUS_ENABLED #ifdef DBUS_ENABLED
#include <stdint.h> #include <cstdint>
class FreeDesktopScreenSaver { class FreeDesktopScreenSaver {
private: private:

View File

@ -32,10 +32,10 @@
#include "main/main.h" #include "main/main.h"
#include <limits.h>
#include <locale.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <climits>
#include <clocale>
#include <cstdlib>
#if defined(SANITIZERS_ENABLED) #if defined(SANITIZERS_ENABLED)
#include <sys/resource.h> #include <sys/resource.h>

View File

@ -35,10 +35,10 @@
#include "core/os/os.h" #include "core/os/os.h"
#include <dirent.h> #include <dirent.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/input.h> #include <linux/input.h>
#include <unistd.h> #include <unistd.h>
#include <cerrno>
#ifdef UDEV_ENABLED #ifdef UDEV_ENABLED
#ifdef SOWRAP_ENABLED #ifdef SOWRAP_ENABLED

View File

@ -68,13 +68,12 @@
#endif #endif
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
#include <cstdio>
#include <cstdlib>
#if __has_include(<mntent.h>) #if __has_include(<mntent.h>)
#include <mntent.h> #include <mntent.h>

View File

@ -35,7 +35,7 @@
#endif #endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <stdlib.h> // alloca #include <cstdlib> // alloca
// FreeBSD and OpenBSD use pthread_set_name_np, while other platforms, // FreeBSD and OpenBSD use pthread_set_name_np, while other platforms,
// include NetBSD, use pthread_setname_np. NetBSD's version however requires // include NetBSD, use pthread_setname_np. NetBSD's version however requires
// a different format, we handle this directly in thread_posix. // a different format, we handle this directly in thread_posix.

View File

@ -36,13 +36,10 @@
#include "core/string/print_string.h" #include "core/string/print_string.h"
#include "core/string/ustring.h" #include "core/string/ustring.h"
#include <stdlib.h>
#include <cstring>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <cstdlib>
// To prevent shadowing warnings. // To prevent shadowing warnings.
#undef glGetString #undef glGetString

View File

@ -61,8 +61,8 @@
#include "core/input/input.h" #include "core/input/input.h"
#include "servers/display_server.h" #include "servers/display_server.h"
#include <limits.h> #include <climits>
#include <stdio.h> #include <cstdio>
#undef CursorShape #undef CursorShape

View File

@ -46,11 +46,10 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#endif #endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <cstdlib>
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092

View File

@ -58,13 +58,12 @@
#endif #endif
#include <dlfcn.h> #include <dlfcn.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <climits>
#include <cstdio>
#include <cstdlib>
#undef CursorShape #undef CursorShape
#include <X11/XKBlib.h> #include <X11/XKBlib.h>

View File

@ -34,9 +34,9 @@
#include "thirdparty/glad/glad/glx.h" #include "thirdparty/glad/glad/glx.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <cstdio>
#include <cstdlib>
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092

View File

@ -32,8 +32,8 @@
#if defined(X11_ENABLED) && defined(GLES3_ENABLED) #if defined(X11_ENABLED) && defined(GLES3_ENABLED)
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
const char *GLManagerEGL_X11::_get_platform_extension_name() const { const char *GLManagerEGL_X11::_get_platform_extension_name() const {
return "EGL_KHR_platform_x11"; return "EGL_KHR_platform_x11";

View File

@ -37,7 +37,6 @@
#include "core/version.h" #include "core/version.h"
#include "main/main.h" #include "main/main.h"
#include <string.h>
#include <unistd.h> #include <unistd.h>
#if defined(DEBUG_ENABLED) #if defined(DEBUG_ENABLED)
@ -48,8 +47,8 @@
#include <cxxabi.h> #include <cxxabi.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <execinfo.h> #include <execinfo.h>
#include <signal.h> #include <csignal>
#include <stdlib.h> #include <cstdlib>
#import <mach-o/dyld.h> #import <mach-o/dyld.h>
#import <mach-o/getsect.h> #import <mach-o/getsect.h>

View File

@ -34,7 +34,7 @@
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include <errno.h> #include <cerrno>
#import <AppKit/NSWorkspace.h> #import <AppKit/NSWorkspace.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>

View File

@ -32,8 +32,8 @@
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED) #if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#import <EGL/eglext_angle.h> #import <EGL/eglext_angle.h>

View File

@ -33,8 +33,8 @@
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED) #if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wdeprecated-declarations") // OpenGL is deprecated in macOS 10.14. GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wdeprecated-declarations") // OpenGL is deprecated in macOS 10.14.

View File

@ -32,7 +32,6 @@
#include "main/main.h" #include "main/main.h"
#include <string.h>
#include <unistd.h> #include <unistd.h>
#if defined(SANITIZERS_ENABLED) #if defined(SANITIZERS_ENABLED)

View File

@ -30,13 +30,12 @@
#pragma once #pragma once
#include <cstdint>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stddef.h>
#include <stdint.h>
extern int godot_audio_is_available(); extern int godot_audio_is_available();
extern int godot_audio_has_worklet(); extern int godot_audio_has_worklet();
extern int godot_audio_has_script_processor(); extern int godot_audio_has_script_processor();

View File

@ -32,13 +32,12 @@
#define WASM_EXPORT __attribute__((visibility("default"))) #define WASM_EXPORT __attribute__((visibility("default")))
#include <cstdint>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stddef.h>
#include <stdint.h>
// Config // Config
extern void godot_js_config_locale_get(char *p_ptr, int p_ptr_max); extern void godot_js_config_locale_get(char *p_ptr, int p_ptr_max);
extern void godot_js_config_canvas_id_get(char *p_ptr, int p_ptr_max); extern void godot_js_config_canvas_id_get(char *p_ptr, int p_ptr_max);

View File

@ -30,11 +30,12 @@
#pragma once #pragma once
#include <cstdint>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdint.h>
extern int godot_js_webmidi_open_midi_inputs( extern int godot_js_webmidi_open_midi_inputs(
void (*p_callback)(int p_size, const char **p_connected_input_names), void (*p_callback)(int p_size, const char **p_connected_input_names),
void (*p_on_midi_message)(int p_device_index, int p_status, const uint8_t *p_data, int p_data_len), void (*p_on_midi_message)(int p_device_index, int p_status, const uint8_t *p_data, int p_data_len),

View File

@ -36,8 +36,6 @@
extern "C" { extern "C" {
#endif #endif
#include <stddef.h>
typedef enum { typedef enum {
GODOT_JS_FETCH_STATE_REQUESTING = 0, GODOT_JS_FETCH_STATE_REQUESTING = 0,
GODOT_JS_FETCH_STATE_BODY = 1, GODOT_JS_FETCH_STATE_BODY = 1,

View File

@ -46,7 +46,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <emscripten.h> #include <emscripten.h>
#include <stdlib.h> #include <cstdlib>
void OS_Web::alert(const String &p_alert, const String &p_title) { void OS_Web::alert(const String &p_alert, const String &p_title) {
godot_js_display_alert(p_alert.utf8().get_data()); godot_js_display_alert(p_alert.utf8().get_data());

View File

@ -43,7 +43,7 @@
#endif #endif
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#include <stdlib.h> #include <cstdlib>
static OS_Web *os = nullptr; static OS_Web *os = nullptr;
#ifndef PROXY_TO_PTHREAD_ENABLED #ifndef PROXY_TO_PTHREAD_ENABLED

View File

@ -31,8 +31,8 @@
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4

View File

@ -40,8 +40,8 @@
#ifdef CRASH_HANDLER_EXCEPTION #ifdef CRASH_HANDLER_EXCEPTION
#include <cxxabi.h> #include <cxxabi.h>
#include <signal.h>
#include <algorithm> #include <algorithm>
#include <csignal>
#include <cstdlib> #include <cstdlib>
#include <iterator> #include <iterator>
#include <string> #include <string>

View File

@ -63,7 +63,7 @@
#include "native_menu_windows.h" #include "native_menu_windows.h"
#include <io.h> #include <io.h>
#include <stdio.h> #include <cstdio>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -32,8 +32,8 @@
#if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED) #if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED)
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <EGL/eglext_angle.h> #include <EGL/eglext_angle.h>

View File

@ -38,8 +38,8 @@
#include "thirdparty/misc/nvapi_minimal.h" #include "thirdparty/misc/nvapi_minimal.h"
#include <dwmapi.h> #include <dwmapi.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092

View File

@ -32,8 +32,8 @@
#include "main/main.h" #include "main/main.h"
#include <locale.h> #include <clocale>
#include <stdio.h> #include <cstdio>
// For export templates, add a section; the exporter will patch it to enclose // For export templates, add a section; the exporter will patch it to enclose
// the data appended to the executable (bundled PCK). // the data appended to the executable (bundled PCK).

View File

@ -50,7 +50,7 @@
#include <io.h> #include <io.h>
#include <shellapi.h> #include <shellapi.h>
#include <stdio.h> #include <cstdio>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <dwrite.h> #include <dwrite.h>

View File

@ -38,8 +38,8 @@
#include <objbase.h> #include <objbase.h>
#include <sapi.h> #include <sapi.h>
#include <wchar.h>
#include <winnls.h> #include <winnls.h>
#include <cwchar>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -40,8 +40,8 @@
#include <windows.h> #include <windows.h>
#include <dwmapi.h> #include <dwmapi.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092

View File

@ -34,7 +34,7 @@
#ifdef WINDOWS_ENABLED #ifdef WINDOWS_ENABLED
#include <stdio.h> #include <cstdio>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -41,7 +41,7 @@
#include "scene/main/window.h" #include "scene/main/window.h"
#include "scene/theme/theme_db.h" #include "scene/theme/theme_db.h"
#include <limits.h> #include <climits>
Size2 TreeItem::Cell::get_icon_size() const { Size2 TreeItem::Cell::get_icon_size() const {
if (icon.is_null()) { if (icon.is_null()) {

View File

@ -43,8 +43,6 @@
#include "servers/audio/audio_stream.h" #include "servers/audio/audio_stream.h"
#include "servers/audio/effects/audio_effect_compressor.h" #include "servers/audio/effects/audio_effect_compressor.h"
#include <cstring>
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
#define MARK_EDITED set_edited(true); #define MARK_EDITED set_edited(true);
#else #else

View File

@ -36,7 +36,7 @@
using namespace RendererRD; using namespace RendererRD;
#ifndef _MSC_VER #ifndef _MSC_VER
#include <wchar.h> #include <cwchar>
#define wcscpy_s wcscpy #define wcscpy_s wcscpy
#endif #endif

Some files were not shown because too many files have changed in this diff Show More