diff options
author | vng <viktor.govako@gmail.com> | 2011-12-09 18:10:44 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:30:02 +0300 |
commit | dba009c9ea28f5b75c0743ccf3fe9fc3ceda38f9 (patch) | |
tree | 25bb3f3ca98fae5f9f098ff0ce25ab282b01cc5b /indexer/classificator.cpp | |
parent | d38f6a81f7ad39bae5aa1f27924250e978270a84 (diff) |
Fix feature type conversion from 1.01 to 2.0
Diffstat (limited to 'indexer/classificator.cpp')
-rw-r--r-- | indexer/classificator.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index ee98dfc95f..1c8f0e2145 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -166,7 +166,7 @@ void ClassifObject::Swap(ClassifObject & r) ClassifObject const * ClassifObject::GetObject(size_t i) const { - ASSERT ( i < m_objs.size(), (i) ); + ASSERT_LESS ( i, m_objs.size(), (m_name) ); return &(m_objs[i]); } @@ -261,7 +261,7 @@ namespace ftype void PopValue(uint32_t & type) { uint8_t const cl = get_control_level(type); - ASSERT ( cl > 0, (cl) ); + ASSERT_GREATER ( cl, 0, () ); // remove control level set_value(type, cl, 0); @@ -269,6 +269,23 @@ namespace ftype // set control level set_value(type, cl-1, 1); } + + void TruncValue(uint32_t & type, uint8_t level) + { + ASSERT_GREATER ( level, 0, () ); + uint8_t cl = get_control_level(type); + + while (cl > level) + { + // remove control level + set_value(type, cl, 0); + + --cl; + + // set control level + set_value(type, cl, 1); + } + } } namespace |