diff --git a/coding/value_opt_string.hpp b/coding/value_opt_string.hpp index 4e55745155..8ccf9c7f3c 100644 --- a/coding/value_opt_string.hpp +++ b/coding/value_opt_string.hpp @@ -42,9 +42,9 @@ public: template void Write(TSink & sink) const { - int n; - if (strings::to_int(m_s, n) && n >= 0) - WriteVarUint(sink, static_cast((n << 1) | numeric_bit)); + uint64_t n; + if (strings::to_uint64(m_s, n) && ((n << 1) >> 1) == n) + WriteVarUint(sink, ((n << 1) | numeric_bit)); else { size_t const sz = m_s.size(); diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 12af305b66..6decfe5e83 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -71,8 +71,15 @@ void FeatureParamsBase::AddHouseName(string const & s) house.Set(house.IsEmpty() ? s : house.Get() + " \"" + s + "\""); } -void FeatureParamsBase::AddHouseNumber(string const & s) +void FeatureParamsBase::AddHouseNumber(string const & ss) { + // Remove trailing zero's from house numbers. + // It's important for debug checks of serialized-deserialized feature. + string s(ss); + uint64_t n; + if (strings::to_uint64(s, n)) + s = strings::to_string(n); + house.Set(house.IsEmpty() ? s : s + " \"" + house.Get() + "\""); }