[search] Fixed rank-table creation for World and WorldCoasts.

This commit is contained in:
Yuri Gorshenin 2015-09-24 11:32:23 +03:00 committed by Sergey Yershov
parent 2166b6faf6
commit e6433b5932
2 changed files with 10 additions and 3 deletions

View file

@ -71,7 +71,7 @@ unique_ptr<MwmSet::MwmValueBase> Index::CreateValue(MwmInfo & info) const
{
search::RankTableBuilder::CreateIfNotExists(localFile);
}
catch (Reader::OpenException const & e)
catch (RootException const & e)
{
LOG(LWARNING, ("Can't create rank table for:", localFile, ":", e.Msg()));
}

View file

@ -7,6 +7,7 @@
#include "indexer/types_skipper.hpp"
#include "platform/local_country_file.hpp"
#include "platform/local_country_file_utils.hpp"
#include "coding/endianness.hpp"
#include "coding/file_container.hpp"
@ -268,11 +269,17 @@ void RankTableBuilder::CalcSearchRanks(FilesContainerR & rcont, vector<uint8_t>
// static
void RankTableBuilder::CreateIfNotExists(platform::LocalCountryFile const & localFile)
{
string const mapPath = localFile.GetPath(MapOptions::Map);
string mapPath;
unique_ptr<RankTable> table;
{
FilesContainerR rcont(mapPath);
ModelReaderPtr reader = platform::GetCountryReader(localFile, MapOptions::Map);
if (!reader.GetPtr())
return;
mapPath = reader.GetName();
FilesContainerR rcont(reader);
if (rcont.IsExist(RANKS_FILE_TAG))
{
switch (CheckEndianness(rcont.GetReader(RANKS_FILE_TAG)))