external/libwps: operation between different enumeration types

> MSWrite.cpp:1424:63: error: invalid arithmetic between different enumeration types ('MSWriteParserInternal::BitmapFileHeaderOffset' and 'MSWriteParserInternal::BitmapInfoHeaderV2Offset')
>  1424 |         unsigned offset = MSWriteParserInternal::BM_FILE_STRUCT_SIZE + MSWriteParserInternal::BM_INFO_V2_STRUCT_SIZE + colors * unsigned(sizeof(MSWriteParserInternal::BitmapPalette));
>       |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

etc. as reported now with --with-latest-c++ (i.e., in C++26 mode) by Clang 18
trunk since
<1cbd52f791>
"[Clang] Implement P2864R2 Remove Deprecated Arithmetic Conversion on
Enumerations (#73105)"

Change-Id: I6307978bc39e0f965144e0df3ac9a28eb817fe10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160552
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann 2023-12-10 22:05:04 +01:00
parent cd13a57256
commit 053c549fdd
2 changed files with 22 additions and 1 deletions

View file

@ -11,13 +11,14 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libwps))
$(eval $(call gb_UnpackedTarball_set_tarball,libwps,$(WPS_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,libwps,1))
$(eval $(call gb_UnpackedTarball_set_patchlevel,libwps,0))
$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libwps))
$(eval $(call gb_UnpackedTarball_add_patches,libwps,\
$(if $(SYSTEM_REVENGE),,external/libwps/rpath.patch.0) \
external/libwps/libtool.patch.0 \
external/libwps/enumarith.patch \
))
ifneq ($(OS),MACOSX)

20
external/libwps/enumarith.patch vendored Normal file
View file

@ -0,0 +1,20 @@
--- src/lib/MSWrite.cpp
+++ src/lib/MSWrite.cpp
@@ -1421,7 +1421,7 @@
break;
}
- unsigned offset = MSWriteParserInternal::BM_FILE_STRUCT_SIZE + MSWriteParserInternal::BM_INFO_V2_STRUCT_SIZE + colors * unsigned(sizeof(MSWriteParserInternal::BitmapPalette));
+ unsigned offset = +MSWriteParserInternal::BM_FILE_STRUCT_SIZE + MSWriteParserInternal::BM_INFO_V2_STRUCT_SIZE + colors * unsigned(sizeof(MSWriteParserInternal::BitmapPalette));
// File header
bmpdata.append('B');
@@ -1513,7 +1513,7 @@
bmpdata.append('M');
MSWriteParserInternal::appendU32(bmpdata, size + MSWriteParserInternal::BM_FILE_STRUCT_SIZE);
MSWriteParserInternal::appendU32(bmpdata, 0);
- MSWriteParserInternal::appendU32(bmpdata, MSWriteParserInternal::BM_FILE_STRUCT_SIZE + MSWriteParserInternal::BM_INFO_V3_STRUCT_SIZE + 4 * colors);
+ MSWriteParserInternal::appendU32(bmpdata, +MSWriteParserInternal::BM_FILE_STRUCT_SIZE + MSWriteParserInternal::BM_INFO_V3_STRUCT_SIZE + 4 * colors);
bmpdata.append(data, size);