summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2011-09-11 15:29:56 +0000
committerFrank Gevaerts <frank@gevaerts.be>2011-09-11 15:29:56 +0000
commitbce46a755d65194d71992572e293daa781977818 (patch)
tree31146a9dabb1c129e8fc17e0e7a9c9eca252b272
parent7179490b5fd93213c248ae1b2d70ab4626dbf548 (diff)
downloadrockbox-bce46a755d65194d71992572e293daa781977818.tar.gz
rockbox-bce46a755d65194d71992572e293daa781977818.zip
Make %ss utf8-aware
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30508 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/skin_tokens.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index a4f0814945..51da8c1c18 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -877,18 +877,19 @@ const char *get_token_value(struct gui_wps *gwps,
877 int ret_len = ss->length; 877 int ret_len = ss->length;
878 if (token_val) 878 if (token_val)
879 { 879 {
880 int len = strlen(token_val); 880 int len = utf8length(token_val);
881 if (len < ss->start) 881 if (len < ss->start)
882 return NULL; 882 return NULL;
883 int realstart = utf8seek(token_val, ss->start);
883 if (ret_len < 0) 884 if (ret_len < 0)
884 ret_len = strlen(token_val) - ss->start; 885 ret_len = strlen(token_val) - realstart;
885 if (token_val != buf) 886 if (token_val != buf)
886 { 887 {
887 memcpy(buf, &token_val[ss->start], ret_len); 888 memcpy(buf, &token_val[realstart], ret_len);
888 } 889 }
889 else 890 else
890 { 891 {
891 buf = &buf[ss->start]; 892 buf = &buf[realstart];
892 } 893 }
893 buf[ret_len] = '\0'; 894 buf[ret_len] = '\0';
894 return buf; 895 return buf;