Skip to content

Commit

Permalink
Initialization fields of FeatureBase class.
Browse files Browse the repository at this point in the history
  • Loading branch information
bykoianko committed Jun 22, 2016
1 parent 048bfbf commit 2f216d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion generator/feature_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ FeatureBase FeatureBuilder1::GetFeatureBase() const
memcpy(f.m_types, &m_params.m_Types[0], sizeof(uint32_t) * m_params.m_Types.size());
f.m_limitRect = m_limitRect;

f.m_bTypesParsed = f.m_bCommonParsed = true;
f.m_typesParsed = f.m_commonParsed = true;

return f;
}
Expand Down
20 changes: 10 additions & 10 deletions indexer/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void FeatureBase::Deserialize(feature::LoaderBase * pLoader, TBuffer buffer)
m_pLoader->Init(buffer);

m_limitRect = m2::RectD::GetEmptyRect();
m_bTypesParsed = m_bCommonParsed = false;
m_typesParsed = m_commonParsed = false;
m_header = m_pLoader->GetHeader();
}

Expand All @@ -49,7 +49,7 @@ void FeatureType::ApplyPatch(editor::XMLFeature const & xml)
// m_params.ref =
// m_params.layer =
// m_params.rank =
m_bCommonParsed = true;
m_commonParsed = true;

xml.ForEachTag([this](string const & k, string const & v)
{
Expand Down Expand Up @@ -90,15 +90,15 @@ void FeatureType::ReplaceBy(osm::EditableMapObject const & emo)
m_params.house.Clear();
else
m_params.house.Set(house);
m_bCommonParsed = true;
m_commonParsed = true;

m_metadata = emo.GetMetadata();
m_metadataParsed = true;

uint32_t typesCount = 0;
for (uint32_t const type : emo.GetTypes())
m_types[typesCount++] = type;
m_bTypesParsed = true;
m_typesParsed = true;
m_header = CalculateHeader(typesCount, geoType, m_params);
m_header2Parsed = true;

Expand Down Expand Up @@ -210,7 +210,7 @@ bool FeatureType::FromXML(editor::XMLFeature const & xml)
// m_params.ref =
// m_params.layer =
// m_params.rank =
m_bCommonParsed = true;
m_commonParsed = true;

uint32_t typesCount = 0;
xml.ForEachTag([this, &typesCount](string const & k, string const & v)
Expand Down Expand Up @@ -238,7 +238,7 @@ bool FeatureType::FromXML(editor::XMLFeature const & xml)
}
});
m_metadataParsed = true;
m_bTypesParsed = true;
m_typesParsed = true;

EHeaderTypeMask const geomType = house.empty() && !m_params.ref.empty() ? HEADER_GEOM_POINT : HEADER_GEOM_POINT_EX;
m_header = CalculateHeader(typesCount, geomType, m_params);
Expand All @@ -249,21 +249,21 @@ bool FeatureType::FromXML(editor::XMLFeature const & xml)

void FeatureBase::ParseTypes() const
{
if (!m_bTypesParsed)
if (!m_typesParsed)
{
m_pLoader->ParseTypes();
m_bTypesParsed = true;
m_typesParsed = true;
}
}

void FeatureBase::ParseCommon() const
{
if (!m_bCommonParsed)
if (!m_commonParsed)
{
ParseTypes();

m_pLoader->ParseCommon();
m_bCommonParsed = true;
m_commonParsed = true;
}
}

Expand Down
5 changes: 3 additions & 2 deletions indexer/feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class FeatureBase
protected:
feature::LoaderBase * m_pLoader;

uint8_t m_header;
uint8_t m_header = 0;

mutable uint32_t m_types[feature::kMaxTypesCount];

Expand All @@ -145,7 +145,8 @@ class FeatureBase

mutable m2::RectD m_limitRect;

mutable bool m_bTypesParsed, m_bCommonParsed;
mutable bool m_typesParsed = false;
mutable bool m_commonParsed = false;

friend class feature::LoaderCurrent;
friend class old_101::feature::LoaderImpl;
Expand Down

0 comments on commit 2f216d2

Please sign in to comment.