46 lines
547 B
C
46 lines
547 B
C
/*++
|
|
|
|
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);
|
|
}
|