forked from len0rd/rockbox
custom wps without an ending newline should still be OK
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2173 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0f387e913a
commit
88aeb7140c
1 changed files with 12 additions and 8 deletions
|
|
@ -83,25 +83,29 @@ static void wps_format(char* fmt)
|
|||
|
||||
while (*buf)
|
||||
{
|
||||
switch (*buf++)
|
||||
switch (*buf)
|
||||
{
|
||||
case '\r':
|
||||
*(buf - 1) = 0;
|
||||
*buf = 0;
|
||||
break;
|
||||
|
||||
case '\n': /* LF */
|
||||
*(buf - 1) = 0;
|
||||
line++;
|
||||
*buf = 0;
|
||||
|
||||
if (line < MAX_LINES)
|
||||
if (++line < MAX_LINES)
|
||||
{
|
||||
format_lines[line] = buf;
|
||||
/* the next line starts on the next byte */
|
||||
format_lines[line] = buf+1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
buf++;
|
||||
}
|
||||
|
||||
if(buf != format_lines[line])
|
||||
/* the last line didn't terminate with a newline */
|
||||
line++;
|
||||
|
||||
for (; line < MAX_LINES; line++)
|
||||
{
|
||||
format_lines[line] = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue