From 4adb35e19184b12cdc68a0724b5729c81ef9f571 Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sat, 7 Feb 2026 13:50:43 +0300 Subject: [PATCH 1/9] Fix compilation errors on Windows Signed-off-by: Osyotr Don't set LANGUAGE environment variable on Windows Signed-off-by: Osyotr Skip (MALI_)MobileCompileShaders_TEST on Windows Signed-off-by: Osyotr --- 3party/CMakeLists.txt | 3 +++ 3party/protobuf/CMakeLists.txt | 4 ++++ dev_sandbox/main.cpp | 2 ++ libs/coding/string_utf8_multilang.cpp | 4 ++-- libs/platform/platform_win.cpp | 1 + .../shaders_tests/gl_shaders_mobile_compile_test.cpp | 4 ++++ libs/storage/storage_defines.hpp | 2 +- libs/timezone/timezone_tests/conversion_tests.cpp | 6 +++++- qt/main.cpp | 2 ++ tools/mwm_viewer/mwm_viewer.cpp | 3 ++- tools/openlr/CMakeLists.txt | 4 ++++ 11 files changed, 30 insertions(+), 5 deletions(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index e90e6251b2e..afa7e0ba8a4 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -35,6 +35,9 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) set(JANSSON_WITHOUT_TESTS ON) add_subdirectory(jansson/jansson/) target_include_directories(jansson INTERFACE "${PROJECT_BINARY_DIR}/3party/jansson/jansson/include") + if (PLATFORM_WIN) + set_target_properties(jansson PROPERTIES UNITY_BUILD OFF) + endif() # Add gflags library. set(GFLAGS_BUILD_TESTING OFF) diff --git a/3party/protobuf/CMakeLists.txt b/3party/protobuf/CMakeLists.txt index 8507767315a..7f491bd1435 100644 --- a/3party/protobuf/CMakeLists.txt +++ b/3party/protobuf/CMakeLists.txt @@ -37,6 +37,10 @@ if(NOT PLATFORM_WIN) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_PTHREAD) endif () +if(PLATFORM_WIN) + set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD OFF) +endif() + target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Wno-shorten-64-to-32> $<$:-Wno-deprecated-declarations> diff --git a/dev_sandbox/main.cpp b/dev_sandbox/main.cpp index 7d876e2d12c..e9d7644dd41 100644 --- a/dev_sandbox/main.cpp +++ b/dev_sandbox/main.cpp @@ -260,8 +260,10 @@ int main(int argc, char * argv[]) if (!settings::Get(settings::kDeveloperMode, outvalue)) settings::Set(settings::kDeveloperMode, true); +#if !defined(OMIM_OS_WINDOWS) if (!FLAGS_lang.empty()) (void)::setenv("LANGUAGE", FLAGS_lang.c_str(), 1); +#endif FrameworkParams frameworkParams; Framework framework(frameworkParams); diff --git a/libs/coding/string_utf8_multilang.cpp b/libs/coding/string_utf8_multilang.cpp index a72276a2456..7e5eda90d85 100644 --- a/libs/coding/string_utf8_multilang.cpp +++ b/libs/coding/string_utf8_multilang.cpp @@ -99,7 +99,7 @@ constexpr bool IsServiceLang(std::string_view const lang) lang == kLanguages[StringUtf8Multilang::kOldNameCode].m_code; } -StringUtf8Multilang::Languages constexpr allLanguages = [] consteval +StringUtf8Multilang::Languages const allLanguages = [] { StringUtf8Multilang::Languages langs; std::ranges::copy_if(kLanguages, std::back_inserter(langs), [](StringUtf8Multilang::Lang const & lang) @@ -107,7 +107,7 @@ StringUtf8Multilang::Languages constexpr allLanguages = [] consteval return langs; }(); -StringUtf8Multilang::Languages constexpr languagesWithoutService = [] consteval +StringUtf8Multilang::Languages const languagesWithoutService = [] { StringUtf8Multilang::Languages langs; std::ranges::copy_if(allLanguages, std::back_inserter(langs), diff --git a/libs/platform/platform_win.cpp b/libs/platform/platform_win.cpp index 1f152d9bf79..444b200c496 100644 --- a/libs/platform/platform_win.cpp +++ b/libs/platform/platform_win.cpp @@ -1,3 +1,4 @@ +#include "platform/gui_thread.hpp" #include "platform/platform.hpp" #include "platform/socket.hpp" diff --git a/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp b/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp index 6493dcf1e43..7bda7ec77b4 100644 --- a/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp +++ b/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp @@ -167,6 +167,7 @@ void CompileShaders(CompilerData const & compiler, std::string const & additiona TEST_EQUAL(errorLog.isEmpty(), true, ("Defines:", additionalDefines, "\n", errorLog)); } +#if !defined(OMIM_OS_WINDOWS) UNIT_TEST(MobileCompileShaders_Test) { base::DelayedThreadPool workerThread(6 /* threadsCount */); @@ -178,6 +179,7 @@ UNIT_TEST(MobileCompileShaders_Test) workerThread.Shutdown(base::DelayedThreadPool::Exit::ExecPending); } +#endif struct MaliReleaseVersion { @@ -230,6 +232,7 @@ void MaliCompileShaders(MaliCompilerData const & compiler, MaliDriverSet const & // MALI GPUs do not support ENABLE_VTF. Do not test it here. } +#if !defined(OMIM_OS_WINDOWS) UNIT_TEST(MALI_MobileCompileShaders_Test) { #if defined(OMIM_OS_MAC) @@ -472,3 +475,4 @@ UNIT_TEST(MALI_MobileCompileShaders_Test) workerThread.Shutdown(base::DelayedThreadPool::Exit::ExecPending); } +#endif diff --git a/libs/storage/storage_defines.hpp b/libs/storage/storage_defines.hpp index 85d24fcb576..1f456b07dde 100644 --- a/libs/storage/storage_defines.hpp +++ b/libs/storage/storage_defines.hpp @@ -28,7 +28,7 @@ using MwmTopCityGeoIds = std::unordered_map; using MwmTopCountryGeoIds = std::unordered_map>; /// @note Android code relies that kInvalidCountryId is an empty string! -storage::CountryId constexpr kInvalidCountryId; +inline constexpr char kInvalidCountryId[] = ""; inline bool IsCountryIdValid(CountryId const & countryId) { diff --git a/libs/timezone/timezone_tests/conversion_tests.cpp b/libs/timezone/timezone_tests/conversion_tests.cpp index 375420b660e..b928ccb3601 100644 --- a/libs/timezone/timezone_tests/conversion_tests.cpp +++ b/libs/timezone/timezone_tests/conversion_tests.cpp @@ -6,7 +6,7 @@ using namespace om::tz; namespace { -constexpr TimeZone kZeroTz{.generation_year_offset = 0, .base_offset = 64, .dst_delta = 0, .transitions = {}}; +TimeZone const kZeroTz{.generation_year_offset = 0, .base_offset = 64, .dst_delta = 0, .transitions = {}}; time_t CreateTime(int const year, int const month, int const day, int const hour, int const minute, int const second) { @@ -19,7 +19,11 @@ time_t CreateTime(int const year, int const month, int const day, int const hour tm_time.tm_sec = second; tm_time.tm_isdst = -1; +#ifdef OMIM_OS_WINDOWS return timegm(&tm_time); +#else + return _mkgmtime(&tm_time); +#endif } std::string TimeToString(time_t const t) diff --git a/qt/main.cpp b/qt/main.cpp index d0b7eb2a962..3cebb974c26 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -177,8 +177,10 @@ int main(int argc, char * argv[]) { std::unique_ptr screenshotParams; +#if !defined(OMIM_OS_WINDOWS) if (!FLAGS_lang.empty()) (void)::setenv("LANGUAGE", FLAGS_lang.c_str(), 1); +#endif if (!FLAGS_kml_path.empty() || !FLAGS_points.empty() || !FLAGS_rects.empty()) { diff --git a/tools/mwm_viewer/mwm_viewer.cpp b/tools/mwm_viewer/mwm_viewer.cpp index 42f79083d28..dc9eec6acbb 100644 --- a/tools/mwm_viewer/mwm_viewer.cpp +++ b/tools/mwm_viewer/mwm_viewer.cpp @@ -324,7 +324,8 @@ int main(int const argc, char const ** const argv) classificator::Load(); FrozenDataSource dataSource; - dataSource.RegisterMap(platform::LocalCountryFile{mwmPath.parent_path(), platform::CountryFile(mwmPath.stem()), 0}); + dataSource.RegisterMap( + platform::LocalCountryFile{mwmPath.parent_path().string(), platform::CountryFile(mwmPath.stem().string()), 0}); std::vector> mwmInfos; dataSource.GetMwmsInfo(mwmInfos); Processor doProcess(dataSource); diff --git a/tools/openlr/CMakeLists.txt b/tools/openlr/CMakeLists.txt index 34ff58562ce..2167d425861 100644 --- a/tools/openlr/CMakeLists.txt +++ b/tools/openlr/CMakeLists.txt @@ -45,6 +45,10 @@ target_link_libraries(${PROJECT_NAME} pugixml ) +if (PLATFORM_WIN) + set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD OFF) +endif() + omim_add_tool_subdirectory(openlr_match_quality) omim_add_tool_subdirectory(openlr_stat) From 2d5820459b9c3c114a8ba7f9a5b52a2e2367f3f6 Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sat, 13 Dec 2025 18:02:35 +0300 Subject: [PATCH 2/9] Adjust compilation flags for MSVC Use /fp:fast to match other platforms behavior. Set /bigobj to prevent possible linking errors with static libraries. Signed-off-by: Osyotr --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d9128ce6c9..8bf8b1bfcb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,8 @@ endif() # Global compile options for all configurations. if (MSVC) - add_compile_options(/utf-8) + add_compile_options(/utf-8 /bigobj) + add_compile_options(/fp:fast) add_link_options(/INCREMENTAL:NO) else() add_compile_options(-ffast-math $<$:-Wno-psabi>) From 62d1442643ffb51f3a654d60f245b8042faa2dd4 Mon Sep 17 00:00:00 2001 From: Osyotr Date: Tue, 29 Jul 2025 00:42:11 +0300 Subject: [PATCH 3/9] Re-enable AA switch Signed-off-by: Osyotr --- qt/qt_common/map_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp index 27827bc4131..1ff6f6b7be9 100644 --- a/qt/qt_common/map_widget.cpp +++ b/qt/qt_common/map_widget.cpp @@ -32,7 +32,7 @@ static constexpr float kViewportFractionSmoothMove = 0.1; namespace qt::common { -// #define ENABLE_AA_SWITCH +#define ENABLE_AA_SWITCH MapWidget::MapWidget(Framework & framework, bool isScreenshotMode, QWidget * parent) : QOpenGLWidget(parent) From bed8b9be802ff181c9e0a561306d4d869557811d Mon Sep 17 00:00:00 2001 From: Osyotr Date: Tue, 29 Jul 2025 00:42:32 +0300 Subject: [PATCH 4/9] Disable log to file on windows Signed-off-by: Osyotr --- qt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/main.cpp b/qt/main.cpp index 3cebb974c26..7b117e2a376 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -84,7 +84,7 @@ class FinalizeBase } }; -#if defined(OMIM_OS_WINDOWS) //&& defined(PROFILER_COMMON) +#if 0 && defined(OMIM_OS_WINDOWS) //&& defined(PROFILER_COMMON) class InitializeFinalize : public FinalizeBase { FILE * m_errFile; From 5c1b046086fad93671efc04243a05012e6536bcd Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sun, 19 Oct 2025 22:48:39 +0300 Subject: [PATCH 5/9] Use ExternalProject to fetch world_feed_integration_tests_data Signed-off-by: Osyotr --- .../world_feed_integration_tests/CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libs/transit/world_feed/world_feed_integration_tests/CMakeLists.txt b/libs/transit/world_feed/world_feed_integration_tests/CMakeLists.txt index 88984c624f0..562ff4bbb6a 100644 --- a/libs/transit/world_feed/world_feed_integration_tests/CMakeLists.txt +++ b/libs/transit/world_feed/world_feed_integration_tests/CMakeLists.txt @@ -16,9 +16,14 @@ if(NOT TEST_DATA_REPO_URL) endif() set(DESTINATION_FOLDER "${OMIM_DATA_DIR}/test_data/world_feed_integration_tests_data/") -add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND test -d ${DESTINATION_FOLDER} || (git clone ${TEST_DATA_REPO_URL} ${DESTINATION_FOLDER}) - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +include(ExternalProject) +ExternalProject_Add(world_feed_integration_tests_data + GIT_REPOSITORY "${TEST_DATA_REPO_URL}" + GIT_TAG 30ecb0b3fe694a582edfacc2a7425b6f01f9fec6 + SOURCE_DIR "${DESTINATION_FOLDER}" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + UPDATE_DISCONNECTED ON ) +add_dependencies(${PROJECT_NAME} world_feed_integration_tests_data) From 8dbd54b1cf2b67ab338b99bad0f08d622f4a79ff Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sat, 13 Dec 2025 18:15:51 +0300 Subject: [PATCH 6/9] zlib tmp Signed-off-by: Osyotr --- 3party/CMakeLists.txt | 14 ++++++++++++++ CMakeLists.txt | 3 +-- libs/coding/zlib.hpp | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index afa7e0ba8a4..9f7aa6fd4a5 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -60,6 +60,20 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) add_library(utf8cpp INTERFACE) add_library(utf8cpp::utf8cpp ALIAS utf8cpp) target_include_directories(utf8cpp INTERFACE "${OMIM_ROOT}/3party/utfcpp/source") + + set(ZLIB_COMPAT ON) + set(ZLIB_ENABLE_TESTS OFF) + set(ZLIB_ALIASES OFF) + set(SKIP_INSTALL_ALL ON) + include(FetchContent) + FetchContent_Declare( + zlib-ng + GIT_REPOSITORY https://github.com/zlib-ng/zlib-ng.git + GIT_TAG 2.3.2 + ) + FetchContent_MakeAvailable(zlib-ng) + add_library(ZLIB::ZLIB ALIAS zlib-ng) + set_target_properties(zlib-ng PROPERTIES UNITY_BUILD OFF) endif() add_subdirectory(agg) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bf8b1bfcb7..2f58597335a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,10 +188,9 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) find_package(jansson CONFIG REQUIRED) find_package(pugixml REQUIRED) find_package(utf8cpp REQUIRED) + find_package(ZLIB REQUIRED) endif() -find_package(ZLIB REQUIRED) - # Include 3party dependencies. add_subdirectory(3party) diff --git a/libs/coding/zlib.hpp b/libs/coding/zlib.hpp index fec1ed814dc..c00498e498b 100644 --- a/libs/coding/zlib.hpp +++ b/libs/coding/zlib.hpp @@ -7,7 +7,7 @@ #include #include -#include "zlib.h" +#include namespace coding { From 2022a17491b489f1c924a0ed0f00e4b441bf2dec Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sun, 19 Oct 2025 22:18:43 +0300 Subject: [PATCH 7/9] Add Windows action Signed-off-by: Osyotr --- .github/workflows/build-cmake.yaml | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cmake.yaml b/.github/workflows/build-cmake.yaml index 3fc15c22b6e..e3ce377818f 100644 --- a/.github/workflows/build-cmake.yaml +++ b/.github/workflows/build-cmake.yaml @@ -59,6 +59,11 @@ jobs: cc: clang cxx: clang++ developer-dir: /Applications/Xcode_26.2.app/Contents/Developer + + - os: windows-2025-vs2026 + cc: cl.exe + cxx: cl.exe + exclude: - environment: { unity: OFF } cmake-build-type: Release @@ -118,15 +123,37 @@ jobs: brew install ninja qt@6 pip3 install tornado --break-system-packages + - name: Install Qt + if: ${{ runner.os == 'Windows' }} + uses: jurplel/install-qt-action@v4 + - name: Configure repository + if: ${{ runner.os != 'Windows' }} + shell: bash run: ./configure.sh + - uses: ilammy/msvc-dev-cmd@v1 + if: ${{ runner.os == 'Windows' }} + + - name: Bootstrap boost (Windows) + if: ${{ runner.os == 'Windows' }} + shell: cmd + run: .\bootstrap.bat msvc + working-directory: ./3party/boost + + - name: Install boost (Windows) + if: ${{ runner.os == 'Windows' }} + shell: cmd + run: .\b2.exe headers + working-directory: ./3party/boost + - name: Configure ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.workflow }}-${{ matrix.environment.os }}-${{ matrix.environment.cc }}-${{ matrix.environment.unity }}-${{ matrix.cmake-build-type }} - name: Configure cmake + shell: bash env: CC: ${{ matrix.environment.cc }} CXX: ${{ matrix.environment.cxx }} @@ -136,13 +163,12 @@ jobs: run: | cmake . -B ${{ env.BUILD_DIR }} -G Ninja \ -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} \ - -DCMAKE_C_FLAGS=-g1 \ - -DCMAKE_CXX_FLAGS=-g1 \ -DCMAKE_UNITY_BUILD=${UNITY_BUILD} - name: Compile + shell: bash working-directory: ${{ env.BUILD_DIR }} - run: ninja + run: cmake --build . - name: Prepare testing environment (Linux) if: ${{ runner.os == 'Linux' }} From 63f0c6e35b173acecda09f5e0bb99ea853d6e8dd Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sat, 13 Dec 2025 17:50:57 +0300 Subject: [PATCH 8/9] Remove old codepaths for getting language list on Windows There's no need to support Windows XP :) Signed-off-by: Osyotr --- libs/platform/preferred_languages.cpp | 449 +------------------------- 1 file changed, 14 insertions(+), 435 deletions(-) diff --git a/libs/platform/preferred_languages.cpp b/libs/platform/preferred_languages.cpp index aa21ceab175..30f9d37a6ad 100644 --- a/libs/platform/preferred_languages.cpp +++ b/libs/platform/preferred_languages.cpp @@ -18,8 +18,6 @@ #include #elif defined(OMIM_OS_WINDOWS) #include "std/windows.hpp" -// for XP it's not defined -#define MUI_LANGUAGE_NAME 0x8 #elif defined(OMIM_OS_LINUX) #include #elif defined(OMIM_OS_ANDROID) @@ -29,409 +27,6 @@ std::string GetAndroidSystemLanguage(); #error "Define language preferences for your platform" #endif -#ifdef OMIM_OS_WINDOWS -struct MSLocale -{ - uint16_t m_code; - char const * m_name; -}; -/// Used on Windows XP which lacks LCIDToLocaleName function -/// Taken from MSDN: http://msdn.microsoft.com/en-us/library/cc233968(v=PROT.10).aspx -static MSLocale const gLocales[] = { - {0x1, "ar"}, - {0x2, "bg"}, - {0x3, "ca"}, - {0x4, "zh-Hans"}, - {0x5, "cs"}, - {0x6, "da"}, - {0x7, "de"}, - {0x8, "el"}, - {0x9, "en"}, - {0xa, "es"}, - {0xb, "fi"}, - {0xc, "fr"}, - {0xd, "he"}, - {0xe, "hu"}, - {0xf, "is"}, - {0x10, "it"}, - {0x11, "ja"}, - {0x12, "ko"}, - {0x13, "nl"}, - {0x14, "no"}, - {0x15, "pl"}, - {0x16, "pt"}, - {0x17, "rm"}, - {0x18, "ro"}, - {0x19, "ru"}, - {0x1a, "hr"}, - {0x1b, "sk"}, - {0x1c, "sq"}, - {0x1d, "sv"}, - {0x1e, "th"}, - {0x1f, "tr"}, - {0x20, "ur"}, - {0x21, "id"}, - {0x22, "uk"}, - {0x23, "be"}, - {0x24, "sl"}, - {0x25, "et"}, - {0x26, "lv"}, - {0x27, "lt"}, - {0x28, "tg"}, - {0x29, "fa"}, - {0x2a, "vi"}, - {0x2b, "hy"}, - {0x2c, "az"}, - {0x2d, "eu"}, - {0x2e, "hsb"}, - {0x2f, "mk"}, - {0x32, "tn"}, - {0x34, "xh"}, - {0x35, "zu"}, - {0x36, "af"}, - {0x37, "ka"}, - {0x38, "fo"}, - {0x39, "hi"}, - {0x3a, "mt"}, - {0x3b, "se"}, - {0x3c, "ga"}, - {0x3e, "ms"}, - {0x3f, "kk"}, - {0x40, "ky"}, - {0x41, "sw"}, - {0x42, "tk"}, - {0x43, "uz"}, - {0x44, "tt"}, - {0x45, "bn"}, - {0x46, "pa"}, - {0x47, "gu"}, - {0x48, "or"}, - {0x49, "ta"}, - {0x4a, "te"}, - {0x4b, "kn"}, - {0x4c, "ml"}, - {0x4d, "as"}, - {0x4e, "mr"}, - {0x4f, "sa"}, - {0x50, "mn"}, - {0x51, "bo"}, - {0x52, "cy"}, - {0x53, "km"}, - {0x54, "lo"}, - {0x56, "gl"}, - {0x57, "kok"}, - {0x5a, "syr"}, - {0x5b, "si"}, - {0x5d, "iu"}, - {0x5e, "am"}, - {0x5f, "tzm"}, - {0x61, "ne"}, - {0x62, "fy"}, - {0x63, "ps"}, - {0x64, "fil"}, - {0x65, "dv"}, - {0x68, "ha"}, - {0x6a, "yo"}, - {0x6b, "quz"}, - {0x6c, "nso"}, - {0x6d, "ba"}, - {0x6e, "lb"}, - {0x6f, "kl"}, - {0x70, "ig"}, - {0x78, "ii"}, - {0x7a, "arn"}, - {0x7c, "moh"}, - {0x7e, "br"}, - {0x80, "ug"}, - {0x81, "mi"}, - {0x82, "oc"}, - {0x83, "co"}, - {0x84, "gsw"}, - {0x85, "sah"}, - {0x86, "qut"}, - {0x87, "rw"}, - {0x88, "wo"}, - {0x8c, "prs"}, - {0x91, "gd"}, - {0x401, "ar-SA"}, - {0x402, "bg-BG"}, - {0x403, "ca-ES"}, - {0x404, "zh-TW"}, - {0x405, "cs-CZ"}, - {0x406, "da-DK"}, - {0x407, "de-DE"}, - {0x408, "el-GR"}, - {0x409, "en-US"}, - {0x40a, "es-ES_tradnl"}, - {0x40b, "fi-FI"}, - {0x40c, "fr-FR"}, - {0x40d, "he-IL"}, - {0x40e, "hu-HU"}, - {0x40f, "is-IS"}, - {0x410, "it-IT"}, - {0x411, "ja-JP"}, - {0x412, "ko-KR"}, - {0x413, "nl-NL"}, - {0x414, "nb-NO"}, - {0x415, "pl-PL"}, - {0x416, "pt-BR"}, - {0x417, "rm-CH"}, - {0x418, "ro-RO"}, - {0x419, "ru-RU"}, - {0x41a, "hr-HR"}, - {0x41b, "sk-SK"}, - {0x41c, "sq-AL"}, - {0x41d, "sv-SE"}, - {0x41e, "th-TH"}, - {0x41f, "tr-TR"}, - {0x420, "ur-PK"}, - {0x421, "id-ID"}, - {0x422, "uk-UA"}, - {0x423, "be-BY"}, - {0x424, "sl-SI"}, - {0x425, "et-EE"}, - {0x426, "lv-LV"}, - {0x427, "lt-LT"}, - {0x428, "tg-Cyrl-TJ"}, - {0x429, "fa-IR"}, - {0x42a, "vi-VN"}, - {0x42b, "hy-AM"}, - {0x42c, "az-Latn-AZ"}, - {0x42d, "eu-ES"}, - {0x42e, "wen-DE"}, - {0x42f, "mk-MK"}, - {0x430, "st-ZA"}, - {0x431, "ts-ZA"}, - {0x432, "tn-ZA"}, - {0x433, "ven-ZA"}, - {0x434, "xh-ZA"}, - {0x435, "zu-ZA"}, - {0x436, "af-ZA"}, - {0x437, "ka-GE"}, - {0x438, "fo-FO"}, - {0x439, "hi-IN"}, - {0x43a, "mt-MT"}, - {0x43b, "se-NO"}, - {0x43e, "ms-MY"}, - {0x43f, "kk-KZ"}, - {0x440, "ky-KG"}, - {0x441, "sw-KE"}, - {0x442, "tk-TM"}, - {0x443, "uz-Latn-UZ"}, - {0x444, "tt-RU"}, - {0x445, "bn-IN"}, - {0x446, "pa-IN"}, - {0x447, "gu-IN"}, - {0x448, "or-IN"}, - {0x449, "ta-IN"}, - {0x44a, "te-IN"}, - {0x44b, "kn-IN"}, - {0x44c, "ml-IN"}, - {0x44d, "as-IN"}, - {0x44e, "mr-IN"}, - {0x44f, "sa-IN"}, - {0x450, "mn-MN"}, - {0x451, "bo-CN"}, - {0x452, "cy-GB"}, - {0x453, "km-KH"}, - {0x454, "lo-LA"}, - {0x455, "my-MM"}, - {0x456, "gl-ES"}, - {0x457, "kok-IN"}, - {0x458, "mni"}, - {0x459, "sd-IN"}, - {0x45a, "syr-SY"}, - {0x45b, "si-LK"}, - {0x45c, "chr-US"}, - {0x45d, "iu-Cans-CA"}, - {0x45e, "am-ET"}, - {0x45f, "tmz"}, - {0x461, "ne-NP"}, - {0x462, "fy-NL"}, - {0x463, "ps-AF"}, - {0x464, "fil-PH"}, - {0x465, "dv-MV"}, - {0x466, "bin-NG"}, - {0x467, "fuv-NG"}, - {0x468, "ha-Latn-NG"}, - {0x469, "ibb-NG"}, - {0x46a, "yo-NG"}, - {0x46b, "quz-BO"}, - {0x46c, "nso-ZA"}, - {0x46d, "ba-RU"}, - {0x46e, "lb-LU"}, - {0x46f, "kl-GL"}, - {0x470, "ig-NG"}, - {0x471, "kr-NG"}, - {0x472, "gaz-ET"}, - {0x473, "ti-ER"}, - {0x474, "gn-PY"}, - {0x475, "haw-US"}, - {0x477, "so-SO"}, - {0x478, "ii-CN"}, - {0x479, "pap-AN"}, - {0x47a, "arn-CL"}, - {0x47c, "moh-CA"}, - {0x47e, "br-FR"}, - {0x480, "ug-CN"}, - {0x481, "mi-NZ"}, - {0x482, "oc-FR"}, - {0x483, "co-FR"}, - {0x484, "gsw-FR"}, - {0x485, "sah-RU"}, - {0x486, "qut-GT"}, - {0x487, "rw-RW"}, - {0x488, "wo-SN"}, - {0x48c, "prs-AF"}, - {0x48d, "plt-MG"}, - {0x491, "gd-GB"}, - {0x801, "ar-IQ"}, - {0x804, "zh-CN"}, - {0x807, "de-CH"}, - {0x809, "en-GB"}, - {0x80a, "es-MX"}, - {0x80c, "fr-BE"}, - {0x810, "it-CH"}, - {0x813, "nl-BE"}, - {0x814, "nn-NO"}, - {0x816, "pt-PT"}, - {0x818, "ro-MO"}, - {0x819, "ru-MO"}, - {0x81a, "sr-Latn-CS"}, - {0x81d, "sv-FI"}, - {0x820, "ur-IN"}, - {0x82c, "az-Cyrl-AZ"}, - {0x82e, "dsb-DE"}, - {0x83b, "se-SE"}, - {0x83c, "ga-IE"}, - {0x83e, "ms-BN"}, - {0x843, "uz-Cyrl-UZ"}, - {0x845, "bn-BD"}, - {0x846, "pa-PK"}, - {0x850, "mn-Mong-CN"}, - {0x851, "bo-BT"}, - {0x859, "sd-PK"}, - {0x85d, "iu-Latn-CA"}, - {0x85f, "tzm-Latn-DZ"}, - {0x861, "ne-IN"}, - {0x86b, "quz-EC"}, - {0x873, "ti-ET"}, - {0xc01, "ar-EG"}, - {0xc04, "zh-HK"}, - {0xc07, "de-AT"}, - {0xc09, "en-AU"}, - {0xc0a, "es-ES"}, - {0xc0c, "fr-CA"}, - {0xc1a, "sr-Cyrl-CS"}, - {0xc3b, "se-FI"}, - {0xc5f, "tmz-MA"}, - {0xc6b, "quz-PE"}, - {0x1001, "ar-LY"}, - {0x1004, "zh-SG"}, - {0x1007, "de-LU"}, - {0x1009, "en-CA"}, - {0x100a, "es-GT"}, - {0x100c, "fr-CH"}, - {0x101a, "hr-BA"}, - {0x103b, "smj-NO"}, - {0x1401, "ar-DZ"}, - {0x1404, "zh-MO"}, - {0x1407, "de-LI"}, - {0x1409, "en-NZ"}, - {0x140a, "es-CR"}, - {0x140c, "fr-LU"}, - {0x141a, "bs-Latn-BA"}, - {0x143b, "smj-SE"}, - {0x1801, "ar-MA"}, - {0x1809, "en-IE"}, - {0x180a, "es-PA"}, - {0x180c, "fr-MC"}, - {0x181a, "sr-Latn-BA"}, - {0x183b, "sma-NO"}, - {0x1c01, "ar-TN"}, - {0x1c09, "en-ZA"}, - {0x1c0a, "es-DO"}, - {0x1c0c, "fr-WestIndies"}, - {0x1c1a, "sr-Cyrl-BA"}, - {0x1c3b, "sma-SE"}, - {0x2001, "ar-OM"}, - {0x2009, "en-JM"}, - {0x200a, "es-VE"}, - {0x200c, "fr-RE"}, - {0x201a, "bs-Cyrl-BA"}, - {0x203b, "sms-FI"}, - {0x2401, "ar-YE"}, - {0x2409, "en-CB"}, - {0x240a, "es-CO"}, - {0x240c, "fr-CG"}, - {0x241a, "sr-Latn-RS"}, - {0x243b, "smn-FI"}, - {0x2801, "ar-SY"}, - {0x2809, "en-BZ"}, - {0x280a, "es-PE"}, - {0x280c, "fr-SN"}, - {0x281a, "sr-Cyrl-RS"}, - {0x2c01, "ar-JO"}, - {0x2c09, "en-TT"}, - {0x2c0a, "es-AR"}, - {0x2c0c, "fr-CM"}, - {0x2c1a, "sr-Latn-ME"}, - {0x3001, "ar-LB"}, - {0x3009, "en-ZW"}, - {0x300a, "es-EC"}, - {0x300c, "fr-CI"}, - {0x301a, "sr-Cyrl-ME"}, - {0x3401, "ar-KW"}, - {0x3409, "en-PH"}, - {0x340a, "es-CL"}, - {0x340c, "fr-ML"}, - {0x3801, "ar-AE"}, - {0x3809, "en-ID"}, - {0x380a, "es-UY"}, - {0x380c, "fr-MA"}, - {0x3c01, "ar-BH"}, - {0x3c09, "en-HK"}, - {0x3c0a, "es-PY"}, - {0x3c0c, "fr-HT"}, - {0x4001, "ar-QA"}, - {0x4009, "en-IN"}, - {0x400a, "es-BO"}, - {0x4409, "en-MY"}, - {0x440a, "es-SV"}, - {0x4809, "en-SG"}, - {0x480a, "es-HN"}, - {0x4c0a, "es-NI"}, - {0x500a, "es-PR"}, - {0x540a, "es-US"}, - {0x641a, "bs-Cyrl"}, - {0x681a, "bs-Latn"}, - {0x6c1a, "sr-Cyrl"}, - {0x701a, "sr-Latn"}, - {0x703b, "smn"}, - {0x742c, "az-Cyrl"}, - {0x743b, "sms"}, - {0x7804, "zh"}, - {0x7814, "nn"}, - {0x781a, "bs"}, - {0x782c, "az-Latn"}, - {0x783b, "sma"}, - {0x7843, "uz-Cyrl"}, - {0x7850, "mn-Cyrl"}, - {0x785d, "iu-Cans"}, - {0x7c04, "zh-Hant"}, - {0x7c14, "nb"}, - {0x7c1a, "sr"}, - {0x7c28, "tg-Cyrl"}, - {0x7c2e, "dsb"}, - {0x7c3b, "smj"}, - {0x7c43, "uz-Latn"}, - {0x7c50, "mn-Mong"}, - {0x7c5d, "iu-Latn"}, - {0x7c5f, "tzm-Latn"}, - {0x7c68, "ha-Latn"}, -}; -#endif - namespace languages { struct SystemLanguages @@ -474,43 +69,27 @@ struct SystemLanguages #endif #elif defined(OMIM_OS_WINDOWS) - // if we're on Vista or above, take list of preferred languages - typedef BOOL(WINAPI * PGETUSERPREFERREDUILANGUAGES)(DWORD, PULONG, PWCHAR, PULONG); - PGETUSERPREFERREDUILANGUAGES p = reinterpret_cast( - GetProcAddress(GetModuleHandleA("Kernel32.dll"), "GetUserPreferredUILanguages")); - if (p) + // Take list of preferred languages { - // Vista or above, get buffer size first ULONG numLangs; - WCHAR * buf = NULL; ULONG bufSize = 0; - CHECK_EQUAL(TRUE, p(MUI_LANGUAGE_NAME, &numLangs, buf, &bufSize), ()); + CHECK_EQUAL(TRUE, GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLangs, nullptr, &bufSize), ()); CHECK_GREATER(bufSize, 0U, ("GetUserPreferredUILanguages failed")); - buf = new WCHAR[++bufSize]; - p(MUI_LANGUAGE_NAME, &numLangs, buf, &bufSize); - size_t len; - WCHAR * pCurr = buf; - while ((len = wcslen(pCurr))) + std::wstring buf(bufSize, L'?'); + GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLangs, buf.data(), &bufSize); + int32_t len; + wchar_t const * curr = buf.data(); + while ((len = static_cast(wcslen(curr)))) { - char * utf8Buf = new char[len * 2]; - CHECK_NOT_EQUAL(WideCharToMultiByte(CP_UTF8, 0, pCurr, -1, utf8Buf, len * 2, NULL, NULL), 0, ()); - m_langs.push_back(utf8Buf); - delete[] utf8Buf; - pCurr += len + 1; - } - delete[] buf; - } - - if (m_langs.empty()) - { - // used mostly on WinXP - LANGID langId = GetUserDefaultLangID(); - for (size_t i = 0; i < ARRAY_SIZE(gLocales); ++i) - if (gLocales[i].m_code == langId) + int const u8Len = WideCharToMultiByte(CP_UTF8, 0, curr, len, nullptr, 0, nullptr, nullptr); + if (u8Len != 0) { - m_langs.push_back(gLocales[i].m_name); - break; + std::string u8Buf(u8Len, '?'); + if (u8Len == WideCharToMultiByte(CP_UTF8, 0, curr, len, u8Buf.data(), u8Len, nullptr, nullptr)) + m_langs.push_back(std::move(u8Buf)); } + curr += len + 1; + } } #elif defined(OMIM_OS_ANDROID) From 6ed03fb4dc057b751de97a7a2131720372e188e7 Mon Sep 17 00:00:00 2001 From: Osyotr Date: Sat, 13 Dec 2025 17:59:10 +0300 Subject: [PATCH 9/9] Fix some warnings Signed-off-by: Osyotr --- .../descriptions_section_builder_tests.cpp | 2 +- libs/base/CMakeLists.txt | 1 - libs/base/atomic_shared_ptr.hpp | 27 --------- libs/base/base_tests/beam_tests.cpp | 10 ++-- .../coding_tests/fixed_bits_ddvector_test.cpp | 2 +- .../descriptions_tests/descriptions_tests.cpp | 2 +- libs/drape/batcher_helpers.cpp | 2 +- libs/drape/gl_functions.cpp | 4 +- libs/drape/harfbuzz_shaping.cpp | 22 +++---- libs/drape_frontend/drape_measurer.hpp | 2 +- libs/editor/config_loader.cpp | 4 +- libs/editor/config_loader.hpp | 5 +- .../editor_tests/config_loader_test.cpp | 6 +- libs/editor/editor_tests/osm_editor_test.cpp | 58 +++++++++---------- libs/editor/osm_editor.cpp | 52 ++++++++--------- libs/editor/osm_editor.hpp | 5 +- libs/indexer/categories_holder.hpp | 4 +- libs/indexer/drules_include.hpp | 8 +-- libs/indexer/edit_journal.cpp | 2 + libs/map/framework.cpp | 2 +- libs/routing/turns_tts_text_i18n.cpp | 3 +- libs/transit/world_feed/feed_helpers.cpp | 34 +++++------ libs/transit/world_feed/feed_helpers.hpp | 4 +- libs/transit/world_feed/subway_converter.cpp | 4 +- xcode/base/base.xcodeproj/project.pbxproj | 4 -- 25 files changed, 118 insertions(+), 151 deletions(-) delete mode 100644 libs/base/atomic_shared_ptr.hpp diff --git a/generator/generator_tests/descriptions_section_builder_tests.cpp b/generator/generator_tests/descriptions_section_builder_tests.cpp index b726854b19a..7c2499247af 100644 --- a/generator/generator_tests/descriptions_section_builder_tests.cpp +++ b/generator/generator_tests/descriptions_section_builder_tests.cpp @@ -231,7 +231,7 @@ class TestDescriptionSectionBuilder static int SumPageSizes(std::vector const & p) { return std::accumulate(std::begin(p), std::end(p), 0, - [](int acc, PageT const & p) { return acc + p.second.size(); }); + [](int acc, PageT const & p) { return acc + static_cast(p.second.size()); }); } static bool CheckLangs(DescriptionsCollectionBuilderStat::LangStatistics const & stat) diff --git a/libs/base/CMakeLists.txt b/libs/base/CMakeLists.txt index e9bc68411f9..d6042848ddd 100644 --- a/libs/base/CMakeLists.txt +++ b/libs/base/CMakeLists.txt @@ -9,7 +9,6 @@ set(SRC ../std/windows.hpp array_adapters.hpp assert.hpp - atomic_shared_ptr.hpp base.cpp base.hpp beam.hpp diff --git a/libs/base/atomic_shared_ptr.hpp b/libs/base/atomic_shared_ptr.hpp deleted file mode 100644 index 3059f0dc09d..00000000000 --- a/libs/base/atomic_shared_ptr.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "base/macros.hpp" - -#include - -namespace base -{ -// Template which provides methods for concurrently using shared pointers. -template -class AtomicSharedPtr final -{ -public: - using ContentType = T const; - using ValueType = std::shared_ptr; - - AtomicSharedPtr() = default; - - void Set(ValueType value) noexcept { atomic_store(&m_wrapped, value); } - ValueType Get() const noexcept { return atomic_load(&m_wrapped); } - -private: - ValueType m_wrapped = std::make_shared(); - - DISALLOW_COPY_AND_MOVE(AtomicSharedPtr); -}; -} // namespace base diff --git a/libs/base/base_tests/beam_tests.cpp b/libs/base/base_tests/beam_tests.cpp index cd67823f318..0b8e26085b2 100644 --- a/libs/base/base_tests/beam_tests.cpp +++ b/libs/base/base_tests/beam_tests.cpp @@ -20,19 +20,19 @@ using namespace std; template