clip int scanning to 15 digits to remove an unecessary malloc().

fix %xl tag


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26477 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-06-02 10:35:19 +00:00
parent 57ad6f9b03
commit e8a662432a
2 changed files with 7 additions and 8 deletions

View file

@ -101,9 +101,9 @@ char* scan_string(char** document)
int scan_int(char** document)
{
char* cursor = *document;
char* cursor = *document, *end;
int length = 0;
char* buffer = NULL;
char buffer[16];
int retval;
int i;
@ -118,9 +118,9 @@ int scan_int(char** document)
length++;
cursor++;
}
buffer = skin_alloc_string(length);
if (length > 15)
length = 15;
end = cursor;
/* Copying to the buffer while avoiding comments */
cursor = *document;
buffer[length] = '\0';
@ -138,9 +138,8 @@ int scan_int(char** document)
}
retval = atoi(buffer);
free(buffer);
*document = cursor;
*document = end;
return retval;
}

View file

@ -167,7 +167,7 @@ struct tag_info legal_tags[] =
{ SKIN_TOKEN_DISABLE_THEME, "wd", "" },
{ SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "" },
{ SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFIIi" },
{ SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I" },
{ SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" },
{ SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" },