Apache OpenOffice (AOO) Bugzilla – Issue 96059
transex3: dodgy use of && and ||
Last modified: 2013-08-07 15:02:13 UTC
in transex3/source/export2.cxx we have... if( i+2 < rString.Len() && rString.GetChar( i+1 ) == 'b' || rString.GetChar( i+1 ) == 'B' && rString.GetChar( +2 ) == '>' ) i.e. if (a && b || c && d) rules of precedence means this is equivalent to if ( (a && b) || (c && d) ) i.e. if( (i+2 < rString.Len() && rString.GetChar( i+1 ) == 'b') || (rString.GetChar( i+1 ) == 'B' && rString.GetChar( +2 ) == '>') ) which really doesn't look like what this code probably wants to do. Attached is a patch to do the more likely if( i+2 < rString.Len() && (rString.GetChar( i+1 ) == 'b' || (rString.GetChar( i+1 ) == 'B') && rString.GetChar( +2 ) == '>') ) including the same type of thing later on
Created attachment 57843 [details] what we probably want to do
There is another issue that I've found highly suspicious: the rString.GetChar( +2 ) == '>' thing. Shouldn't it be rString.GetChar( i+2 ) == '>' instead? I've 'reused' caolan's patch to fix this issue too.
Created attachment 57863 [details] fix of the fix :)
Ivo's playground :-)
hahahaha nice one! This is used in the readme ... I guess <b> is never ever used in the translation as the layout is done in the xml code
I'll take this, its low-hanging and blocks warnings-free on new compilers
done in cmcfixes55
Can you code-review these changes in cmcfixes55 and set each to verified if correct
Verified in CWS cmcfixes55.
closing, is in m44