mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Lua Fix utf8encode, remove utf16 functions
The auto generated utf8/16 encode/decode functions did not work. Upon implementing them correctly I found that lua handles the utf-8 form properly but I could not get utf-16 to work without crashing maybe someone can come along later and implement utf-16 safe string functions but for now utf-16 is removed. Change-Id: I97a044e200dc27f683a45487cd93fce667c670c4
This commit is contained in:
parent
bbfe477811
commit
be7a58c331
2 changed files with 16 additions and 0 deletions
|
@ -472,6 +472,16 @@ RB_WRAP(create_numbered_filename)
|
|||
return 1;
|
||||
}
|
||||
|
||||
RB_WRAP(utf8encode)
|
||||
{
|
||||
unsigned long ucs = (unsigned long) luaL_checkint(L, 1);
|
||||
unsigned char tmp[9];
|
||||
unsigned char *end = rb->utf8encode(ucs, tmp);
|
||||
*end = '\0';
|
||||
lua_pushstring(L, tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define RB_FUNC(func) {#func, rock_##func}
|
||||
static const luaL_Reg rocklib[] =
|
||||
{
|
||||
|
@ -520,6 +530,9 @@ static const luaL_Reg rocklib[] =
|
|||
#if CONFIG_CODEC == SWCODEC
|
||||
RB_FUNC(pcm),
|
||||
#endif
|
||||
|
||||
RB_FUNC(utf8encode),
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
#undef RB_FUNC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue