forked from len0rd/rockbox
Ignore truncation in lcd-scroll.c
Change-Id: Id1008300e58cf12ab920c1023354a74a6d32daae
This commit is contained in:
parent
5e5ddce270
commit
540637ed33
1 changed files with 7 additions and 2 deletions
|
@ -140,6 +140,7 @@ void LCDFN(jump_scroll_delay)(int ms)
|
||||||
* Returns true if the text scrolled to the end */
|
* Returns true if the text scrolled to the end */
|
||||||
bool LCDFN(scroll_now)(struct scrollinfo *s)
|
bool LCDFN(scroll_now)(struct scrollinfo *s)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
int width = LCDFN(getstringsize)(s->linebuffer, NULL, NULL);
|
int width = LCDFN(getstringsize)(s->linebuffer, NULL, NULL);
|
||||||
bool ended = false;
|
bool ended = false;
|
||||||
/* assume s->scroll_func() don't yield; otherwise this buffer might need
|
/* assume s->scroll_func() don't yield; otherwise this buffer might need
|
||||||
|
@ -164,8 +165,12 @@ bool LCDFN(scroll_now)(struct scrollinfo *s)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(line_buf, sizeof(line_buf)-1, "%s%s%s",
|
len = snprintf(line_buf, sizeof(line_buf)-1, "%s%s%s",
|
||||||
s->linebuffer, " ", s->linebuffer);
|
s->linebuffer, " ", s->linebuffer);
|
||||||
|
|
||||||
|
if ((unsigned) len > sizeof(line_buf))
|
||||||
|
do { } while (0); /* ignore truncation */
|
||||||
|
|
||||||
s->line = line_buf;
|
s->line = line_buf;
|
||||||
width += LCDFN(getstringsize)(" ", NULL, NULL);
|
width += LCDFN(getstringsize)(" ", NULL, NULL);
|
||||||
/* scroll forward the whole time */
|
/* scroll forward the whole time */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue