diff --git a/kml/kml_tests/tests_data.hpp b/kml/kml_tests/tests_data.hpp index e5f539edb9..fc0be10061 100644 --- a/kml/kml_tests/tests_data.hpp +++ b/kml/kml_tests/tests_data.hpp @@ -739,7 +739,7 @@ std::vector const kBinKmlV4 = { 0x2D, 0x37, 0x64, 0x66, 0x38, 0x34, 0x65, 0x61, 0x38, 0x64, 0x36, 0x61, 0x37, 0x1E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x26, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0xA1, 0xD1, 0xEC, 0x05, 0x01, 0x04, 0x01, 0x19, 0x06, 0x00, 0x09, 0x04, 0x00, 0x02, 0x01, 0x03, 0x06, 0x04, 0x19, 0x01, 0x00, 0x04, 0x00, 0x06, 0x01, 0x07, 0x06, 0x08, 0x19, 0x05, 0x01, 0x00, 0x09, 0x01, 0x00, 0x0A, 0x01, 0x00, 0x0B, 0x06, 0x00, 0x0C, 0x01, diff --git a/kml/types_v3.hpp b/kml/types_v3.hpp index 648869aeff..01399336c2 100644 --- a/kml/types_v3.hpp +++ b/kml/types_v3.hpp @@ -180,7 +180,7 @@ struct CategoryDataV3 { // We don't convert m_cities to m_toponyms, since m_cities have been never used. CategoryData data; - data.m_id = kInvalidMarkGroupId; + data.m_id = m_id; data.m_name = m_name; data.m_imageUrl = m_imageUrl; data.m_annotation = m_annotation; diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 8bfb867a5c..3347a2af5a 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -2472,21 +2472,22 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool bool BookmarkManager::HasDuplicatedIds(kml::FileData const & fileData) const { CHECK_THREAD_CHECKER(m_threadChecker, ()); - if (fileData.m_categoryData.m_id == kml::kInvalidMarkGroupId) - return false; - if (m_categories.find(fileData.m_categoryData.m_id) != m_categories.cend()) + if (fileData.m_categoryData.m_id != kml::kInvalidMarkGroupId && + m_categories.find(fileData.m_categoryData.m_id) != m_categories.cend()) + { return true; + } for (auto const & b : fileData.m_bookmarksData) { - if (m_bookmarks.count(b.m_id) > 0) + if (b.m_id != kml::kInvalidMarkId && m_bookmarks.count(b.m_id) > 0) return true; } for (auto const & t : fileData.m_tracksData) { - if (m_tracks.count(t.m_id) > 0) + if (t.m_id != kml::kInvalidTrackId && m_tracks.count(t.m_id) > 0) return true; } return false; diff --git a/map/user_mark_id_storage.cpp b/map/user_mark_id_storage.cpp index 1a3c0ff0bc..a2c4d3cf9d 100644 --- a/map/user_mark_id_storage.cpp +++ b/map/user_mark_id_storage.cpp @@ -68,10 +68,6 @@ void UserMarkIdStorage::ResetCategoryId() bool UserMarkIdStorage::CheckIds(kml::FileData const & fileData) const { - // File has no ids. Check passed. - if (fileData.m_categoryData.m_id == kml::kInvalidMarkGroupId) - return true; - // Storage is just created. Check failed. if (m_isJustCreated) return false; @@ -82,18 +78,21 @@ bool UserMarkIdStorage::CheckIds(kml::FileData const & fileData) const // There are ids of categories, bookmarks or tracks with values // more than last stored maximums. Check failed. - if (fileData.m_categoryData.m_id > m_initialLastCategoryId) + if (fileData.m_categoryData.m_id != kml::kInvalidMarkGroupId && + fileData.m_categoryData.m_id > m_initialLastCategoryId) + { return false; + } for (auto const & b : fileData.m_bookmarksData) { - if (b.m_id > m_initialLastBookmarkId) + if (b.m_id != kml::kInvalidMarkId && b.m_id > m_initialLastBookmarkId) return false; } for (auto const & t : fileData.m_tracksData) { - if (t.m_id > m_initialLastTrackId) + if (t.m_id != kml::kInvalidTrackId && t.m_id > m_initialLastTrackId) return false; }