diff options
author | bunnei <bunneidev@gmail.com> | 2014-08-19 03:42:44 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-08-19 03:42:44 +0200 |
commit | e9c5c563a500ac19ecb2f580ce065a9010dedac9 (patch) | |
tree | 25155672077a81a5f1b66e738826a7b850c55e82 /src/core/hle/kernel | |
parent | Merge pull request #45 from bunnei/master (diff) | |
parent | Core: Alter the kernel string functions to use std::string instead of const char*. (diff) | |
download | yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar.gz yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar.bz2 yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar.lz yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar.xz yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.tar.zst yuzu-e9c5c563a500ac19ecb2f580ce065a9010dedac9.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/event.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.h | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 17 |
8 files changed, 22 insertions, 25 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index bdf76e0c2..174d4cd6e 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -17,8 +17,8 @@ namespace Kernel { class AddressArbiter : public Object { public: - const char* GetTypeName() const { return "Arbiter"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Arbiter"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return HandleType::AddressArbiter; } Kernel::HandleType GetHandleType() const { return HandleType::AddressArbiter; } diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 76b2520da..5079fcb84 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -31,8 +31,8 @@ enum class FileCommand : u32 { class Archive : public Object { public: - const char* GetTypeName() const { return "Archive"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Archive"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return HandleType::Archive; } Kernel::HandleType GetHandleType() const { return HandleType::Archive; } @@ -110,7 +110,7 @@ Result MountArchive(Archive* archive) { return -1; } g_archive_map[id_code] = archive->GetHandle(); - INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName()); + INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName().c_str()); return 0; } diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 1e417e09c..64f6a9649 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -16,8 +16,8 @@ namespace Kernel { class Event : public Object { public: - const char* GetTypeName() const { return "Event"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Event"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 7d9bd261e..96bc63a53 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -71,8 +71,8 @@ void ObjectPool::List() { for (int i = 0; i < MAX_COUNT; i++) { if (occupied[i]) { if (pool[i]) { - INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName(), - pool[i]->GetName()); + INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), + pool[i]->GetName().c_str()); } } } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index d9afcdd25..6a2e395ed 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -4,6 +4,7 @@ #pragma once +#include <string> #include "common/common.h" typedef u32 Handle; @@ -33,7 +34,6 @@ enum class HandleType : u32 { }; enum { - MAX_NAME_LENGTH = 0x100, DEFAULT_STACK_SIZE = 0x4000, }; @@ -45,8 +45,8 @@ class Object : NonCopyable { public: virtual ~Object() {} Handle GetHandle() const { return handle; } - virtual const char* GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } - virtual const char* GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } + virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } + virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } virtual Kernel::HandleType GetHandleType() const = 0; /** diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 055f503f9..5d7d65dd9 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -15,8 +15,8 @@ namespace Kernel { class Mutex : public Object { public: - const char* GetTypeName() const { return "Mutex"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Mutex"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 52823048f..2a6a483a1 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -11,7 +11,7 @@ namespace Kernel { class SharedMemory : public Object { public: - const char* GetTypeName() const { return "SharedMemory"; } + std::string GetTypeName() const { return "SharedMemory"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::SharedMemory; } diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 1d7ded6f6..554ec9756 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -2,13 +2,12 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include <stdio.h> - -#include <list> #include <algorithm> -#include <vector> +#include <cstdio> +#include <list> #include <map> #include <string> +#include <vector> #include "common/common.h" #include "common/thread_queue_list.h" @@ -25,8 +24,8 @@ namespace Kernel { class Thread : public Kernel::Object { public: - const char* GetName() const { return name; } - const char* GetTypeName() const { return "Thread"; } + std::string GetName() const { return name; } + std::string GetTypeName() const { return "Thread"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } @@ -71,7 +70,7 @@ public: std::vector<Handle> waiting_threads; - char name[Kernel::MAX_NAME_LENGTH + 1]; + std::string name; }; // Lists all thread ids that aren't deleted/etc. @@ -336,9 +335,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio thread->processor_id = processor_id; thread->wait_type = WAITTYPE_NONE; thread->wait_handle = 0; - - strncpy(thread->name, name, Kernel::MAX_NAME_LENGTH); - thread->name[Kernel::MAX_NAME_LENGTH] = '\0'; + thread->name = name; return thread; } |