From 257aacef51a1a9719fc8b0cb34eeb252dd33174b Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Fri, 18 Mar 2016 18:31:15 +0300 Subject: [PATCH] Removed controversial lists support. --- platform/measurement_utils.cpp | 14 ++------------ platform/platform_tests/measurement_tests.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/platform/measurement_utils.cpp b/platform/measurement_utils.cpp index 5ba0a7cf5d..71d1cbd200 100644 --- a/platform/measurement_utils.cpp +++ b/platform/measurement_utils.cpp @@ -235,18 +235,8 @@ bool OSMDistanceToMeters(string const & osmRawValue, double & outMeters) } break; - // It's probably a list. Use maximum value (if possible) for a list. - case ';': - do - { - s = stop + 1; - double const newValue = strtod(s, &stop); - if (s == stop) - break; - if (isfinite(newValue)) - outMeters = newValue; - } while (*stop && *stop == ';'); - break; + // It's probably a list. We don't support them. + case ';': return false; } while (*stop && isspace(*stop)) diff --git a/platform/platform_tests/measurement_tests.cpp b/platform/platform_tests/measurement_tests.cpp index 6129601300..158e016d21 100644 --- a/platform/platform_tests/measurement_tests.cpp +++ b/platform/platform_tests/measurement_tests.cpp @@ -120,11 +120,12 @@ UNIT_TEST(OSMDistanceToMetersString) TEST_EQUAL(OSMDistanceToMetersString("8-15"), "15", ()); TEST_EQUAL(OSMDistanceToMetersString("8-15 ft"), "4.57", ()); TEST_EQUAL(OSMDistanceToMetersString("8-й километр"), "8", ()); - TEST_EQUAL(OSMDistanceToMetersString("8;9;10"), "10", ()); - TEST_EQUAL(OSMDistanceToMetersString("8;9;10 meters"), "10", ()); - TEST_EQUAL(OSMDistanceToMetersString("8;9;10 km"), "10000", ()); - TEST_EQUAL(OSMDistanceToMetersString("10;20!111"), "20", ()); - TEST_EQUAL(OSMDistanceToMetersString("10;20\""), "20", ()); + // Do not support lists for distance values. + TEST_EQUAL(OSMDistanceToMetersString("8;9;10"), "", ()); + TEST_EQUAL(OSMDistanceToMetersString("8;9;10 meters"), "", ()); + TEST_EQUAL(OSMDistanceToMetersString("8;9;10 km"), "", ()); + TEST_EQUAL(OSMDistanceToMetersString("10;20!111"), "", ()); + TEST_EQUAL(OSMDistanceToMetersString("10;20\""), "", ()); TEST_EQUAL(OSMDistanceToMetersString("-100.3"), "-100.3", ()); TEST_EQUAL(OSMDistanceToMetersString("99.0000000"), "99", ()); TEST_EQUAL(OSMDistanceToMetersString("8900.000023"), "8900", ());