mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
cstring helper for wide chars
This commit is contained in:
+15
-4
@@ -215,12 +215,23 @@ str32_cstring(U32 *c){
|
|||||||
internal String8
|
internal String8
|
||||||
str8_cstring_capped(void *cstr, void *cap)
|
str8_cstring_capped(void *cstr, void *cap)
|
||||||
{
|
{
|
||||||
char *ptr = (char*)cstr;
|
char *ptr = cstr;
|
||||||
char *opl = (char*)cap;
|
char *opl = cap;
|
||||||
for (;ptr < opl && *ptr != 0; ptr += 1);
|
for (;ptr < opl && *ptr != 0; ptr += 1);
|
||||||
U64 size = (U64)(ptr - (char *)cstr);
|
U64 size = (U64)(ptr - (char *)cstr);
|
||||||
String8 result = {(U8*)cstr, size};
|
String8 result = str8((U8*)cstr, size);
|
||||||
return(result);
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal String16
|
||||||
|
str16_cstring_capped(void *cstr, void *cap)
|
||||||
|
{
|
||||||
|
U16 *ptr = cstr;
|
||||||
|
U16 *opl = cap;
|
||||||
|
for (;ptr < opl && *ptr != 0; ptr += 1);
|
||||||
|
U64 size = (U64)(ptr - (U16 *)cstr);
|
||||||
|
String16 result = str16(cstr, size);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ internal String8 str8_cstring(char *c);
|
|||||||
internal String16 str16_cstring(U16 *c);
|
internal String16 str16_cstring(U16 *c);
|
||||||
internal String32 str32_cstring(U32 *c);
|
internal String32 str32_cstring(U32 *c);
|
||||||
internal String8 str8_cstring_capped(void *cstr, void *cap);
|
internal String8 str8_cstring_capped(void *cstr, void *cap);
|
||||||
|
internal String16 str16_cstring_capped(void *cstr, void *cap);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: String Stylization
|
//~ rjf: String Stylization
|
||||||
|
|||||||
Reference in New Issue
Block a user