diff options
author | vng <viktor.govako@gmail.com> | 2011-08-29 15:31:30 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:22:44 +0300 |
commit | 7650a6bd86eddf68ff034715ed08fa04e07da687 (patch) | |
tree | c1047525fa4486ee900e8ef1930ffe1a8ffc2f87 /generator/update_generator.cpp | |
parent | b409579c6f0e9327867acb9aca8806c5e5cd5a88 (diff) |
[Cleanup] Old code with cells data files.
Diffstat (limited to 'generator/update_generator.cpp')
-rw-r--r-- | generator/update_generator.cpp | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/generator/update_generator.cpp b/generator/update_generator.cpp index 59f9e54213..5c049338ca 100644 --- a/generator/update_generator.cpp +++ b/generator/update_generator.cpp @@ -1,9 +1,5 @@ #include "update_generator.hpp" -#include "../coding/file_writer.hpp" - -#include "../geometry/cellid.hpp" - #include "../platform/platform.hpp" #include "../storage/country.hpp" @@ -13,10 +9,9 @@ #include "../base/logging.hpp" #include "../base/macros.hpp" -#include "../std/target_os.hpp" -#include "../std/fstream.hpp" #include "../std/iterator.hpp" + using namespace storage; /// files which can be updated through downloader @@ -54,11 +49,13 @@ namespace update platform.GetFilesInDir(dataDir, gExtensionsToUpdate[i], otherFiles); std::copy(otherFiles.begin(), otherFiles.end(), std::back_inserter(files)); } + { // remove minsk-pass from list Platform::FilesList::iterator minskPassIt = std::find(files.begin(), files.end(), "minsk-pass" DATA_FILE_EXTENSION); if (minskPassIt != files.end()) files.erase(minskPassIt); } + if (files.empty()) { LOG(LERROR, ("Can't find any files at path", dataDir)); @@ -69,48 +66,21 @@ namespace update LOG_SHORT(LINFO, ("Files count included in update file:", files.size())); } - TDataFiles cellFiles; TCommonFiles commonFiles; - string name, ext; - int32_t level = -1; - uint16_t bits; + TDataFiles dataFiles; + for (Platform::FilesList::iterator it = files.begin(); it != files.end(); ++it) { uint64_t size = 0; CHECK( platform.GetFileSize(dataDir + *it, size), ()); CHECK_EQUAL( size, static_cast<uint32_t>(size), ("We don't support files > 4gb", *it)); - if (SplitExtension(*it, name, ext)) - { - // is it data cell file? - if (ext == DATA_FILE_EXTENSION) - { - if (CountryCellId::IsCellId(name)) - { - CountryCellId cellId = CountryCellId::FromString(name); - pair<int64_t, int> bl = cellId.ToBitsAndLevel(); - if (level < 0) - level = bl.second; - CHECK_EQUAL( level, bl.second, ("Data files with different level?", *it) ); - bits = static_cast<uint16_t>(bl.first); - CHECK_EQUAL( name, CountryCellId::FromBitsAndLevel(bits, level).ToString(), (name)); - cellFiles.push_back(make_pair(bits, static_cast<uint32_t>(size))); - } - else - { - commonFiles.push_back(make_pair(*it, static_cast<uint32_t>(size))); - } - } - else - { - commonFiles.push_back(make_pair(*it, static_cast<uint32_t>(size))); - } - } + + commonFiles.push_back(make_pair(*it, static_cast<uint32_t>(size))); } - SaveTiles(dataDir + DATA_UPDATE_FILE, level, cellFiles, commonFiles); + SaveTiles(dataDir + DATA_UPDATE_FILE, -1, dataFiles, commonFiles); - LOG_SHORT(LINFO, ("Created update file with", cellFiles.size(), "cell data files and", - commonFiles.size(), "other files")); + LOG_SHORT(LINFO, ("Created update file with ", commonFiles.size(), " files")); return true; } |