Mercurial > audlegacy
comparison libaudacious/titlestring.c @ 1594:44f67f556b60 trunk
[svn] - precision in title format is regarded as character count, not byte count.
author | yaz |
---|---|
date | Thu, 24 Aug 2006 23:08:22 -0700 |
parents | 705d4c089fce |
children | fda280358660 |
comparison
equal
deleted
inserted
replaced
1593:6647d5cc717c | 1594:44f67f556b60 |
---|---|
259 LEFTPAD(width - numpr); | 259 LEFTPAD(width - numpr); |
260 } | 260 } |
261 | 261 |
262 /* Insert string. */ | 262 /* Insert string. */ |
263 if (precision >= 0) { | 263 if (precision >= 0) { |
264 while (precision-- > 0 && (c = *string++) != '\0') | 264 glong offset_max = precision, offset; |
265 PUTCH(c); | 265 gchar *uptr = NULL; |
266 const gchar *tmpstring = string; | |
267 while (precision > 0) { | |
268 offset = offset_max - precision; | |
269 uptr = g_utf8_offset_to_pointer(tmpstring, offset); | |
270 if (*uptr == '\0') | |
271 break; | |
272 g_string_append_unichar(outstr, g_utf8_get_char(uptr)); | |
273 precision--; | |
274 } | |
266 } | 275 } |
267 else { | 276 else { |
268 while ((c = *string++) != '\0') | 277 while ((c = *string++) != '\0') |
269 PUTCH(c); | 278 PUTCH(c); |
270 } | 279 } |