MCPcopy Create free account
hub / github.com/cococry/leif / str_to_wstr

Function str_to_wstr

leif.c:3055–3070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3053
3054
3055static wchar_t* str_to_wstr(const char* str) {
3056 size_t len = strlen(str) + 1;
3057
3058 wchar_t* wstr = (wchar_t*)malloc(len * sizeof(wchar_t));
3059 if (wstr == NULL) {
3060 perror("Memory allocation failed");
3061 return NULL;
3062 }
3063 if (mbstowcs(wstr, str, len) == (size_t)-1) {
3064 perror("Conversion failed");
3065 free(wstr);
3066 return NULL;
3067 }
3068
3069 return wstr;
3070}
3071
3072LfTextProps lf_text_render(vec2s pos, const char* str, LfFont font, LfColor color,
3073 int32_t wrap_point, vec2s stop_point, bool no_render, bool render_solid, int32_t start_index, int32_t end_index) {

Callers 1

lf_text_renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected