Handle floating point connector coordinates as well as integer (ignores the floating point part).

Correctly handles "42 127 -3", "42.999 127. -3.1415926535897932384626" and "42... 127.0.0.1 -3.0..0...0" as (42, 127, -3).
Doesn't handle the floating point and integer mixture "42 127.0 -3".
master
Cyp 2010-11-21 11:30:18 +01:00
parent bdca765f06
commit ea1e76a09d
1 changed files with 2 additions and 1 deletions

View File

@ -486,7 +486,8 @@ static BOOL _imd_load_connectors(const char **ppFileData, iIMDShape *s)
for (p = s->connectors; p < s->connectors + s->nconnectors; p++)
{
if (sscanf(pFileData, "%d %d %d%n", &newVector.x, &newVector.y, &newVector.z, &cnt) != 3)
if (sscanf(pFileData, "%d %d %d%n", &newVector.x, &newVector.y, &newVector.z, &cnt) != 3 &&
sscanf(pFileData, "%d%*[.0-9] %d%*[.0-9] %d%*[.0-9]%n", &newVector.x, &newVector.y, &newVector.z, &cnt) != 3)
{
debug(LOG_ERROR, "(_load_connectors) file corrupt -M");
return false;