Add SDK/CRT string routines and headers

This commit is contained in:
2024-08-08 08:04:59 -04:00
parent 70489d6d39
commit 8ff7a75afc
8 changed files with 357 additions and 10 deletions

45
SDK/CRT/STRING/wstr.c Normal file
View File

@@ -0,0 +1,45 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
wstr.c
Abstract:
Provides wide string manipulation routines.
--*/
#include <wchar.h>
size_t
wcslen (
const wchar_t *str
)
{
const wchar_t *ptr;
ptr = str;
while (*ptr++);
return (const char*)ptr - (const char*)str - sizeof(wchar_t);
}
size_t
wcsnlen (
const wchar_t *str,
size_t maxlen
)
{
size_t len;
len = 0;
while (len < maxlen && str[len++]);
return len - sizeof(wchar_t);
}