Bugfix: bidi_l2v() returned a pointer to value on the stack when the argument was an empty string. * Don't protect against NULL pointer, that would be a bug in the caller.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11282 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-10-21 00:04:57 +00:00
parent 10363b3a81
commit 9d3fddaa63

View file

@ -138,15 +138,15 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation)
//long max_chars=0;
//int begin, end, char_count, orig_begin;
if (!str || !*str)
return &(unsigned short){0};
//tmp = str;
target = tmp = utf16_buf;
while (*str)
str = utf8decode(str, target++);
*target = 0;
if (target == utf16_buf) /* empty string */
return target;
/* properly join any arabic chars */
arabjoin(utf16_buf, length);