1
0
Fork 0
forked from len0rd/rockbox

Revert "internals: Support characters beyond the first unicode plane (WIP)"

This reverts commit d05c59f35b.
This commit is contained in:
Solomon Peachy 2025-08-20 16:09:49 -04:00
parent d05c59f35b
commit 84504c7471
44 changed files with 335 additions and 480 deletions

View file

@ -22,8 +22,8 @@
#include "kbd_helper.h"
/* USAGE:
ucschar_t kbd[64];
ucschar_t *kbd_p = kbd;
unsigned short kbd[64];
unsigned short *kbd_p = kbd;
if (!kbd_create_layout("ABCD1234\n", kbd, sizeof(kbd)))
kbd_p = NULL;
@ -34,14 +34,14 @@
* success returns size of buffer used
* failure returns 0
*/
int kbd_create_layout(const char *layout, ucschar_t *buf, int bufsz)
int kbd_create_layout(const char *layout, unsigned short *buf, int bufsz)
{
ucschar_t *pbuf;
unsigned short *pbuf;
const unsigned char *p = layout;
int len = 0;
int total_len = 0;
pbuf = buf;
while (*p && (pbuf - buf + (ptrdiff_t) sizeof(ucschar_t)) < bufsz)
while (*p && (pbuf - buf + (ptrdiff_t) sizeof(unsigned short)) < bufsz)
{
p = rb->utf8decode(p, &pbuf[len+1]);
if (pbuf[len+1] == '\n')
@ -60,7 +60,7 @@ int kbd_create_layout(const char *layout, ucschar_t *buf, int bufsz)
*pbuf = len;
pbuf[len+1] = 0xFEFF; /* mark end of characters */
total_len += len + 1;
return total_len * sizeof(ucschar_t);
return total_len * sizeof(unsigned short);
}
return 0;