diff --git a/generator/routing_index_generator.cpp b/generator/routing_index_generator.cpp index b638c0f815..f068fd9115 100644 --- a/generator/routing_index_generator.cpp +++ b/generator/routing_index_generator.cpp @@ -232,7 +232,7 @@ void CalcCrossMwmTransitions( if (pointsCount == 0) return; - auto it = featureIdToOsmId.find(featureId); + auto const it = featureIdToOsmId.find(featureId); CHECK(it != featureIdToOsmId.end(), ("Can't find osm id for feature id", featureId)); auto const osmId = it->second; diff --git a/routing/cross_mwm_connector.hpp b/routing/cross_mwm_connector.hpp index 5862462bfe..a678db9467 100644 --- a/routing/cross_mwm_connector.hpp +++ b/routing/cross_mwm_connector.hpp @@ -102,7 +102,7 @@ public: return GetTransition(segment).m_crossMwmId; } - // returns nullptr if there is no transition for such osm id. + // returns nullptr if there is no transition for such cross mwm id. Segment const * GetTransition(CrossMwmId const & crossMwmId, uint32_t segmentIdx, bool isEnter) const { auto const fIt = m_crossMwmIdToFeatureId.find(crossMwmId); diff --git a/routing/cross_mwm_connector_serialization.cpp b/routing/cross_mwm_connector_serialization.cpp index c8a1ac4477..4ae4bb7ae8 100644 --- a/routing/cross_mwm_connector_serialization.cpp +++ b/routing/cross_mwm_connector_serialization.cpp @@ -2,8 +2,6 @@ #include "base/bits.hpp" -#include - using namespace std; namespace routing diff --git a/routing/cross_mwm_connector_serialization.hpp b/routing/cross_mwm_connector_serialization.hpp index c2542d7db8..574cebf390 100644 --- a/routing/cross_mwm_connector_serialization.hpp +++ b/routing/cross_mwm_connector_serialization.hpp @@ -18,6 +18,7 @@ #include "base/checked_cast.hpp" +#include #include #include #include @@ -31,7 +32,7 @@ static uint8_t constexpr kOsmIdBits = 64; static uint8_t constexpr kStopIdBits = 64; static uint8_t constexpr kLineIdBits = 32; -inline uint32_t CalcBitsPerTransitId() { return 2 * kStopIdBits + kLineIdBits; } +inline uint32_t constexpr CalcBitsPerTransitId() { return 2 * kStopIdBits + kLineIdBits; } template inline void CheckBitsPerCrossMwmId(uint32_t bitsPerCrossMwmId) @@ -80,8 +81,9 @@ public: } template - void WriteCrossMwmId(connector::TransitId const & id, uint8_t /* n */, BitWriter & w) const + void WriteCrossMwmId(connector::TransitId const & id, uint8_t bitsPerCrossMwmId, BitWriter & w) const { + CHECK_EQUAL(bitsPerCrossMwmId, connector::CalcBitsPerTransitId(), ("Wrong TransitId size.")); w.WriteAtMost64Bits(id.m_stop1Id, connector::kStopIdBits); w.WriteAtMost64Bits(id.m_stop2Id, connector::kStopIdBits); w.WriteAtMost32Bits(id.m_lineId, connector::kLineIdBits); @@ -104,9 +106,10 @@ public: } template - void ReadCrossMwmId(uint8_t /* bitsPerCrossMwmId */, BitReader & reader, + void ReadCrossMwmId(uint8_t bitsPerCrossMwmId, BitReader & reader, connector::TransitId & readed) { + CHECK_EQUAL(bitsPerCrossMwmId, connector::CalcBitsPerTransitId(), ("Wrong TransitId size.")); readed.m_stop1Id = reader.ReadAtMost64Bits(connector::kStopIdBits); readed.m_stop2Id = reader.ReadAtMost64Bits(connector::kStopIdBits); readed.m_lineId = reader.ReadAtMost32Bits(connector::kLineIdBits); @@ -145,7 +148,7 @@ public: VehicleMask GetOneWayMask() const { return m_oneWayMask; } private: - CrossMwmId m_crossMwmId = CrossMwmId(); + CrossMwmId m_crossMwmId = {}; uint32_t m_featureId = 0; uint32_t m_segmentIdx = 0; m2::PointD m_backPoint = m2::PointD::Zero(); @@ -465,7 +468,7 @@ private: serial::CodingParams const & codingParams, uint32_t bitsPerOsmId, uint8_t bitsPerMask, std::vector & buffer) { - MemWriter> memWriter(buffer); + MemWriter> memWriter(buffer); for (auto const & transition : transitions) transition.Serialize(codingParams, bitsPerOsmId, bitsPerMask, memWriter);