Apache OpenOffice (AOO) Bugzilla – Issue 80084
STLport51: map operator[] issue
Last modified: 2013-02-24 21:22:40 UTC
STLport5 support, split bugreport. Since STLport 5.1 the map operator[] does not accept enum elements to get the map element. The workaround used is to cast the enum element to int. @sb: CC'ed you because you know about STL, don't you. Any ideas about this?
Created attachment 47119 [details] map operator[] workaround
As this is mostly debug code and it is some kind of duplicate code, I think I'll write a macro for this that does the cast and replaces the usage places. Only the places where they operator[] is used outisde an OSL_ASSERT should get the explicit cast "inline". And "int" is not the correct type to cast to. The correct type is const key_type, which in this case would lead to a sal_Int32 (which is int on 32bit platforms, but not on others). Taking over.
Just noticed, that this is not mainly the debug code, it is also the following line, of course. Changing the typedef to map< enum, Any > would be another idea, if there was a unique type "enum". So map< int, Any > would probably a solution, as it is at least guaranteed that int is large enough for all enum values. Have you tried to fix the problem by changing the typedef? See source/inc/PropertyHelper.hxx typedef tPropertyValueMap.
I tried to change the typedef to 'map< int, Any >', though STLport does not see an enum element as integer.
I am thinking about a helper function that sets the default values, so instead of the OSL_ASSERT and the operator[] + makeAny at every place I will provide a simple (template?) method in PropertyHelper to set and check. ->geki: BTW., is this just a test if we could switch to a newer STLport version, or is it close before a switch and we need this in a timely manner?
No need to rush. ;) You may check issue 63770. There is not even a CWS for system STLport5 support. Though, Rene is interested in getting this in somewhen.
Created attachment 47145 [details] Proposed fix for the problem that also avoids duplicate code
The attached patch should also fix the problem. It also cleans those many similar calls up a bit, and if changes are necessary now, there should only be one place left to fix. Note, that the patch is based on CWS chart07, which should be similar to SRC680.m223. A patch based on earlier versions doesn't make too much sense, as in chart07 there quite a lot of changes in chart2.
operator[] should no longer be called with enums for map< int, ... >.
In which cws is this fix?
Sorry, it's in chart11 ( http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=SRC680%2Fchart11 )
fails like this then: g++ -Wreturn-type -fmessage-length=0 -c -O2 -fno-strict-aliasing -Wuninitialized -I. -I../../../unxlngx6.pro/inc/chmodelmain -I../inc -I../../../source/inc -I../../../inc/pch -I../../../inc -I../../../unx/inc -I../../../unxlngx6.pro/inc -I. -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solver/680/unxlngx6.pro/inc/stl -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solver/680/unxlngx6.pro/inc/external -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solver/680/unxlngx6.pro/inc -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solenv/unxlngx6/inc -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solenv/inc -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/res -I/usr/stlport -I/usr/include/stlport -I/usr/include/stlport -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solenv/inc/Xp31 -INO_JAVA_HOME/include -INO_JAVA_HOME/include/linux -INO_JAVA_HOME/include/native_threads/include -Idefault_x_includes -I/mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/solver/680/unxlngx6.pro/inc/offuh -I. -I../../../res -I. -pipe -O2 -mtune=nocona -march=nocona -pipe -fomit-frame-pointer -fvisibility-inlines-hidden -w -Wno-ctor-dtor-privacy -fno-use-cxa-atexit -fvisibility-inlines-hidden -fpic -DLINUX -DUNX -DVCL -DGCC -DC341 -DX86_64 -DCVER=C341 -DNPTL -DGLIBC=2 -DX86_64 -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=500 -DHAVE_GCC_VISIBILITY_FEATURE -D__DMAKE -DUNIX -DCPPU_ENV=gcc3 -DGXX_INCLUDE_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DGSTREAMER -DCUI -DSRC680=SRC680 -DSHAREDLIB -D_DLL_ -fexceptions -fno-enforce-eh-specs -DEXCEPTIONS_ON -o ../../../unxlngx6.pro/slo/DataSeries.o /mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/chart2/source/model/main/DataSeries.cxx /mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/chart2/source/model/main/DataSeries.cxx: In member function »virtual com::sun::star::uno::Any chart::DataSeries::GetDefaultValue(sal_Int32) const«: /mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/chart2/source/model/main/DataSeries.cxx:257: Fehler: no match für »operator[]« in »aStaticDefaults[PROP_CHAR_CHAR_HEIGHT]« /mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/chart2/source/model/main/DataSeries.cxx:259: Fehler: no match für »operator[]« in »aStaticDefaults[PROP_CHAR_ASIAN_CHAR_HEIGHT]« /mnt/data/tmp/portage/app-office/openoffice-680_pre224/work/ooo-build/build/src680-m224/chart2/source/model/main/DataSeries.cxx:261: Fehler: no match für »operator[]« in »aStaticDefaults[PROP_CHAR_COMPLEX_CHAR_HEIGHT]«
Created attachment 47288 [details] fix missing piece
Sorry, that slipped through my fingers. I am checking if I find more places like that one. Fixed in source/model/main/DataSeries.cxx (rev. 1.7.2.1)
Should have been the only place missing. -> geki please verify.
built and diagram wizard showed no anomalies. verified.
verified fixed in SRC680_m229; closing