diff options
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r-- | drivers/unix/os_unix.cpp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 2d8d37b2f1..53c60951b7 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -32,16 +32,16 @@ #ifdef UNIX_ENABLED +#include "core/debugger/engine_debugger.h" +#include "core/debugger/script_debugger.h" #include "core/os/thread_dummy.h" #include "core/project_settings.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" -#include "drivers/unix/mutex_posix.h" #include "drivers/unix/net_socket_posix.h" #include "drivers/unix/rw_lock_posix.h" -#include "drivers/unix/semaphore_posix.h" #include "drivers/unix/thread_posix.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #ifdef __APPLE__ #include <mach-o/dyld.h> @@ -96,20 +96,20 @@ void OS_Unix::debug_break() { }; static void handle_interrupt(int sig) { - if (ScriptDebugger::get_singleton() == NULL) + if (!EngineDebugger::is_active()) return; - ScriptDebugger::get_singleton()->set_depth(-1); - ScriptDebugger::get_singleton()->set_lines_left(1); + EngineDebugger::get_script_debugger()->set_depth(-1); + EngineDebugger::get_script_debugger()->set_lines_left(1); } void OS_Unix::initialize_debugging() { - if (ScriptDebugger::get_singleton() != NULL) { + if (EngineDebugger::is_active()) { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = handle_interrupt; - sigaction(SIGINT, &action, NULL); + sigaction(SIGINT, &action, nullptr); } } @@ -122,15 +122,9 @@ void OS_Unix::initialize_core() { #ifdef NO_THREADS ThreadDummy::make_default(); - SemaphoreDummy::make_default(); - MutexDummy::make_default(); RWLockDummy::make_default(); #else ThreadPosix::make_default(); -#if !defined(OSX_ENABLED) && !defined(IPHONE_ENABLED) - SemaphorePosix::make_default(); -#endif - MutexPosix::make_default(); RWLockPosix::make_default(); #endif FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES); @@ -178,24 +172,24 @@ String OS_Unix::get_name() const { uint64_t OS_Unix::get_unix_time() const { - return time(NULL); + return time(nullptr); }; uint64_t OS_Unix::get_system_time_secs() const { struct timeval tv_now; - gettimeofday(&tv_now, NULL); + gettimeofday(&tv_now, nullptr); return uint64_t(tv_now.tv_sec); } uint64_t OS_Unix::get_system_time_msecs() const { struct timeval tv_now; - gettimeofday(&tv_now, NULL); + gettimeofday(&tv_now, nullptr); return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000; } OS::Date OS_Unix::get_date(bool utc) const { - time_t t = time(NULL); + time_t t = time(nullptr); struct tm *lt; if (utc) lt = gmtime(&t); @@ -215,7 +209,7 @@ OS::Date OS_Unix::get_date(bool utc) const { } OS::Time OS_Unix::get_time(bool utc) const { - time_t t = time(NULL); + time_t t = time(nullptr); struct tm *lt; if (utc) lt = gmtime(&t); @@ -230,7 +224,7 @@ OS::Time OS_Unix::get_time(bool utc) const { } OS::TimeZoneInfo OS_Unix::get_time_zone_info() const { - time_t t = time(NULL); + time_t t = time(nullptr); struct tm *lt = localtime(&t); char name[16]; strftime(name, 16, "%Z", lt); @@ -310,7 +304,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo if (p_pipe_mutex) { p_pipe_mutex->lock(); } - (*r_pipe) += buf; + (*r_pipe) += String::utf8(buf); if (p_pipe_mutex) { p_pipe_mutex->unlock(); } @@ -385,7 +379,7 @@ int OS_Unix::get_process_id() const { bool OS_Unix::has_environment(const String &p_var) const { - return getenv(p_var.utf8().get_data()) != NULL; + return getenv(p_var.utf8().get_data()) != nullptr; } String OS_Unix::get_locale() const { @@ -439,7 +433,7 @@ Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const S p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data()); error = dlerror(); - if (error != NULL) { + if (error != nullptr) { ERR_FAIL_COND_V_MSG(!p_optional, ERR_CANT_RESOLVE, "Can't resolve symbol " + p_name + ". Error: " + error + "."); return ERR_CANT_RESOLVE; @@ -517,7 +511,7 @@ String OS_Unix::get_executable_path() const { int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; char buf[MAXPATHLEN]; size_t len = sizeof(buf); - if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) { + if (sysctl(mib, 4, buf, &len, nullptr, 0) != 0) { WARN_PRINT("Couldn't get executable path from sysctl"); return OS::get_executable_path(); } |