summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/dir_access.cpp10
-rw-r--r--core/os/dir_access.h4
-rw-r--r--core/os/file_access.cpp12
-rw-r--r--core/os/file_access.h8
-rw-r--r--core/os/keyboard.cpp2
-rw-r--r--core/os/memory.cpp12
-rw-r--r--core/os/midi_driver.cpp2
-rw-r--r--core/os/os.cpp16
-rw-r--r--core/os/os.h2
-rw-r--r--core/os/rw_lock.cpp4
-rw-r--r--core/os/thread.cpp10
11 files changed, 41 insertions, 41 deletions
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 642c86be2f..94c8cd5d73 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -226,11 +226,11 @@ String DirAccess::fix_path(String p_path) const {
return p_path;
}
-DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { 0, 0, 0 };
+DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { nullptr, nullptr, nullptr };
DirAccess *DirAccess::create_for_path(const String &p_path) {
- DirAccess *da = NULL;
+ DirAccess *da = nullptr;
if (p_path.begins_with("res://")) {
da = create(ACCESS_RESOURCES);
@@ -249,13 +249,13 @@ DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
DirAccess *da = create_for_path(p_path);
- ERR_FAIL_COND_V_MSG(!da, NULL, "Cannot create DirAccess for path '" + p_path + "'.");
+ ERR_FAIL_COND_V_MSG(!da, nullptr, "Cannot create DirAccess for path '" + p_path + "'.");
Error err = da->change_dir(p_path);
if (r_error)
*r_error = err;
if (err != OK) {
memdelete(da);
- return NULL;
+ return nullptr;
}
return da;
@@ -263,7 +263,7 @@ DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
DirAccess *DirAccess::create(AccessType p_access) {
- DirAccess *da = create_func[p_access] ? create_func[p_access]() : NULL;
+ DirAccess *da = create_func[p_access] ? create_func[p_access]() : nullptr;
if (da) {
da->_access_type = p_access;
}
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 059f7aad2f..60eb553968 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -128,7 +128,7 @@ public:
create_func[p_access] = _create_builtin<T>;
}
- static DirAccess *open(const String &p_path, Error *r_error = NULL);
+ static DirAccess *open(const String &p_path, Error *r_error = nullptr);
DirAccess();
virtual ~DirAccess();
@@ -141,7 +141,7 @@ struct DirAccessRef {
return f;
}
- operator bool() const { return f != NULL; }
+ operator bool() const { return f != nullptr; }
DirAccess *f;
DirAccessRef(DirAccess *fa) { f = fa; }
~DirAccessRef() {
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 30cfaa7617..3922f031b7 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -36,15 +36,15 @@
#include "core/os/os.h"
#include "core/project_settings.h"
-FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { 0, 0 };
+FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { nullptr, nullptr };
-FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = NULL;
+FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = nullptr;
bool FileAccess::backup_save = false;
FileAccess *FileAccess::create(AccessType p_access) {
- ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, 0);
+ ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, nullptr);
FileAccess *ret = create_func[p_access]();
ret->_set_access_type(p_access);
@@ -70,7 +70,7 @@ void FileAccess::_set_access_type(AccessType p_access) {
FileAccess *FileAccess::create_for_path(const String &p_path) {
- FileAccess *ret = NULL;
+ FileAccess *ret = nullptr;
if (p_path.begins_with("res://")) {
ret = create(ACCESS_RESOURCES);
@@ -95,7 +95,7 @@ FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_er
//try packed data first
- FileAccess *ret = NULL;
+ FileAccess *ret = nullptr;
if (!(p_mode_flags & WRITE) && PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled()) {
ret = PackedData::get_singleton()->try_open_path(p_path);
if (ret) {
@@ -113,7 +113,7 @@ FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_er
if (err != OK) {
memdelete(ret);
- ret = NULL;
+ ret = nullptr;
}
return ret;
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 4a82637ecc..010cc74a87 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -153,7 +153,7 @@ public:
static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
static FileAccess *create_for_path(const String &p_path);
- static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = NULL); /// Create a file access (for the current platform) this is the only portable way of accessing files.
+ static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); /// Create a file access (for the current platform) this is the only portable way of accessing files.
static CreateFunc get_create_func(AccessType p_access);
static bool exists(const String &p_name); ///< return true if a file exists
static uint64_t get_modified_time(const String &p_file);
@@ -167,8 +167,8 @@ public:
static String get_sha256(const String &p_file);
static String get_multiple_md5(const Vector<String> &p_file);
- static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = NULL);
- static String get_file_as_string(const String &p_path, Error *r_error = NULL);
+ static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = nullptr);
+ static String get_file_as_string(const String &p_path, Error *r_error = nullptr);
template <class T>
static void make_default(AccessType p_access) {
@@ -187,7 +187,7 @@ struct FileAccessRef {
return f;
}
- operator bool() const { return f != NULL; }
+ operator bool() const { return f != nullptr; }
FileAccess *f;
operator FileAccess *() { return f; }
FileAccessRef(FileAccess *fa) { f = fa; }
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 7141423c77..c65d3fefc2 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -288,7 +288,7 @@ static const _KeyCodeText _keycodes[] = {
{KEY_DIVISION ,"Division"},
{KEY_YDIAERESIS ,"Ydiaeresis"},
- {0 ,0}
+ {0 ,nullptr}
/* clang-format on */
};
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 39d3fce910..d921c10ad4 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -81,7 +81,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
- ERR_FAIL_COND_V(!mem, NULL);
+ ERR_FAIL_COND_V(!mem, nullptr);
atomic_increment(&alloc_count);
@@ -103,7 +103,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
- if (p_memory == NULL) {
+ if (p_memory == nullptr) {
return alloc_static(p_bytes, p_pad_align);
}
@@ -130,12 +130,12 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
if (p_bytes == 0) {
free(mem);
- return NULL;
+ return nullptr;
} else {
*s = p_bytes;
mem = (uint8_t *)realloc(mem, p_bytes + PAD_ALIGN);
- ERR_FAIL_COND_V(!mem, NULL);
+ ERR_FAIL_COND_V(!mem, nullptr);
s = (uint64_t *)mem;
@@ -147,7 +147,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
mem = (uint8_t *)realloc(mem, p_bytes);
- ERR_FAIL_COND_V(mem == NULL && p_bytes > 0, NULL);
+ ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr);
return mem;
}
@@ -155,7 +155,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
void Memory::free_static(void *p_ptr, bool p_pad_align) {
- ERR_FAIL_COND(p_ptr == NULL);
+ ERR_FAIL_COND(p_ptr == nullptr);
uint8_t *mem = (uint8_t *)p_ptr;
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index c23ade3088..985f6f38e5 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -34,7 +34,7 @@
#include "core/os/os.h"
uint8_t MIDIDriver::last_received_message = 0x00;
-MIDIDriver *MIDIDriver::singleton = NULL;
+MIDIDriver *MIDIDriver::singleton = nullptr;
MIDIDriver *MIDIDriver::get_singleton() {
return singleton;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 66ab3bbd8c..0636810e4b 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -40,7 +40,7 @@
#include <stdarg.h>
-OS *OS::singleton = NULL;
+OS *OS::singleton = nullptr;
OS *OS::get_singleton() {
@@ -184,7 +184,7 @@ void OS::dump_memory_to_file(const char *p_file) {
//Memory::dump_static_mem_to_file(p_file);
}
-static FileAccess *_OSPRF = NULL;
+static FileAccess *_OSPRF = nullptr;
static void _OS_printres(Object *p_obj) {
@@ -207,7 +207,7 @@ void OS::print_all_resources(String p_to_file) {
Error err;
_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
if (err != OK) {
- _OSPRF = NULL;
+ _OSPRF = nullptr;
ERR_FAIL_MSG("Can't print all resources to file: " + String(p_to_file) + ".");
}
}
@@ -218,13 +218,13 @@ void OS::print_all_resources(String p_to_file) {
if (_OSPRF)
memdelete(_OSPRF);
- _OSPRF = NULL;
+ _OSPRF = nullptr;
}
}
void OS::print_resources_in_use(bool p_short) {
- ResourceCache::dump(NULL, p_short);
+ ResourceCache::dump(nullptr, p_short);
}
void OS::dump_resources_to_file(const char *p_file) {
@@ -523,9 +523,9 @@ OS::OS() {
_allow_layered = false;
_stack_bottom = (void *)(&stack_bottom);
- _logger = NULL;
+ _logger = nullptr;
- has_server_feature_callback = NULL;
+ has_server_feature_callback = nullptr;
Vector<Logger *> loggers;
loggers.push_back(memnew(StdLogger));
@@ -534,5 +534,5 @@ OS::OS() {
OS::~OS() {
memdelete(_logger);
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/core/os/os.h b/core/os/os.h
index a31b1c1f4b..714a10bf76 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -130,7 +130,7 @@ public:
virtual int get_low_processor_usage_mode_sleep_usec() const;
virtual String get_executable_path() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL) = 0;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr) = 0;
virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
virtual void vibrate_handheld(int p_duration_ms = 500);
diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp
index 75683962af..1dd2c3bccb 100644
--- a/core/os/rw_lock.cpp
+++ b/core/os/rw_lock.cpp
@@ -34,11 +34,11 @@
#include <stddef.h>
-RWLock *(*RWLock::create_func)() = 0;
+RWLock *(*RWLock::create_func)() = nullptr;
RWLock *RWLock::create() {
- ERR_FAIL_COND_V(!create_func, 0);
+ ERR_FAIL_COND_V(!create_func, nullptr);
return create_func();
}
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index 7f6148057d..294b52f00c 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -30,10 +30,10 @@
#include "thread.h"
-Thread *(*Thread::create_func)(ThreadCreateCallback, void *, const Settings &) = NULL;
-Thread::ID (*Thread::get_thread_id_func)() = NULL;
-void (*Thread::wait_to_finish_func)(Thread *) = NULL;
-Error (*Thread::set_name_func)(const String &) = NULL;
+Thread *(*Thread::create_func)(ThreadCreateCallback, void *, const Settings &) = nullptr;
+Thread::ID (*Thread::get_thread_id_func)() = nullptr;
+void (*Thread::wait_to_finish_func)(Thread *) = nullptr;
+Error (*Thread::set_name_func)(const String &) = nullptr;
Thread::ID Thread::_main_thread_id = 0;
@@ -50,7 +50,7 @@ Thread *Thread::create(ThreadCreateCallback p_callback, void *p_user, const Sett
return create_func(p_callback, p_user, p_settings);
}
- return NULL;
+ return nullptr;
}
void Thread::wait_to_finish(Thread *p_thread) {