mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
unicode: add iso_decode_ex with utf8 buffer size check
Make use of it in id3tags, playlist and cuesheet Change-Id: Ibc8abc0faf16688bc9b826b7a712d1dfe9bf75b2
This commit is contained in:
parent
f8fa1e7d5a
commit
004304dc65
5 changed files with 56 additions and 37 deletions
|
|
@ -350,14 +350,7 @@ static int convert_m3u_name(char* buf, int buf_len, int buf_max, char* temp)
|
|||
buf_len = i;
|
||||
dest = temp;
|
||||
|
||||
/* Convert char by char, so as to not overflow temp (iso_decode should
|
||||
* preferably handle this). No more than 4 bytes should be generated for
|
||||
* each input char.
|
||||
*/
|
||||
for (i = 0; i < buf_len && dest < (temp + buf_max - 4); i++)
|
||||
{
|
||||
dest = iso_decode(&buf[i], dest, -1, 1);
|
||||
}
|
||||
dest = iso_decode_ex(buf, dest, -1, buf_len, buf_max - 1);
|
||||
|
||||
*dest = 0;
|
||||
strcpy(buf, temp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue