diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-08 08:30:18 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-08 09:49:41 +0100 |
commit | 13595f6220095d120e13ccb6fbfac1de4c803fe7 (patch) | |
tree | 37f0863365bdd78a5451f85e29b1fbbf74214d28 /onlineupdate | |
parent | c0e438eaceb47932e61b9223e048e4eda3ed7636 (diff) |
Fix --enable-online-update-mar on Windows
The code had apparently rotten a bit,
* a wchar_t vs. char16_t confusion in desktop/source/app/updater.cxx
* code broken by 926e4e469d0285ee72f8da80f00370b4b3120417 "Rename online updater
functions and strcmp relpath" in
onlineupdate/source/update/updater/updater.cxx
* -DUNICODE missing in some places (so that plain Windows functions resolve to
the ...W variant), which had been set centrally in the past IIRC
* silencing some warnings like "C4267: 'initializing': conversion from 'size_t'
to 'int', possible loss of data" (where silencing is the right thing to do for
effectively extern code); no sure why those apparently didn't hit in the past,
maybe it is all warnings that compilers only started to emit in recent years,
or only for recent -std:c++... modes
* silencing some "Conversion from string literal loses const qualifier" errors
with -Zc:strictStrings-; these hit at least with recent VS 2022 Preview and
--with-latest-c++, where -Zc:strictStrings is apparently now on by default
Change-Id: I7fe46f5aa2b42fc9c03f24f7f0236512b4d3b936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160451
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'onlineupdate')
-rw-r--r-- | onlineupdate/Executable_mar.mk | 2 | ||||
-rw-r--r-- | onlineupdate/Executable_test_updater_dialog.mk | 4 | ||||
-rw-r--r-- | onlineupdate/Executable_update_service.mk | 4 | ||||
-rw-r--r-- | onlineupdate/Executable_updater.mk | 10 | ||||
-rw-r--r-- | onlineupdate/StaticLibrary_libmar.mk | 2 | ||||
-rw-r--r-- | onlineupdate/StaticLibrary_libmarverify.mk | 2 | ||||
-rw-r--r-- | onlineupdate/StaticLibrary_updatehelper.mk | 6 | ||||
-rw-r--r-- | onlineupdate/source/update/updater/updater.cxx | 2 |
8 files changed, 31 insertions, 1 deletions
diff --git a/onlineupdate/Executable_mar.mk b/onlineupdate/Executable_mar.mk index 5352f4ac2761..45a182323873 100644 --- a/onlineupdate/Executable_mar.mk +++ b/onlineupdate/Executable_mar.mk @@ -46,4 +46,6 @@ $(eval $(call gb_Executable_add_cobjects,mar,\ onlineupdate/source/libmar/tool/mar \ )) +$(eval $(call gb_Executable_set_warnings_not_errors,mar)) + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/Executable_test_updater_dialog.mk b/onlineupdate/Executable_test_updater_dialog.mk index a2988d0079d6..1f95c21e20d1 100644 --- a/onlineupdate/Executable_test_updater_dialog.mk +++ b/onlineupdate/Executable_test_updater_dialog.mk @@ -60,4 +60,8 @@ $(eval $(call gb_Executable_add_exception_objects,test_updater_dialog,\ onlineupdate/workben/test_dialog \ )) +ifeq ($(OS),WNT) +$(eval $(call gb_Executable_add_defs,test_updater_dialog,-DUNICODE)) +endif + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/Executable_update_service.mk b/onlineupdate/Executable_update_service.mk index edd02f6ecf96..2cbea4a63d71 100644 --- a/onlineupdate/Executable_update_service.mk +++ b/onlineupdate/Executable_update_service.mk @@ -55,4 +55,8 @@ $(eval $(call gb_Executable_add_exception_objects,update_service,\ onlineupdate/source/service/workmonitor \ )) +$(eval $(call gb_Executable_add_cxxflags,update_service,-Zc:strictStrings-)) + +$(eval $(call gb_Executable_add_defs,update_service,-DUNICODE)) + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/Executable_updater.mk b/onlineupdate/Executable_updater.mk index ab15a94e4c60..03df54a83e03 100644 --- a/onlineupdate/Executable_updater.mk +++ b/onlineupdate/Executable_updater.mk @@ -82,4 +82,14 @@ $(eval $(call gb_Executable_add_exception_objects,updater,\ onlineupdate/source/update/updater/win_dirent )\ )) +$(eval $(call gb_Executable_set_warnings_not_errors,updater)) + +ifeq ($(OS),WNT) + +$(eval $(call gb_Executable_add_cxxflags,updater,-Zc:strictStrings-)) + +$(eval $(call gb_Executable_add_defs,updater,-DUNICODE)) + +endif + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/StaticLibrary_libmar.mk b/onlineupdate/StaticLibrary_libmar.mk index 9b82e726a21d..37303d71e3b0 100644 --- a/onlineupdate/StaticLibrary_libmar.mk +++ b/onlineupdate/StaticLibrary_libmar.mk @@ -24,4 +24,6 @@ $(eval $(call gb_StaticLibrary_use_static_libraries,\ libmarverify \ )) +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,libmar)) + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/StaticLibrary_libmarverify.mk b/onlineupdate/StaticLibrary_libmarverify.mk index 41ac492a7b63..62e13b686a33 100644 --- a/onlineupdate/StaticLibrary_libmarverify.mk +++ b/onlineupdate/StaticLibrary_libmarverify.mk @@ -29,4 +29,6 @@ $(eval $(call gb_StaticLibrary_add_cobjects,libmarverify,\ onlineupdate/source/libmar/verify/cryptox \ )) +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,libmarverify)) + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/StaticLibrary_updatehelper.mk b/onlineupdate/StaticLibrary_updatehelper.mk index 1c3654cbc864..f040017ec9e3 100644 --- a/onlineupdate/StaticLibrary_updatehelper.mk +++ b/onlineupdate/StaticLibrary_updatehelper.mk @@ -28,4 +28,10 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,updatehelper,\ onlineupdate/source/update/common/updatelogging \ )) +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,updatehelper)) + +ifeq ($(OS),WNT) +$(eval $(call gb_StaticLibrary_add_cxxflags,updatehelper,-Zc:strictStrings-)) +endif + # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index 467f0b67cd1f..321d43a53936 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -386,7 +386,7 @@ get_relative_offset(const NS_tchar *abs_path) size_t len = NS_tstrlen(prefix); if (NS_tstrlen(abs_path) <= len) return abs_path; - if (0 != strncmp(abs_path, prefix, len)) + if (0 != NS_tstrncmp(abs_path, prefix, len)) return abs_path; return abs_path + len + 1; } |