forked from len0rd/rockbox
More efficient version of the fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14619 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fcab061250
commit
af533820ee
1 changed files with 3 additions and 4 deletions
|
@ -512,13 +512,12 @@ static int unicode_len(char encoding, const void* string)
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (encoding == 0x01 || encoding == 0x02) {
|
if (encoding == 0x01 || encoding == 0x02) {
|
||||||
bool iswchar;
|
char first;
|
||||||
const char *s = string;
|
const char *s = string;
|
||||||
/* string might be unaligned, so using short* can crash on ARM and SH1 */
|
/* string might be unaligned, so using short* can crash on ARM and SH1 */
|
||||||
do {
|
do {
|
||||||
iswchar = (*s++ != 0);
|
first = *s++;
|
||||||
iswchar |= (*s++ != 0);
|
} while ((first | *s++) != 0);
|
||||||
} while (iswchar);
|
|
||||||
|
|
||||||
len = s - (const char*) string;
|
len = s - (const char*) string;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue