mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-25 16:37:42 +01:00
Correct unicode_conversion (but unused in Clover).
This commit is contained in:
parent
a9bfb87ec2
commit
d6192ab7ab
@ -329,8 +329,13 @@ size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_size, const c
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
size_t size = utf32_stringnn_from_utf8_string(dst, dst_max_size, s);
|
||||
*(dst+size) = 0;
|
||||
if ( size >= dst_max_size ) {
|
||||
*(dst + dst_max_size - 1) = 0;
|
||||
return dst_max_size-1;
|
||||
}else{
|
||||
*(dst + size) = 0;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
//
|
||||
//size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_size, const char* s)
|
||||
@ -866,7 +871,7 @@ size_t utf32_stringnn_from_utf16_string(char32_t* dst, size_t dst_max_size, cons
|
||||
if ( !s ) return 0;
|
||||
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_size - 1;
|
||||
char32_t* p_max = dst + dst_max_size;
|
||||
|
||||
char32_t c;
|
||||
while ( *s && p < p_max ) {
|
||||
|
@ -103,9 +103,17 @@ size_t utf8_size_of_utf32_string_len(const char32_t* s, size_t len);
|
||||
size_t utf32_size_of_utf8_string(const char* s);
|
||||
size_t utf32_size_of_utf8_string_len(const char* s, size_t len);
|
||||
|
||||
/*
|
||||
* Convert s to dst. Do not add null terminator.
|
||||
* Return the number of utf32 char written
|
||||
*/
|
||||
size_t utf32_stringnn_from_utf8_string(char32_t* dst, size_t dst_max_size, const char* s);
|
||||
size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_size, const char* s);
|
||||
size_t utf32_string_from_utf8_string_len(char32_t* dst, size_t dst_max_size, const char* s, size_t len);
|
||||
/*
|
||||
* Convert s to dst. Do not add null terminator.
|
||||
* Return the number of utf8 char written
|
||||
*/
|
||||
size_t utf8_stringnn_from_utf32_string(char* dst, size_t dst_max_size, const char32_t *s);
|
||||
size_t utf8_string_from_utf32_string(char* dst, size_t dst_max_size, const char32_t *s);
|
||||
size_t utf8_string_from_utf32_string_len(char* dst, size_t dst_max_size, const char32_t *s, size_t len);
|
||||
|
Loading…
Reference in New Issue
Block a user