From a05dec2cf91f7a0739a75b92013dbc9a2a2d39e5 Mon Sep 17 00:00:00 2001 From: Maksim Andrianov Date: Fri, 26 Feb 2021 14:26:41 +0300 Subject: [PATCH] Review fixes --- coding/mmap_reader.cpp | 14 +++++++------- coding/mmap_reader.hpp | 4 ++-- generator/intermediate_data.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/coding/mmap_reader.cpp b/coding/mmap_reader.cpp index 84c86aaf42..adfca8d31c 100644 --- a/coding/mmap_reader.cpp +++ b/coding/mmap_reader.cpp @@ -21,7 +21,7 @@ using namespace std; class MmapReader::MmapData { public: - explicit MmapData(string const & fileName, Advise advise) + explicit MmapData(string const & fileName, Advice advice) { // @TODO add windows support #ifndef OMIM_OS_WINDOWS @@ -43,11 +43,11 @@ public: } int adv = MADV_NORMAL; - switch (advise) + switch (advice) { - case Advise::Random: adv = MADV_RANDOM; break; - case Advise::Sequential: adv = MADV_SEQUENTIAL; break; - case Advise::Normal: adv = MADV_NORMAL; break; + case Advice::Random: adv = MADV_RANDOM; break; + case Advice::Sequential: adv = MADV_SEQUENTIAL; break; + case Advice::Normal: adv = MADV_NORMAL; break; } if (madvise(m_memory, s.st_size, adv) != 0) @@ -71,9 +71,9 @@ private: int m_fd = 0; }; -MmapReader::MmapReader(string const & fileName, Advise advise) +MmapReader::MmapReader(string const & fileName, Advice advice) : base_type(fileName) - , m_data(std::make_shared(fileName, advise)) + , m_data(std::make_shared(fileName, advice)) , m_offset(0) , m_size(m_data->m_size) { diff --git a/coding/mmap_reader.hpp b/coding/mmap_reader.hpp index 5d0d31a65f..b17eb7767a 100644 --- a/coding/mmap_reader.hpp +++ b/coding/mmap_reader.hpp @@ -11,14 +11,14 @@ class MmapReader : public ModelReader { public: - enum class Advise + enum class Advice { Normal, Random, Sequential }; - explicit MmapReader(std::string const & fileName, Advise advise = Advise::Normal); + explicit MmapReader(std::string const & fileName, Advice advice = Advice::Normal); uint64_t Size() const override; void Read(uint64_t pos, void * p, size_t size) const override; diff --git a/generator/intermediate_data.cpp b/generator/intermediate_data.cpp index 61252d7ae4..19db5f1977 100644 --- a/generator/intermediate_data.cpp +++ b/generator/intermediate_data.cpp @@ -76,7 +76,7 @@ class RawFilePointStorageMmapReader : public PointStorageReaderInterface { public: explicit RawFilePointStorageMmapReader(string const & name) - : m_mmapReader(name, MmapReader::Advise::Random) + : m_mmapReader(name, MmapReader::Advice::Random) {} // PointStorageReaderInterface overrides: