mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b
.
This commit is contained in:
parent
d05c59f35b
commit
84504c7471
44 changed files with 335 additions and 480 deletions
|
@ -127,7 +127,7 @@ static int volatile cp_table_ref = 0;
|
|||
|
||||
/* non-default codepage table buffer (cannot be bufalloced! playback itself
|
||||
may be making the load request) */
|
||||
static unsigned short codepage_table[MAX_CP_TABLE_SIZE+1]; // XXX convert to ucschar_t if we ever need > 16bit mappings?
|
||||
static unsigned short codepage_table[MAX_CP_TABLE_SIZE+1];
|
||||
|
||||
#if defined(APPLICATION) && defined(__linux__)
|
||||
static const char * const name_codepages_linux[NUM_CODEPAGES+1] =
|
||||
|
@ -344,7 +344,7 @@ unsigned char* iso_decode_ex(const unsigned char *iso, unsigned char *utf8, int
|
|||
cp_lock_leave();
|
||||
|
||||
while (count-- && utf8_size > 0) {
|
||||
ucschar_t ucs, tmp;
|
||||
unsigned short ucs, tmp;
|
||||
|
||||
if (*iso < 128 || cp == UTF_8) /* Already UTF-8 */
|
||||
{
|
||||
|
@ -420,6 +420,10 @@ unsigned char* iso_decode_ex(const unsigned char *iso, unsigned char *utf8, int
|
|||
unsigned char* utf16decode(const unsigned char *utf16, unsigned char *utf8,
|
||||
int count, int utf8_size, bool le)
|
||||
{
|
||||
// little-endian flag is used as significant byte index
|
||||
if (le)
|
||||
le = 1;
|
||||
|
||||
unsigned long ucs;
|
||||
|
||||
while (count > 0 && utf8_size > 0) {
|
||||
|
@ -507,25 +511,8 @@ unsigned long utf8length(const unsigned char *utf8)
|
|||
return l;
|
||||
}
|
||||
|
||||
/* Take a utf8 string and return the encoded length in utf16 code units */
|
||||
unsigned long utf16len_utf8(const unsigned char *utf8)
|
||||
{
|
||||
ucschar_t cp;
|
||||
unsigned long length = 0;
|
||||
while (*utf8) {
|
||||
utf8 = utf8decode(utf8, &cp);
|
||||
#ifdef UNICODE32
|
||||
if (cp > 0x10000)
|
||||
length++;
|
||||
#endif
|
||||
length++;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* Decode 1 UTF-8 char and return a pointer to the next char. */
|
||||
const unsigned char* utf8decode(const unsigned char *utf8, ucschar_t *ucs)
|
||||
const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs)
|
||||
{
|
||||
unsigned char c = *utf8++;
|
||||
unsigned long code;
|
||||
|
@ -565,13 +552,8 @@ const unsigned char* utf8decode(const unsigned char *utf8, ucschar_t *ucs)
|
|||
/* Invalid UTF-8 char */
|
||||
code = 0xfffd;
|
||||
}
|
||||
|
||||
#ifndef UNICODE32
|
||||
if (code > 0xffff)
|
||||
code = 0xfffd;
|
||||
#endif
|
||||
|
||||
*ucs = code;
|
||||
/* currently we don't support chars above U-FFFF */
|
||||
*ucs = (code < 0x10000) ? code : 0xfffd;
|
||||
return utf8;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue