Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Alexander Borsuk
8b5b228ffb tmp 2021-12-13 17:27:10 +01:00
Alexander Borsuk
fb9ac53176 tmp Warning fixes 2021-12-13 14:31:33 +01:00
22 changed files with 205 additions and 493 deletions

View file

@ -5,7 +5,6 @@
#include "map/bookmark_helpers.hpp"
#include "map/place_page_info.hpp"
#include "coding/zip_creator.hpp"
#include "platform/localization.hpp"
@ -114,148 +113,6 @@ void PrepareClassRefs(JNIEnv * env)
jni::GetMethodID(env, bookmarkManagerInstance, "onElevationActivePointChanged", "()V");
}
void OnElevationCurPositionChanged(JNIEnv * env)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance =
env->GetStaticObjectField(g_bookmarkManagerClass, g_bookmarkManagerInstanceField);
env->CallVoidMethod(bookmarkManagerInstance, g_onElevationCurrentPositionChangedMethod);
jni::HandleJavaException(env);
}
void OnElevationActivePointChanged(JNIEnv * env)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
env->CallVoidMethod(bookmarkManagerInstance, g_onElevationActivePointChangedMethod);
jni::HandleJavaException(env);
}
void OnBookmarksChanged(JNIEnv * env)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksChangedMethod);
jni::HandleJavaException(env);
}
void OnAsyncLoadingStarted(JNIEnv * env)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksLoadingStartedMethod);
jni::HandleJavaException(env);
}
void OnAsyncLoadingFinished(JNIEnv * env)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksLoadingFinishedMethod);
jni::HandleJavaException(env);
}
void OnAsyncLoadingFileSuccess(JNIEnv * env, std::string const & fileName, bool isTemporaryFile)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksFileLoadedMethod,
true /* success */, jFileName.get(), isTemporaryFile);
jni::HandleJavaException(env);
}
void OnAsyncLoadingFileError(JNIEnv * env, std::string const & fileName, bool isTemporaryFile)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksFileLoadedMethod,
false /* success */, jFileName.get(), isTemporaryFile);
jni::HandleJavaException(env);
}
void OnPreparedFileForSharing(JNIEnv * env, BookmarkManager::SharingResult const & result)
{
ASSERT(g_bookmarkManagerClass, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
static jclass const classBookmarkSharingResult = jni::GetGlobalClassRef(env,
"com/mapswithme/maps/bookmarks/data/BookmarkSharingResult");
// Java signature : BookmarkSharingResult(long categoryId, @Code int code,
// @NonNull String sharingPath,
// @NonNull String errorString)
static jmethodID const ctorBookmarkSharingResult = jni::GetConstructorID(env,
classBookmarkSharingResult, "(JILjava/lang/String;Ljava/lang/String;)V");
jni::TScopedLocalRef const sharingPath(env, jni::ToJavaString(env, result.m_sharingPath));
jni::TScopedLocalRef const errorString(env, jni::ToJavaString(env, result.m_errorString));
jni::TScopedLocalRef const sharingResult(env, env->NewObject(classBookmarkSharingResult,
ctorBookmarkSharingResult, static_cast<jlong>(result.m_categoryId),
static_cast<jint>(result.m_code), sharingPath.get(), errorString.get()));
env->CallVoidMethod(bookmarkManagerInstance, g_onPreparedFileForSharingMethod,
sharingResult.get());
jni::HandleJavaException(env);
}
void OnCategorySortingResults(JNIEnv * env, long long timestamp,
BookmarkManager::SortedBlocksCollection && sortedBlocks,
BookmarkManager::SortParams::Status status)
{
ASSERT(g_bookmarkManagerClass, ());
ASSERT(g_sortedBlockClass, ());
ASSERT(g_sortedBlockConstructor, ());
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
g_bookmarkManagerInstanceField);
if (status == BookmarkManager::SortParams::Status::Cancelled)
{
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksSortingCancelled,
static_cast<jlong>(timestamp));
jni::HandleJavaException(env);
return;
}
jni::TScopedLocalObjectArrayRef blocksRef(env,
jni::ToJavaArray(env, g_sortedBlockClass, sortedBlocks,
[](JNIEnv * env, BookmarkManager::SortedBlock const & block)
{
jni::TScopedLocalRef blockNameRef(env, jni::ToJavaString(env, block.m_blockName));
jni::TScopedLocalObjectArrayRef marksRef(env,
jni::ToJavaArray(env, g_longClass, block.m_markIds,
[](JNIEnv * env, kml::MarkId const & markId)
{
return env->NewObject(g_longClass, g_longConstructor,
static_cast<jlong>(markId));
}));
jni::TScopedLocalObjectArrayRef tracksRef(env,
jni::ToJavaArray(env, g_longClass, block.m_trackIds,
[](JNIEnv * env, kml::TrackId const & trackId)
{
return env->NewObject(g_longClass, g_longConstructor,
static_cast<jlong>(trackId));
}));
return env->NewObject(g_sortedBlockClass, g_sortedBlockConstructor,
blockNameRef.get(), marksRef.get(), tracksRef.get());
}));
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksSortingCompleted,
blocksRef.get(), static_cast<jlong>(timestamp));
jni::HandleJavaException(env);
}
Bookmark const * getBookmark(jlong bokmarkId)
{
Bookmark const * pBmk = frm()->GetBookmarkManager().GetBookmark(static_cast<kml::MarkId>(bokmarkId));
@ -299,64 +156,58 @@ jobjectArray MakeCategories(JNIEnv * env, kml::GroupIdCollection const & ids)
extern "C"
{
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeShowBookmarkOnMap(
JNIEnv * env, jobject thiz, jlong bmkId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeShowBookmarkOnMap(JNIEnv *, jobject thiz, jlong bmkId)
{
frm()->ShowBookmark(static_cast<kml::MarkId>(bmkId));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeShowBookmarkCategoryOnMap(
JNIEnv * env, jobject thiz, jlong catId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeShowBookmarkCategoryOnMap(JNIEnv *, jobject, jlong catId)
{
frm()->ShowBookmarkCategory(static_cast<kml::MarkGroupId>(catId), true /* animated */);
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeLoadBookmarks(JNIEnv * env, jobject)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeLoadBookmarks(JNIEnv * env, jobject thiz)
{
// TODO: Remove.
PrepareClassRefs(env);
BookmarkManager::AsyncLoadingCallbacks callbacks;
callbacks.m_onStarted = std::bind(&OnAsyncLoadingStarted, env);
callbacks.m_onFinished = std::bind(&OnAsyncLoadingFinished, env);
callbacks.m_onFileSuccess = std::bind(&OnAsyncLoadingFileSuccess, env, _1, _2);
callbacks.m_onFileError = std::bind(&OnAsyncLoadingFileError, env, _1, _2);
frm()->GetBookmarkManager().SetAsyncLoadingCallbacks(std::move(callbacks));
callbacks.m_onStarted = [env, thiz]()
{
env->CallVoidMethod(thiz, g_onBookmarksLoadingStartedMethod);
jni::HandleJavaException(env);
};
callbacks.m_onFinished = [env, thiz]()
{
env->CallVoidMethod(thiz, g_onBookmarksLoadingFinishedMethod);
jni::HandleJavaException(env);
};
callbacks.m_onFileSuccess = [env, thiz](std::string const & fileName, bool isTemporaryFile)
{
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
env->CallVoidMethod(thiz, g_onBookmarksFileLoadedMethod, true /* success */, jFileName.get(), isTemporaryFile);
jni::HandleJavaException(env);
};
callbacks.m_onFileError = [env, thiz](std::string const & fileName, bool isTemporaryFile)
{
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
env->CallVoidMethod(thiz, g_onBookmarksFileLoadedMethod, false /* success */, jFileName.get(), isTemporaryFile);
jni::HandleJavaException(env);
};
frm()->GetBookmarkManager().SetBookmarksChangedCallback(std::bind(&OnBookmarksChanged, env));
frm()->LoadBookmarks();
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoriesCount(
JNIEnv * env, jobject thiz)
{
return static_cast<int>(frm()->GetBookmarkManager().GetBmGroupsIdList().size());
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryPositionById(
JNIEnv * env, jobject thiz, jlong catId)
{
auto & ids = frm()->GetBookmarkManager().GetBmGroupsIdList();
jint position = 0;
while (position < ids.size() && ids[position] != catId)
++position;
return position;
auto f = frm();
f->GetBookmarkManager().SetAsyncLoadingCallbacks(std::move(callbacks));
f->GetBookmarkManager().SetBookmarksChangedCallback([env, thiz]()
{
env->CallVoidMethod(thiz, g_onBookmarksChangedMethod);
jni::HandleJavaException(env);
});
f->LoadBookmarks();
}
JNIEXPORT jlong JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryIdByPosition(
JNIEnv * env, jobject thiz, jint position)
{
auto & ids = frm()->GetBookmarkManager().GetBmGroupsIdList();
return static_cast<jlong>(position < ids.size() ? ids[position] : kml::kInvalidMarkGroupId);
}
JNIEXPORT jlong JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeCreateCategory(
JNIEnv * env, jobject thiz, jstring name)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeCreateCategory(JNIEnv * env, jobject, jstring name)
{
auto const categoryId = frm()->GetBookmarkManager().CreateBookmarkCategory(ToNativeString(env, name));
frm()->GetBookmarkManager().SetLastEditedBmCategory(categoryId);
@ -364,8 +215,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeCreateCategory(
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeDeleteCategory(
JNIEnv * env, jobject thiz, jlong catId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeDeleteCategory(JNIEnv *, jobject, jlong catId)
{
auto const categoryId = static_cast<kml::MarkGroupId>(catId);
return static_cast<jboolean>(frm()->GetBookmarkManager().GetEditSession().DeleteBmCategory(categoryId));
@ -430,7 +280,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetLastEditedColor
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeLoadBookmarksFile(JNIEnv * env, jobject thiz,
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeLoadBookmarksFile(JNIEnv * env, jclass,
jstring path, jboolean isTemporaryFile)
{
frm()->AddBookmarksFile(ToNativeString(env, path), isTemporaryFile);
@ -465,18 +315,14 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryName(
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryDescription(JNIEnv * env,
jobject thiz,
jlong catId,
jstring desc)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryDescription(JNIEnv * env, jobject, jlong catId, jstring desc)
{
frm()->GetBookmarkManager().GetEditSession().SetCategoryDescription(
static_cast<kml::MarkGroupId>(catId), jni::ToNativeString(env, desc));
frm()->GetBookmarkManager().GetEditSession().SetCategoryDescription(static_cast<kml::MarkGroupId>(catId),
jni::ToNativeString(env, desc));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryTags(
JNIEnv * env, jobject, jlong catId, jobjectArray tagsIds)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryTags(JNIEnv * env, jobject, jlong catId, jobjectArray tagsIds)
{
auto const size = env->GetArrayLength(tagsIds);
std::vector<std::string> categoryTags;
@ -507,33 +353,9 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryCustomP
static_cast<kml::MarkGroupId>(catId), ToNativeString(env, key), ToNativeString(env, value));
}
JNIEXPORT jstring JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryName(
JNIEnv * env, jobject thiz, jlong catId)
{
return ToJavaString(env, frm()->GetBookmarkManager().GetCategoryName(
static_cast<kml::MarkGroupId>(catId)));
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarksCount(
JNIEnv * env, jobject thiz, jlong catId)
{
return static_cast<int>(frm()->GetBookmarkManager().GetUserMarkIds(
static_cast<kml::MarkGroupId>(catId)).size());
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTracksCount(
JNIEnv * env, jobject thiz, jlong catId)
{
return static_cast<int>(frm()->GetBookmarkManager().GetTrackIds(
static_cast<kml::MarkGroupId>(catId)).size());
}
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeUpdateBookmarkPlacePage(
JNIEnv * env, jobject thiz, jlong bmkId)
JNIEnv * env, jobject, jlong bmkId)
{
if (!frm()->HasPlacePageInfo())
return nullptr;
@ -560,24 +382,21 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkInfo(
JNIEXPORT jlong JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkIdByPosition(
JNIEnv * env, jobject thiz, jlong catId, jint positionInCategory)
JNIEnv * env, jobject, jlong catId, jint positionInCategory)
{
auto & ids = frm()->GetBookmarkManager().GetUserMarkIds(static_cast<kml::MarkGroupId>(catId));
if (positionInCategory >= ids.size())
if (positionInCategory >= static_cast<jint>(ids.size()))
return static_cast<jlong>(kml::kInvalidMarkId);
auto it = ids.begin();
std::advance(it, positionInCategory);
return static_cast<jlong>(*it);
}
static uint32_t shift(uint32_t v, uint8_t bitCount) { return v << bitCount; }
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrack(
JNIEnv * env, jobject thiz, jlong trackId, jclass trackClazz)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrack(JNIEnv * env, jobject, jlong trackId, jclass trackClazz)
{
// Track(long trackId, long categoryId, String name, String lengthString, int color)
static jmethodID const cId = jni::GetConstructorID(env, trackClazz,
static jmethodID cId = jni::GetConstructorID(env, trackClazz,
"(JJLjava/lang/String;Ljava/lang/String;I)V");
auto const * nTrack = frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId));
@ -587,24 +406,18 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrack(
std::string formattedLength = measurement_utils::FormatDistanceWithLocalization(nTrack->GetLengthMeters(),
localizedUnits.m_high,
localizedUnits.m_low);
dp::Color nColor = nTrack->GetColor(0);
dp::Color const c = nTrack->GetColor(0);
jint const androidColor = (c.GetAlpha() << 24) + (c.GetRed() << 16) + (c.GetGreen() << 8) + c.GetBlue();
jint androidColor = shift(nColor.GetAlpha(), 24) +
shift(nColor.GetRed(), 16) +
shift(nColor.GetGreen(), 8) +
nColor.GetBlue();
return env->NewObject(trackClazz, cId,
trackId, static_cast<jlong>(nTrack->GetGroupId()), jni::ToJavaString(env, nTrack->GetName()),
jni::ToJavaString(env, formattedLength), androidColor);
return env->NewObject(trackClazz, cId, trackId, static_cast<jlong>(nTrack->GetGroupId()),
jni::ToJavaString(env, nTrack->GetName()), jni::ToJavaString(env, formattedLength), androidColor);
}
JNIEXPORT jlong JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrackIdByPosition(
JNIEnv * env, jobject thiz, jlong catId, jint positionInCategory)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrackIdByPosition(JNIEnv * env, jobject thiz, jlong catId, jint positionInCategory)
{
auto & ids = frm()->GetBookmarkManager().GetTrackIds(static_cast<kml::MarkGroupId>(catId));
if (positionInCategory >= ids.size())
if (positionInCategory >= static_cast<jint>(ids.size()))
return static_cast<jlong>(kml::kInvalidTrackId);
auto it = ids.begin();
std::advance(it, positionInCategory);
@ -613,55 +426,60 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetTrackIdByPositi
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeIsUsedCategoryName(
JNIEnv * env, jobject thiz, jstring name)
JNIEnv * env, jclass, jstring name)
{
return static_cast<jboolean>(frm()->GetBookmarkManager().IsUsedCategoryName(
ToNativeString(env, name)));
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeIsSearchAllowed(
JNIEnv * env, jobject thiz, jlong catId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeIsSearchAllowed(JNIEnv *, jclass, jlong catId)
{
return static_cast<jboolean>(frm()->GetBookmarkManager().IsSearchAllowed(static_cast<kml::MarkGroupId>(catId)));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativePrepareForSearch(
JNIEnv * env, jobject thiz, jlong catId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativePrepareForSearch(JNIEnv *, jclass, jlong catId)
{
frm()->GetBookmarkManager().PrepareForSearch(static_cast<kml::MarkGroupId>(catId));
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAreAllCategoriesInvisible(
JNIEnv * env, jobject thiz)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAreAllCategoriesInvisible(JNIEnv *, jclass)
{
return static_cast<jboolean>(frm()->GetBookmarkManager().AreAllCategoriesInvisible());
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAreAllCategoriesVisible(
JNIEnv * env, jobject thiz)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAreAllCategoriesVisible(JNIEnv *, jclass)
{
return static_cast<jboolean>(frm()->GetBookmarkManager().AreAllCategoriesVisible());
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetAllCategoriesVisibility(
JNIEnv * env, jobject thiz, jboolean visible)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetAllCategoriesVisibility(JNIEnv *, jclass, jboolean visible)
{
frm()->GetBookmarkManager().SetAllCategoriesVisibility(static_cast<bool>(visible));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativePrepareFileForSharing(
JNIEnv * env, jobject thiz, jlong catId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativePrepareFileForSharing(JNIEnv * env, jobject bmClazz, jclass bmSRClazz, jlong catId)
{
frm()->GetBookmarkManager().PrepareFileForSharing(static_cast<kml::MarkGroupId>(catId),
[env](BookmarkManager::SharingResult const & result)
frm()->GetBookmarkManager().PrepareFileForSharing(static_cast<kml::MarkGroupId>(catId), [=](BookmarkManager::SharingResult const & result)
{
OnPreparedFileForSharing(env, result);
// Java signature : BookmarkSharingResult(long categoryId, @Code int code,
// @NonNull String sharingPath,
// @NonNull String errorString)
static jmethodID ctorBookmarkSharingResult = jni::GetConstructorID(env, bmSRClazz, "(JILjava/lang/String;Ljava/lang/String;)V");
jni::TScopedLocalRef const sharingPath(env, jni::ToJavaString(env, result.m_sharingPath));
jni::TScopedLocalRef const errorString(env, jni::ToJavaString(env, result.m_errorString));
jni::TScopedLocalRef const sharingResult(env, env->NewObject(bmSRClazz,
ctorBookmarkSharingResult, static_cast<jlong>(result.m_categoryId),
static_cast<jint>(result.m_code), sharingPath.get(), errorString.get()));
env->CallVoidMethod(bmClazz, g_onPreparedFileForSharingMethod, sharingResult.get());
jni::HandleJavaException(env);
});
}
@ -688,16 +506,13 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAreNotificationsEn
}
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkCategory(JNIEnv *env,
jobject,
jlong id)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkCategory(JNIEnv *env, jobject, jlong id)
{
return MakeCategory(env, static_cast<kml::MarkGroupId>(id));
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkCategories(JNIEnv *env,
jobject)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkCategories(JNIEnv *env, jobject)
{
auto const & bm = frm()->GetBookmarkManager();
auto const & ids = bm.GetBmGroupsIdList();
@ -706,9 +521,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkCategor
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetChildrenCategories(JNIEnv *env,
jobject,
jlong parentId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetChildrenCategories(JNIEnv *env, jobject, jlong parentId)
{
auto const & bm = frm()->GetBookmarkManager();
auto const ids = bm.GetChildrenCategories(static_cast<kml::MarkGroupId>(parentId));
@ -716,17 +529,6 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetChildrenCategor
return MakeCategories(env, ids);
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetChildrenCollections(JNIEnv *env,
jobject,
jlong parentId)
{
auto const & bm = frm()->GetBookmarkManager();
auto const ids = bm.GetChildrenCollections(static_cast<kml::MarkGroupId>(parentId));
return MakeCategories(env, ids);
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeHasLastSortingType(
JNIEnv *, jobject, jlong catId)
@ -783,9 +585,10 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetAvailableSortin
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetSortedCategory(JNIEnv *env,
jobject, jlong catId, jint sortingType, jboolean hasMyPosition, jdouble lat, jdouble lon,
jlong timestamp)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetSortedCategory(JNIEnv *env, jobject thiz,
jlong catId, jint sortingType,
jboolean hasMyPosition, jdouble lat,
jdouble lon, jlong timestamp)
{
auto & bm = frm()->GetBookmarkManager();
BookmarkManager::SortParams sortParams;
@ -794,14 +597,47 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetSortedCategory(
sortParams.m_hasMyPosition = static_cast<bool>(hasMyPosition);
sortParams.m_myPosition = mercator::FromLatLon(static_cast<double>(lat),
static_cast<double>(lon));
sortParams.m_onResults = bind(&OnCategorySortingResults, env, timestamp, _1, _2);
sortParams.m_onResults = [env, thiz, timestamp](BookmarkManager::SortedBlocksCollection && sortedBlocks,
BookmarkManager::SortParams::Status status)
{
ASSERT(g_sortedBlockClass, ());
ASSERT(g_sortedBlockConstructor, ());
if (status == BookmarkManager::SortParams::Status::Cancelled)
{
env->CallVoidMethod(thiz, g_onBookmarksSortingCancelled, static_cast<jlong>(timestamp));
jni::HandleJavaException(env);
return;
}
jni::TScopedLocalObjectArrayRef blocksRef(env, jni::ToJavaArray(env, g_sortedBlockClass, sortedBlocks,
[](JNIEnv * env, BookmarkManager::SortedBlock const & block)
{
jni::TScopedLocalRef blockNameRef(env, jni::ToJavaString(env, block.m_blockName));
jni::TScopedLocalObjectArrayRef marksRef(env, jni::ToJavaArray(env, g_longClass, block.m_markIds,
[](JNIEnv * env, kml::MarkId const & markId)
{
return env->NewObject(g_longClass, g_longConstructor, static_cast<jlong>(markId));
}));
jni::TScopedLocalObjectArrayRef tracksRef(env, jni::ToJavaArray(env, g_longClass, block.m_trackIds,
[](JNIEnv * env, kml::TrackId const & trackId)
{
return env->NewObject(g_longClass, g_longConstructor, static_cast<jlong>(trackId));
}));
return env->NewObject(g_sortedBlockClass, g_sortedBlockConstructor, blockNameRef.get(), marksRef.get(), tracksRef.get());
}));
env->CallVoidMethod(thiz, g_onBookmarksSortingCompleted, blocksRef.get(), static_cast<jlong>(timestamp));
jni::HandleJavaException(env);
}
bm.GetSortedCategory(sortParams);
}
JNIEXPORT jstring JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkName(
JNIEnv * env, jobject thiz, jlong bmk)
JNIEnv * env, jobject, jlong bmk)
{
return jni::ToJavaString(env, getBookmark(bmk)->GetPreferredName());
}
@ -840,9 +676,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkIcon(
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetBookmarkParams(
JNIEnv * env, jobject thiz, jlong bmk,
jstring name, jint color, jstring descr)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetBookmarkParams(JNIEnv * env, jobject thiz, jlong bmk, jstring name, jint color, jstring description)
{
auto const * mark = getBookmark(bmk);
@ -851,64 +685,60 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetBookmarkParams(
auto const bmName = jni::ToNativeString(env, name);
if (mark->GetPreferredName() != bmName)
kml::SetDefaultStr(bmData.m_customName, bmName);
if (descr)
kml::SetDefaultStr(bmData.m_description, jni::ToNativeString(env, descr));
if (description)
kml::SetDefaultStr(bmData.m_description, jni::ToNativeString(env, description));
bmData.m_color.m_predefinedColor = static_cast<kml::PredefinedColor>(color);
g_framework->ReplaceBookmark(static_cast<kml::MarkId>(bmk), bmData);
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeChangeBookmarkCategory(
JNIEnv * env, jobject thiz, jlong oldCat, jlong newCat, jlong bmk)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeChangeBookmarkCategory(JNIEnv *, jobject thiz, jlong oldCat, jlong newCat, jlong bmk)
{
g_framework->MoveBookmark(static_cast<kml::MarkId>(bmk), static_cast<kml::MarkGroupId>(oldCat),
static_cast<kml::MarkGroupId>(newCat));
}
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkXY(
JNIEnv * env, jobject thiz, jlong bmk)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkXY(JNIEnv * env, jobject thiz, jlong bmk)
{
return jni::GetNewParcelablePointD(env, getBookmark(bmk)->GetPivot());
}
JNIEXPORT jdouble JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkScale(
JNIEnv * env, jobject thiz, jlong bmk)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkScale(JNIEnv *, jobject thiz, jlong bmk)
{
return getBookmark(bmk)->GetScale();
}
JNIEXPORT jstring JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeEncode2Ge0Url(
JNIEnv * env, jobject thiz, jlong bmk, jboolean addName)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeEncode2Ge0Url(JNIEnv * env, jobject thiz, jlong bmk, jboolean addName)
{
return jni::ToJavaString(env, frm()->CodeGe0url(getBookmark(bmk), addName));
return jni::ToJavaString(env, Framework::CodeGe0url(getBookmark(bmk), addName));
}
JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkAddress(
JNIEnv * env, jobject thiz, jlong bmkId)
JNIEXPORT jstring JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarkAddress(JNIEnv * env, jobject thiz, jlong bmkId)
{
auto const address = frm()->GetAddressAtPoint(getBookmark(bmkId)->GetPivot()).FormatAddress();
return jni::ToJavaString(env, address);
}
JNIEXPORT jdouble JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetElevationCurPositionDistance(
JNIEnv * env, jclass clazz, jlong trackId)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetElevationCurPositionDistance(JNIEnv *, jclass, jlong trackId)
{
auto & bm = frm()->GetBookmarkManager();
return static_cast<jdouble>(bm.GetElevationMyPosition(static_cast<kml::TrackId>(trackId)));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetElevationCurrentPositionChangedListener(
JNIEnv * env, jclass clazz)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetElevationCurrentPositionChangedListener(JNIEnv * env, jobject thiz)
{
frm()->GetBookmarkManager().SetElevationMyPositionChangedCallback(
std::bind(&OnElevationCurPositionChanged, env));
frm()->GetBookmarkManager().SetElevationMyPositionChangedCallback([env, thiz]()
{
env->CallVoidMethod(thiz, g_onElevationCurrentPositionChangedMethod);
jni::HandleJavaException(env);
});
}
JNIEXPORT void JNICALL
@ -936,15 +766,17 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetElevationActive
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetElevationActiveChangedListener(
JNIEnv *env, jclass clazz)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetElevationActiveChangedListener(JNIEnv *env, jobject thiz)
{
frm()->GetBookmarkManager().SetElevationActivePointChangedCallback(std::bind(&OnElevationActivePointChanged, env));
frm()->GetBookmarkManager().SetElevationActivePointChangedCallback([env, thiz]()
{
env->CallVoidMethod(thiz, g_onElevationActivePointChangedMethod);
jni::HandleJavaException(env);
});
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeRemoveElevationActiveChangedListener(
JNIEnv *env, jclass)
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeRemoveElevationActiveChangedListener(JNIEnv *env, jclass)
{
frm()->GetBookmarkManager().SetElevationActivePointChangedCallback(nullptr);
}

View file

@ -221,7 +221,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
initNativeStrings();
ThemeSwitcher.INSTANCE.initialize(this);
SearchEngine.INSTANCE.initialize(null);
BookmarkManager.loadBookmarks();
BookmarkManager.INSTANCE.nativeLoadBookmarks();
TtsPlayer.INSTANCE.initialize(this);
ThemeSwitcher.INSTANCE.restart(false);
LocationHelper.INSTANCE.initialize(this);

View file

@ -28,7 +28,7 @@ public class BookmarkInfo
{
mCategoryId = categoryId;
mBookmarkId = bookmarkId;
mTitle = BookmarkManager.INSTANCE.getBookmarkName(mBookmarkId);
mTitle = BookmarkManager.INSTANCE.nativeGetBookmarkName(mBookmarkId);
mFeatureType = BookmarkManager.INSTANCE.getBookmarkFeatureType(mBookmarkId);
mIcon = new Icon(BookmarkManager.INSTANCE.getBookmarkColor(mBookmarkId),
BookmarkManager.INSTANCE.getBookmarkIcon(mBookmarkId));

View file

@ -245,8 +245,7 @@ public enum BookmarkManager
// Called from JNI.
@SuppressWarnings("unused")
@MainThread
public void onBookmarksFileLoaded(boolean success, @NonNull String fileName,
boolean isTemporaryFile)
public void onBookmarksFileLoaded(boolean success, @NonNull String fileName, boolean isTemporaryFile)
{
// Android could create temporary file with bookmarks in some cases (KML/KMZ file is a blob
// in the intent, so we have to create a temporary file on the disk). Here we can delete it.
@ -384,8 +383,6 @@ public enum BookmarkManager
return nativeGetTrackIdByPosition(catId, positionInCategory);
}
public static void loadBookmarks() { nativeLoadBookmarks(); }
public void deleteCategory(long catId) { nativeDeleteCategory(catId); }
public void deleteTrack(long trackId)
@ -563,7 +560,7 @@ public enum BookmarkManager
public void prepareCategoryForSharing(long catId)
{
nativePrepareFileForSharing(catId);
nativePrepareFileForSharing(catId, BookmarkSharingResult.class);
}
public void setNotificationsEnabled(boolean enabled)
@ -582,11 +579,6 @@ public enum BookmarkManager
return nativeGetCatalogFrontendUrl(utm);
}
public void requestRouteTags()
{
nativeRequestCatalogTags();
}
public boolean hasLastSortingType(long catId) { return nativeHasLastSortingType(catId); }
@SortingType
@ -626,12 +618,6 @@ public enum BookmarkManager
@NonNull
native BookmarkCategory[] nativeGetChildrenCategories(long catId);
@NonNull
public String getBookmarkName(@IntRange(from = 0) long bookmarkId)
{
return nativeGetBookmarkName(bookmarkId);
}
@NonNull
public String getBookmarkFeatureType(@IntRange(from = 0) long bookmarkId)
{
@ -772,13 +758,7 @@ public enum BookmarkManager
private native void nativeSetCategoryDescription(long catId, @NonNull String desc);
private native void nativeSetCategoryTags(long catId, @NonNull String[] tagsIds);
private native void nativeSetCategoryAccessRules(long catId, int accessRules);
private native void nativeSetCategoryCustomProperty(long catId, String key, String value);
private static native void nativeLoadBookmarks();
public native void nativeLoadBookmarks();
private native boolean nativeDeleteCategory(long catId);
@ -817,41 +797,14 @@ public enum BookmarkManager
private static native boolean nativeAreAllCategoriesInvisible();
private static native void nativeSetChildCategoriesVisibility(long catId, boolean visible);
private static native void nativeSetAllCategoriesVisibility(boolean visible);
private static native void nativePrepareFileForSharing(long catId);
private static native boolean nativeIsCategoryEmpty(long catId);
private native void nativePrepareFileForSharing(long catId, Class<BookmarkSharingResult> bmSRclazz);
private static native void nativeSetNotificationsEnabled(boolean enabled);
private static native boolean nativeAreNotificationsEnabled();
@NonNull
private static native String nativeGetCatalogDeeplink(long catId);
@NonNull
private static native String nativeGetCatalogPublicLink(long catId);
@NonNull
private static native String nativeGetWebEditorUrl(@NonNull String serverId);
@NonNull
private static native String nativeGetCatalogFrontendUrl(@UTM.UTMType int utm);
@NonNull
private static native KeyValue[] nativeGetCatalogHeaders();
@NonNull
private static native String nativeInjectCatalogUTMContent(@NonNull String url,
@UTM.UTMContentType int content);
private static native void nativeRequestCatalogTags();
private static native void nativeRequestCatalogCustomProperties();
private native boolean nativeHasLastSortingType(long catId);
@SortingType
@ -865,12 +818,12 @@ public enum BookmarkManager
@SortingType
private native int[] nativeGetAvailableSortingTypes(long catId, boolean hasMyPosition);
private native boolean nativeGetSortedCategory(long catId, @SortingType int sortingType,
boolean hasMyPosition, double lat, double lon,
long timestamp);
private native void nativeGetSortedCategory(long catId, @SortingType int sortingType,
boolean hasMyPosition, double lat, double lon,
long timestamp);
@NonNull
private static native String nativeGetBookmarkName(@IntRange(from = 0) long bookmarkId);
public native String nativeGetBookmarkName(@IntRange(from = 0) long bookmarkId);
@NonNull
private static native String nativeGetBookmarkFeatureType(@IntRange(from = 0) long bookmarkId);
@ -907,7 +860,7 @@ public enum BookmarkManager
private static native double nativeGetElevationCurPositionDistance(long trackId);
private static native void nativeSetElevationCurrentPositionChangedListener();
private native void nativeSetElevationCurrentPositionChangedListener();
public static native void nativeRemoveElevationCurrentPositionChangedListener();
@ -915,7 +868,7 @@ public enum BookmarkManager
private static native double nativeGetElevationActivePointDistance(long trackId);
private static native void nativeSetElevationActiveChangedListener();
private native void nativeSetElevationActiveChangedListener();
public static native void nativeRemoveElevationActiveChangedListener();

View file

@ -97,7 +97,7 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
@Override
public void onLocationError(int errorCode)
{
mLogger.d(TAG, "onLocationError errorCode = " + errorCode, new Throwable());
mLogger.d(TAG, "onLocationError errorCode = " + errorCode);
mSavedLocation = null;
nativeOnLocationError(errorCode);
mLogger.d(TAG, "nativeOnLocationError errorCode = " + errorCode +

View file

@ -6,15 +6,13 @@
#include <functional>
#include <unordered_map>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include <boost/circular_buffer.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic pop
#endif
template<class Key, class Value, class HashContainer = std::unordered_map<Key, Value>>

View file

@ -1,21 +1,16 @@
#include "coding/base64.hpp"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreorder"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
#include <boost/algorithm/string.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#pragma GCC diagnostic pop
namespace base64
{

View file

@ -3,11 +3,6 @@
#include "base/assert.hpp"
#include "base/logging.hpp"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#include <memory>
#include <sstream>
#include <string>
@ -15,10 +10,6 @@
#define XML_STATIC
#include "3party/expat/expat/lib/expat.h"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
template <typename DispatcherT>
class XmlParser
{

View file

@ -13,18 +13,9 @@
#include "base/checked_cast.hpp"
#include "base/logging.hpp"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "3party/succinct/elias_fano.hpp"
#include "3party/succinct/rs_bit_vector.hpp"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#include <algorithm>
#include <cstdint>
#include <functional>

View file

@ -5,15 +5,13 @@
#include <algorithm>
#include <limits>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
#include <boost/range/adaptor/transformed.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#ifdef __clang__
#pragma clang diagnostic pop
#endif
namespace coding

View file

@ -3,17 +3,7 @@
#include <cstdint>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "3party/succinct/elias_fano_compressed_list.hpp"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
namespace coding
{

View file

@ -7,18 +7,9 @@
#include <type_traits>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
#include "3party/succinct/mappable_vector.hpp"
#include "3party/succinct/mapper.hpp"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
namespace coding
{
template <typename T>

View file

@ -12,8 +12,15 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#pragma clang diagnostic ignored "-Wcomma"
#endif
#endif // __clang__
#ifdef __gcc__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif // __gcc__
#include <boost/geometry.hpp>
#ifdef __gcc__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View file

@ -5,14 +5,7 @@
#include <algorithm>
extern "C" {
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconditional-uninitialized"
#include "3party/robust/predicates.c"
#pragma clang diagnostic pop
#else
#include "3party/robust/predicates.c"
#endif
}
using namespace std;

View file

@ -10,18 +10,9 @@
#include <string>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "3party/succinct/elias_fano.hpp"
#include "3party/succinct/mapper.hpp"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
namespace platform
{
class LocalCountryFile;

View file

@ -80,10 +80,10 @@ private:
buffer_vector<uint8_t, 1024> data;
data.resize_no_init(size);
m_Reader.Read(offset, &data[0], size);
ArrayByteSource src(&data[0]);
m_Reader.Read(offset, data.data(), size);
ArrayByteSource src(data.data());
void const * pEnd = &data[0] + size;
void const * pEnd = data.data() + size;
Value value = 0;
while (src.Ptr() < pEnd)
{
@ -122,8 +122,8 @@ private:
buffer_vector<uint8_t, 576> data;
data.resize_no_init(size);
m_Reader.Read(offset, &data[0], size);
ArrayByteSource src(&data[0]);
m_Reader.Read(offset, data.data(), size);
ArrayByteSource src(data.data());
uint32_t const offsetAndFlag = ReadVarUint<uint32_t>(src);
uint32_t childOffset = offsetAndFlag >> 1;
@ -147,12 +147,12 @@ private:
}
}
ASSERT(end0 != (static_cast<uint32_t>(1) << m_Header.m_BitsPerLevel) - 1 ||
static_cast<uint8_t const *>(src.Ptr()) - &data[0] == size,
(beg, end, beg0, end0, offset, size, src.Ptr(), &data[0]));
static_cast<uint8_t const *>(src.Ptr()) - data.data() == size,
(beg, end, beg0, end0, offset, size, src.Ptr(), data.data()));
}
else
{
void const * pEnd = &data[0] + size;
void const * pEnd = data.data() + size;
while (src.Ptr() < pEnd)
{
uint8_t const i = src.ReadByte();

View file

@ -15,17 +15,7 @@
#include <utility>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "3party/succinct/rs_bit_vector.hpp"
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
namespace trie
{

View file

@ -249,8 +249,8 @@ string FormatSpeedUnits(Units units)
string FormatOsmLink(double lat, double lon, int zoom)
{
static char char_array[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_~";
uint32_t const x = round((lon + 180.0) / 360.0 * (1L<<32));
uint32_t const y = round((lat + 90.0) / 180.0 * (1L<<32));
uint32_t const x = round((lon + 180.0) / 360.0 * (1LL << 32));
uint32_t const y = round((lat + 90.0) / 180.0 * (1LL << 32));
uint64_t const code = bits::BitwiseMerge(y, x);
string osmUrl = "https://osm.org/go/";

View file

@ -22,15 +22,13 @@
#include <utility>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include <boost/circular_buffer.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic pop
#endif
namespace

View file

@ -6,15 +6,13 @@
#include <memory>
#include <string>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include <boost/circular_buffer.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic pop
#endif
namespace platform { class Socket; }

View file

@ -7,15 +7,13 @@
#include <utility>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include <boost/circular_buffer.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic pop
#endif
namespace tracking

View file

@ -16,15 +16,13 @@
#include <string>
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include <boost/circular_buffer.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#if defined(__clang__) and !defined(__ANDROID__)
#pragma clang diagnostic pop
#endif
namespace location