[Libreoffice] Funny piece of code.

Olivier Hallot olivier.hallot at documentfoundation.org
Mon Jan 2 08:01:16 PST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks you guys for the help

the "finesse" was indeed a "thin-esse"

Olivier

Em 02-01-2012 13:51, Petr Mladek escreveu:
> Olivier Hallot píše v Po 02. 01. 2012 v 13:40 -0200:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi
>>
>> I stumbled on this piece of code in
>>
>> registry/tools/regcompare.cxx
>>
>> There must be a finesse in lines 326, 330, and so on that I missed
>> miserably...
>>
>> Any advise welcome, or I will rip off the ternary operator.
>>
>> Thanks
>>
>> Olivier
>>
>> static OString getFieldAccess(RTFieldAccess fieldAccess)
>>     318 {
>>     319     OString ret;
>>     320     if ( (fieldAccess & RT_ACCESS_INVALID) == RT_ACCESS_INVALID )
>>     321     {
>>     322         ret += OString("INVALID");
>>     323     }
>>     324     if ( (fieldAccess & RT_ACCESS_READONLY) == RT_ACCESS_READONLY )
>>     325     {
>>     326         ret += OString(ret.getLength() > 0 ? ",READONLY" :
>> "READONLY");
>>     327     }
>>     328     if ( (fieldAccess & RT_ACCESS_OPTIONAL) == RT_ACCESS_OPTIONAL )
>>     329     {
>>     330         ret += OString(ret.getLength() > 0 ? ",OPTIONAL" :
>> "OPTIONAL");
> 
> IMHO, you missed the comma "," ;-) It is used to delimit the words where
> there are more added. The code generates strings like:
> 
>             "INVALID"            
>             "INVALID,READONLY"     // uses comma ',' before "READONLY"
>             "READONLY"             // uses pure "READONLY"
>             "READONLY,OPTIONAL"
>             
> 
> Best Regards,
> Petr
> 

- -- 
Olivier Hallot
Founder, Board of Directors Member - The Document Foundation
LibreOffice translation leader for Brazilian Portuguese
+55-21-8822-8812
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPAdTMAAoJEJp3R7nH3vLxZ68IAK9+VlAVae76/NqWCcrBzm/2
IJIkdN/mlT4t5dJ1SRO9doPpcgZ2iEt+9sd/DDer7Z9E4b7Eoj7vI1ZpKThH6aND
7K15Hd6fw0xhUJDMdgnn+UYy87T2h9CxZbnn6EVbyImWkJy8R8fRGLm7+s7pLqBg
PJzFuXgykYJ2lcTW8L6rKCZQfvDuBRa07NKkV5gMVjK9sCmYPInduuuOs8XL4qBk
bDE7P5Vyiv6FK0w+vZxy54MjbpRHdfsTrvOsIIQn4IFULNmkBeIqxWOv9s2bGO9U
uDO9lZjZQNfFvHUuKIrmGcZfnddQXtCxrdmXJ8uNuoV6OAtJRpkBcoTituIqT78=
=3c+u
-----END PGP SIGNATURE-----


More information about the LibreOffice mailing list