diff --git a/coding/traffic.hpp b/coding/traffic.hpp index f4e3c0b0db..c28fcea13d 100644 --- a/coding/traffic.hpp +++ b/coding/traffic.hpp @@ -52,29 +52,24 @@ public: { switch (version) { - case 0: return SerializeDataPointsV0(writer, points); - case 1: return SerializeDataPointsV1(writer, points); + case 0: return SerializeDataPointsV0(writer, points); + case 1: return SerializeDataPointsV1(writer, points); - default: - ASSERT(false, ("Unexpected serializer version:", version)); - break; + default: ASSERT(false, ("Unexpected serializer version:", version)); break; } return 0; } - // Deserializes the points from |source| and appends them to |result|. template static void DeserializeDataPoints(uint32_t version, Source & src, Collection & result) { switch (version) { - case 0: return DeserializeDataPointsV0(src, result); - case 1: return DeserializeDataPointsV1(src, result); + case 0: return DeserializeDataPointsV0(src, result); + case 1: return DeserializeDataPointsV1(src, result); - default: - ASSERT(false, ("Unexpected serializer version:", version)); - break; + default: ASSERT(false, ("Unexpected serializer version:", version)); break; } } @@ -92,9 +87,9 @@ private: { uint64_t const firstTimestamp = points[0].m_timestamp; uint32_t const firstLat = - DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat); + DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat); uint32_t const firstLon = - DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon); + DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon); WriteVarUint(writer, firstTimestamp); WriteVarUint(writer, firstLat); WriteVarUint(writer, firstLon); @@ -129,9 +124,9 @@ private: { uint64_t const firstTimestamp = points[0].m_timestamp; uint32_t const firstLat = - DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat); + DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat); uint32_t const firstLon = - DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon); + DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon); uint32_t const traffic = points[0].m_traffic; WriteVarUint(writer, firstTimestamp); WriteVarUint(writer, firstLat); @@ -176,9 +171,9 @@ private: { lastTimestamp = ReadVarUint(src); lastLat = - Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLat, ms::LatLon::kMaxLat); + Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLat, ms::LatLon::kMaxLat); lastLon = - Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLon, ms::LatLon::kMaxLon); + Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLon, ms::LatLon::kMaxLon); result.push_back(DataPoint(lastTimestamp, ms::LatLon(lastLat, lastLon), traffic)); first = false; } @@ -207,9 +202,9 @@ private: { lastTimestamp = ReadVarUint(src); lastLat = - Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLat, ms::LatLon::kMaxLat); + Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLat, ms::LatLon::kMaxLat); lastLon = - Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLon, ms::LatLon::kMaxLon); + Uint32ToDouble(ReadVarUint(src), ms::LatLon::kMinLon, ms::LatLon::kMaxLon); traffic = static_cast(ReadVarUint(src)); result.push_back(DataPoint(lastTimestamp, ms::LatLon(lastLat, lastLon), traffic)); first = false; @@ -224,6 +219,5 @@ private: } } } - }; } // namespace coding diff --git a/tracking/reporter.cpp b/tracking/reporter.cpp index d125d5b4ce..36f145a56e 100644 --- a/tracking/reporter.cpp +++ b/tracking/reporter.cpp @@ -54,9 +54,9 @@ void Reporter::AddLocation(location::GpsInfo const & info, traffic::SpeedGroup t return; m_lastGpsTime = info.m_timestamp; - m_input.push_back(DataPoint(info.m_timestamp, - ms::LatLon(info.m_latitude, info.m_longitude), - static_cast::type>(traffic))); + m_input.push_back( + DataPoint(info.m_timestamp, ms::LatLon(info.m_latitude, info.m_longitude), + static_cast::type>(traffic))); } void Reporter::Run() diff --git a/tracking/tracking_tests/protocol_test.cpp b/tracking/tracking_tests/protocol_test.cpp index d0b51ebd33..38f1c87381 100644 --- a/tracking/tracking_tests/protocol_test.cpp +++ b/tracking/tracking_tests/protocol_test.cpp @@ -70,7 +70,7 @@ UNIT_TEST(Protocol_DecodeAuthPacket) TEST_EQUAL(result, "ABC", ()); } -template< typename Container> +template void DecodeDataPacketVersionTest(Container const & points, Protocol::PacketType version) { double const kEps = 1e-5;