summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-11 22:29:08 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-11 22:29:08 +0000
commit7147ed7ab6eaaee5c986b72d0f06f717986f56c6 (patch)
treeb63d523b304b2d64b0d7aba5a18686d94659d737 /libvo
parentfad12bd37bfda1709cb4945446ded4bf04db5b07 (diff)
downloadmpv-7147ed7ab6eaaee5c986b72d0f06f717986f56c6.tar.bz2
mpv-7147ed7ab6eaaee5c986b72d0f06f717986f56c6.tar.xz
Reuse utf8_get_char in subtitle rendering code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21596 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/sub.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libvo/sub.c b/libvo/sub.c
index 3b0edf8bf8..b053eeb530 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -428,20 +428,13 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
x = 1;
// reading the subtitle words from vo_sub->text[]
- for (j=0;j<=len;j++){
- if ((c=t[j])>=0x80){
- if (sub_utf8){
- if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/
- c = (c & 0x1f)<<6 | (t[++j] & 0x3f);
- else if((c & 0xf0) == 0xe0){ /* 3 bytes U+00800..U+00FFFF*/
- c = (((c & 0x0f)<<6) | (t[++j] & 0x3f))<<6;
- c |= (t[++j] & 0x3f);
- }
- } else if (sub_unicode)
- c = (c<<8) + t[++j];
- }
+ while (*t) {
+ if (sub_utf8)
+ c = utf8_get_char(&t);
+ else if ((c = *t++) >= 0x80 && sub_unicode)
+ c = (c<<8) + *t++;
if (k==MAX_UCS){
- len=j; // end here
+ t += strlen(t); // end here
mp_msg(MSGT_OSD,MSGL_WARN,"\nMAX_UCS exceeded!\n");
}
if (!c) c++; // avoid UCS 0