From f11572cd646e3e6066eb42e4382ce4ffd89b69fe Mon Sep 17 00:00:00 2001 From: jmt Date: Sat, 7 Nov 2009 00:18:21 +0000 Subject: [PATCH] Case insensitivity for findNextByPartialId. --- src/Navaids/positioned.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index c4bce783c..f3e683fb9 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -694,14 +694,16 @@ FGPositioned::findClosestN(const SGGeod& aPos, unsigned int aN, double aCutoffNm FGPositionedRef FGPositioned::findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter) { + std::string id(boost::to_upper_copy(aId)); + // It is essential to bound our search, to avoid iterating all the way to the end of the database. // Do this by generating a second ID with the final character incremented by 1. // e.g., if the partial ID is "KI", we wish to search "KIxxx" but not "KJ". - std::string upperBoundId = aId; + std::string upperBoundId = id; upperBoundId[upperBoundId.size()-1]++; NamedPositionedIndex::const_iterator upperBound = global_identIndex.lower_bound(upperBoundId); - NamedIndexRange range = global_identIndex.equal_range(aId); + NamedIndexRange range = global_identIndex.equal_range(id); while (range.first != upperBound) { for (; range.first != range.second; ++range.first) { FGPositionedRef candidate = range.first->second; -- 2.39.5