forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
5ef2109e8e
commit
83d3e77012
6 changed files with 33 additions and 33 deletions
|
@ -15,9 +15,9 @@ set(
|
|||
country_name_getter.hpp
|
||||
country_polygon.hpp
|
||||
country_tree.hpp
|
||||
diff_scheme_checker.cpp
|
||||
diff_scheme_checker.hpp
|
||||
diff_types.hpp
|
||||
diff_scheme/diff_scheme_checker.cpp
|
||||
diff_scheme/diff_scheme_checker.hpp
|
||||
diff_scheme/diff_types.hpp
|
||||
downloader_search_params.hpp
|
||||
downloading_policy.cpp
|
||||
downloading_policy.hpp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "storage/diff_scheme_checker.hpp"
|
||||
#include "storage/diff_scheme/diff_scheme_checker.hpp"
|
||||
|
||||
#include "platform/http_client.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
@ -19,11 +19,11 @@ namespace
|
|||
{
|
||||
using namespace diff_scheme;
|
||||
|
||||
char const * const kMaxVersionKey = "max_version";
|
||||
char const * const kMwmsKey = "mwms";
|
||||
char const * const kNameKey = "name";
|
||||
char const * const kSizeKey = "size";
|
||||
char const * const kVersionKey = "version";
|
||||
char const kMaxVersionKey[] = "max_version";
|
||||
char const kMwmsKey[] = "mwms";
|
||||
char const kNameKey[] = "name";
|
||||
char const kSizeKey[] = "size";
|
||||
char const kVersionKey[] = "version";
|
||||
|
||||
string SerializeCheckerData(Checker::LocalMapsInfo const & info)
|
||||
{
|
||||
|
@ -43,11 +43,11 @@ string SerializeCheckerData(Checker::LocalMapsInfo const & info)
|
|||
return buffer.get();
|
||||
}
|
||||
|
||||
NameFileMap DeserializeResponse(string const & response, Checker::NameVersionMap const & nameVersionMap)
|
||||
NameFileInfoMap DeserializeResponse(string const & response, Checker::NameVersionMap const & nameVersionMap)
|
||||
{
|
||||
if (response.empty())
|
||||
{
|
||||
LOG(LERROR, ("Diff responce shouldn't be empty."));
|
||||
LOG(LERROR, ("Diff response shouldn't be empty."));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ NameFileMap DeserializeResponse(string const & response, Checker::NameVersionMap
|
|||
return {};
|
||||
}
|
||||
|
||||
NameFileMap diffs;
|
||||
NameFileInfoMap diffs;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ NameFileMap DeserializeResponse(string const & response, Checker::NameVersionMap
|
|||
if (!node)
|
||||
{
|
||||
LOG(LERROR, ("Incorrect server response."));
|
||||
return diffs;
|
||||
return {};
|
||||
}
|
||||
|
||||
string name;
|
||||
|
@ -83,7 +83,7 @@ NameFileMap DeserializeResponse(string const & response, Checker::NameVersionMap
|
|||
int64_t size;
|
||||
FromJSONObject(node, kSizeKey, size);
|
||||
// Invalid size. The diff is not available.
|
||||
if (size == -1)
|
||||
if (size < 0)
|
||||
continue;
|
||||
|
||||
if (nameVersionMap.find(name) == nameVersionMap.end())
|
||||
|
@ -118,7 +118,7 @@ void Checker::Check(LocalMapsInfo const & info, Callback const & fn)
|
|||
string const body = SerializeCheckerData(info);
|
||||
ASSERT(!body.empty(), ());
|
||||
request.SetBodyData(body, "application/json");
|
||||
NameFileMap diffs;
|
||||
NameFileInfoMap diffs;
|
||||
if (request.RunHttpRequest() && !request.WasRedirected() && request.ErrorCode() == 200)
|
||||
diffs = DeserializeResponse(request.ServerResponse(), info.m_localMaps);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "storage/diff_types.hpp"
|
||||
#include "storage/diff_scheme/diff_types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
NameVersionMap m_localMaps;
|
||||
};
|
||||
|
||||
using Callback = std::function<void(NameFileMap const & diffs)>;
|
||||
using Callback = std::function<void(NameFileInfoMap const & diffs)>;
|
||||
|
||||
static void Check(LocalMapsInfo const & info, Callback const & fn);
|
||||
};
|
|
@ -20,5 +20,5 @@ struct FileInfo final
|
|||
uint64_t m_version;
|
||||
};
|
||||
|
||||
using NameFileMap = std::unordered_map<std::string, FileInfo>;
|
||||
using NameFileInfoMap = std::unordered_map<std::string, FileInfo>;
|
||||
} // namespace diff_scheme
|
|
@ -17,8 +17,8 @@ HEADERS += \
|
|||
country_name_getter.hpp \
|
||||
country_polygon.hpp \
|
||||
country_tree.hpp \
|
||||
diff_scheme_checker.hpp \
|
||||
diff_types.hpp \
|
||||
diff_scheme/diff_scheme_checker.hpp \
|
||||
diff_scheme/diff_types.hpp \
|
||||
downloader_search_params.hpp \
|
||||
downloading_policy.hpp \
|
||||
http_map_files_downloader.hpp \
|
||||
|
@ -34,7 +34,7 @@ SOURCES += \
|
|||
country_decl.cpp \
|
||||
country_info_getter.cpp \
|
||||
country_name_getter.cpp \
|
||||
diff_scheme_checker.cpp \
|
||||
diff_scheme/diff_scheme_checker.cpp \
|
||||
downloading_policy.cpp \
|
||||
http_map_files_downloader.cpp \
|
||||
index.cpp \
|
||||
|
|
|
@ -168,9 +168,9 @@
|
|||
F66D56AF1EAE383E0081E883 /* drules_proto_vehicle_clear.bin in Resources */ = {isa = PBXBuildFile; fileRef = F66D569B1EAE37160081E883 /* drules_proto_vehicle_clear.bin */; };
|
||||
F66D56B01EAE383E0081E883 /* drules_proto_vehicle_clear.txt in Resources */ = {isa = PBXBuildFile; fileRef = F66D569C1EAE37160081E883 /* drules_proto_vehicle_clear.txt */; };
|
||||
F66D56B21EAE385B0081E883 /* local_ads_symbols.txt in Resources */ = {isa = PBXBuildFile; fileRef = F66D56B11EAE385B0081E883 /* local_ads_symbols.txt */; };
|
||||
F68CC5BA1F386BD1007527C7 /* diff_types.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F68CC5B91F386BD1007527C7 /* diff_types.hpp */; };
|
||||
F6AD75681F3093370027ECF2 /* diff_scheme_checker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6AD75661F3093370027ECF2 /* diff_scheme_checker.cpp */; };
|
||||
F6AD75691F3093370027ECF2 /* diff_scheme_checker.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F6AD75671F3093370027ECF2 /* diff_scheme_checker.hpp */; };
|
||||
F68CC5BE1F38B967007527C7 /* diff_scheme_checker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F68CC5BB1F38B967007527C7 /* diff_scheme_checker.cpp */; };
|
||||
F68CC5BF1F38B967007527C7 /* diff_scheme_checker.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F68CC5BC1F38B967007527C7 /* diff_scheme_checker.hpp */; };
|
||||
F68CC5C01F38B967007527C7 /* diff_types.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F68CC5BD1F38B967007527C7 /* diff_types.hpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -290,9 +290,9 @@
|
|||
F66D56A91EAE38030081E883 /* libtraffic.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtraffic.a; path = ../traffic/build/Debug/libtraffic.a; sourceTree = "<group>"; };
|
||||
F66D56AB1EAE38150081E883 /* liblocal_ads.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblocal_ads.a; path = ../local_ads/build/Debug/liblocal_ads.a; sourceTree = "<group>"; };
|
||||
F66D56B11EAE385B0081E883 /* local_ads_symbols.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = local_ads_symbols.txt; sourceTree = "<group>"; };
|
||||
F68CC5B91F386BD1007527C7 /* diff_types.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = diff_types.hpp; sourceTree = "<group>"; };
|
||||
F6AD75661F3093370027ECF2 /* diff_scheme_checker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = diff_scheme_checker.cpp; sourceTree = "<group>"; };
|
||||
F6AD75671F3093370027ECF2 /* diff_scheme_checker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = diff_scheme_checker.hpp; sourceTree = "<group>"; };
|
||||
F68CC5BB1F38B967007527C7 /* diff_scheme_checker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = diff_scheme_checker.cpp; path = diff_scheme/diff_scheme_checker.cpp; sourceTree = "<group>"; };
|
||||
F68CC5BC1F38B967007527C7 /* diff_scheme_checker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = diff_scheme_checker.hpp; path = diff_scheme/diff_scheme_checker.hpp; sourceTree = "<group>"; };
|
||||
F68CC5BD1F38B967007527C7 /* diff_types.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = diff_types.hpp; path = diff_scheme/diff_types.hpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -510,9 +510,9 @@
|
|||
675342E21A3F59EF00A0A8C3 /* storage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F68CC5B91F386BD1007527C7 /* diff_types.hpp */,
|
||||
F6AD75661F3093370027ECF2 /* diff_scheme_checker.cpp */,
|
||||
F6AD75671F3093370027ECF2 /* diff_scheme_checker.hpp */,
|
||||
F68CC5BB1F38B967007527C7 /* diff_scheme_checker.cpp */,
|
||||
F68CC5BC1F38B967007527C7 /* diff_scheme_checker.hpp */,
|
||||
F68CC5BD1F38B967007527C7 /* diff_types.hpp */,
|
||||
67BE1DC31CD2180D00572709 /* downloading_policy.cpp */,
|
||||
67BE1DC41CD2180D00572709 /* downloading_policy.hpp */,
|
||||
34C9BCFA1C6CCF85000DC38D /* country_name_getter.cpp */,
|
||||
|
@ -584,11 +584,11 @@
|
|||
674125201B4C05FA00A3E828 /* map_files_downloader.hpp in Headers */,
|
||||
56D8CB9A1CAC17A80003F420 /* test_defines.hpp in Headers */,
|
||||
6753430D1A3F5A2600A0A8C3 /* country_polygon.hpp in Headers */,
|
||||
F68CC5BA1F386BD1007527C7 /* diff_types.hpp in Headers */,
|
||||
F68CC5C01F38B967007527C7 /* diff_types.hpp in Headers */,
|
||||
34C9BCFD1C6CCF85000DC38D /* country_name_getter.hpp in Headers */,
|
||||
6741251F1B4C05FA00A3E828 /* http_map_files_downloader.hpp in Headers */,
|
||||
67BE1DC61CD2180D00572709 /* downloading_policy.hpp in Headers */,
|
||||
F6AD75691F3093370027ECF2 /* diff_scheme_checker.hpp in Headers */,
|
||||
F68CC5BF1F38B967007527C7 /* diff_scheme_checker.hpp in Headers */,
|
||||
675343191A3F5A2600A0A8C3 /* storage_defines.hpp in Headers */,
|
||||
67247FD41C60BA8A00EDE56A /* task_runner.hpp in Headers */,
|
||||
6753430F1A3F5A2600A0A8C3 /* country.hpp in Headers */,
|
||||
|
@ -770,7 +770,7 @@
|
|||
34B093221C61F9BA0066F4C3 /* storage_helpers.cpp in Sources */,
|
||||
675343091A3F5A2600A0A8C3 /* country_decl.cpp in Sources */,
|
||||
674125211B4C05FA00A3E828 /* queued_country.cpp in Sources */,
|
||||
F6AD75681F3093370027ECF2 /* diff_scheme_checker.cpp in Sources */,
|
||||
F68CC5BE1F38B967007527C7 /* diff_scheme_checker.cpp in Sources */,
|
||||
6753431A1A3F5A2600A0A8C3 /* storage.cpp in Sources */,
|
||||
675343161A3F5A2600A0A8C3 /* index.cpp in Sources */,
|
||||
678338D51C723B1A00FD6263 /* helpers.cpp in Sources */,
|
||||
|
|
Loading…
Add table
Reference in a new issue