From 7fe778c62ca9807f9f8665231e223f005cb3a2b3 Mon Sep 17 00:00:00 2001 From: vng Date: Wed, 18 May 2011 02:13:40 +0300 Subject: [PATCH] - Fix warning; - Fix compile error (msvc); --- indexer/feature.hpp | 2 +- map/search_processor.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 1102cab2a8..25a4354d1b 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -195,7 +195,7 @@ public: inline bool HasName() const { - return Header() & feature::HEADER_HAS_NAME; + return (Header() & feature::HEADER_HAS_NAME) != 0; } template diff --git a/map/search_processor.cpp b/map/search_processor.cpp index 34501f1844..088ce4c360 100644 --- a/map/search_processor.cpp +++ b/map/search_processor.cpp @@ -13,20 +13,20 @@ namespace search int Score(string const & key, string const & word) { size_t const offset = word.find(key); - switch (offset) + + if (offset == 0) // best match - from the beginning { - case 0: // best match - from the beginning if (word.size() == key.size()) return 1000; // full match else return 100; // partial match - break; - case string::npos: // no match - return -1; - break; - default: // match in the middle of the string - return key.size() * 2; // how many symbols matched } + else if (offset == string::npos) // no match + { + return -1; + } + else // match in the middle of the string + return key.size() * 2; // how many symbols matched } Query::Query(string const & line)