Fix parsing of numbers in svg files : the code used obsolete atod instead of strtod and led to numbers in the form 2.5e-4 to make the parsing fail as 'e' was interpreted as the end of the number.

Fixes #5728.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38230 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-18 11:50:49 +00:00
parent 3e86abbd71
commit 24fcc1eecb
2 changed files with 4 additions and 15 deletions

View File

@ -142,20 +142,9 @@ PathTokenizer::is_separator(unsigned c) const
bool
PathTokenizer::parse_number()
{
char buf[256]; // Should be enough for any number
char* buf_ptr = buf;
// Copy all sign characters
while (buf_ptr < buf+255 && *fPath == '-' || *fPath == '+') {
*buf_ptr++ = *fPath++;
}
// Copy all numeric characters
while (buf_ptr < buf+255 && isNumeric(*fPath)) {
*buf_ptr++ = *fPath++;
}
*buf_ptr = 0;
fLastNumber = atof(buf);
char* end;
fLastNumber = strtod(fPath, &end);
fPath = end;
return true;
}

View File

@ -364,7 +364,7 @@ Parser::parse(const char* pathToFile)
void
Parser::start_element(void* data, const char* el, const char** attr)
{
//printf("Parser::start_element(%s)\n", el);
// printf("Parser::start_element(%s)\n", el);
Parser& self = *(Parser*)data;
if (strcmp(el, "svg") == 0)