summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/UtfUtils.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-10-26 16:01:12 +0100
committerGitHub <noreply@github.com>2025-10-26 16:01:12 +0100
commit36269e57831e560df6a0da9c9d02c00671b0163d (patch)
tree69f6a0c6f08ef5ef2f6fcbb7302537dbce222e6e /dev/kernel/src/UtfUtils.cc
parent2117a9b0f4b84f5bd6c99566bcf5849a64104467 (diff)
parentb6ce6640afaf6c1cc6ad274f3053b2e218a49554 (diff)
Merge pull request #68 from nekernel-org/dev
NeKernel: v0.0.6e1
Diffstat (limited to 'dev/kernel/src/UtfUtils.cc')
-rw-r--r--dev/kernel/src/UtfUtils.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/dev/kernel/src/UtfUtils.cc b/dev/kernel/src/UtfUtils.cc
index e98b8306..d0523b96 100644
--- a/dev/kernel/src/UtfUtils.cc
+++ b/dev/kernel/src/UtfUtils.cc
@@ -10,6 +10,8 @@
namespace Kernel {
Size urt_string_len(const Utf8Char* str) {
+ if (!str) return 0;
+
SizeT len{0};
while (str[len] != u8'\0') ++len;
@@ -18,6 +20,8 @@ Size urt_string_len(const Utf8Char* str) {
}
Void urt_set_memory(const voidPtr src, UInt32 dst, Size len) {
+ if (!src) return;
+
Utf8Char* srcChr = reinterpret_cast<Utf8Char*>(src);
Size index = 0;
@@ -28,6 +32,8 @@ Void urt_set_memory(const voidPtr src, UInt32 dst, Size len) {
}
Int32 urt_string_cmp(const Utf8Char* src, const Utf8Char* cmp, Size size) {
+ if (!src) return 0;
+
Int32 counter = 0;
for (Size index = 0; index < size; ++index) {
@@ -38,6 +44,9 @@ Int32 urt_string_cmp(const Utf8Char* src, const Utf8Char* cmp, Size size) {
}
Int32 urt_copy_memory(const VoidPtr src, VoidPtr dst, Size len) {
+ if (!src) return 0;
+ if (!dst) return 0;
+
Utf8Char* srcChr = reinterpret_cast<Utf8Char*>(src);
Utf8Char* dstChar = reinterpret_cast<Utf8Char*>(dst);