Issue 80084 - STLport51: map operator[] issue
Summary: STLport51: map operator[] issue
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: chart (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: bjoern.milcke
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks: 63770
  Show dependency tree
 
Reported: 2007-07-26 17:59 UTC by geki
Modified: 2013-02-24 21:22 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
map operator[] workaround (71.05 KB, text/plain)
2007-07-26 18:00 UTC, geki
no flags Details
Proposed fix for the problem that also avoids duplicate code (95.97 KB, patch)
2007-07-27 13:45 UTC, bjoern.milcke
no flags Details | Diff
fix missing piece (1.21 KB, text/plain)
2007-08-03 10:34 UTC, geki
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description geki 2007-07-26 17:59:38 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?
Comment 1 geki 2007-07-26 18:00:35 UTC
Created attachment 47119 [details]
map operator[] workaround
Comment 2 bjoern.milcke 2007-07-27 10:10:03 UTC
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.
Comment 3 bjoern.milcke 2007-07-27 10:20:52 UTC
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.
Comment 4 geki 2007-07-27 10:34:25 UTC
I tried to change the typedef to 'map< int, Any >', though STLport does not see
an enum element as integer.
Comment 5 bjoern.milcke 2007-07-27 10:56:00 UTC
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?
Comment 6 geki 2007-07-27 11:07:35 UTC
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.
Comment 7 bjoern.milcke 2007-07-27 13:45:37 UTC
Created attachment 47145 [details]
Proposed fix for the problem that also avoids duplicate code
Comment 8 bjoern.milcke 2007-07-27 13:50:10 UTC
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.
Comment 9 bjoern.milcke 2007-07-31 15:54:03 UTC
operator[] should no longer be called with enums for map< int, ... >.
Comment 10 geki 2007-08-02 17:19:08 UTC
In which cws is this fix?
Comment 11 bjoern.milcke 2007-08-02 17:30:26 UTC
Sorry, it's in chart11 (
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=SRC680%2Fchart11 )
Comment 12 geki 2007-08-03 10:17:29 UTC
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]«
Comment 13 geki 2007-08-03 10:34:06 UTC
Created attachment 47288 [details]
fix missing piece
Comment 14 bjoern.milcke 2007-08-03 12:46:51 UTC
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)
Comment 15 bjoern.milcke 2007-08-03 12:49:29 UTC
Should have been the only place missing.
-> geki please verify.
Comment 16 geki 2007-08-03 14:06:17 UTC
built and diagram wizard showed no anomalies. verified.
Comment 17 p9w.vu.31122010 2007-09-21 16:40:13 UTC
verified fixed in SRC680_m229; closing