[Libreoffice] Fwd: Funny piece of code.

Olivier Hallot olivier.hallot at documentfoundation.org
Mon Jan 2 07:45:19 PST 2012


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

never mind...

a (almos unseen) comma makes the difference...

Sorry to bother you

Olivier

- -------- Mensagem original --------
Assunto: Funny piece of code.
Data: Mon, 02 Jan 2012 13:40:33 -0200
De: Olivier Hallot <olivier.hallot at documentfoundation.org>
Responder a: olivier.hallot at documentfoundation.org
Empresa: The Document Foundation
Para: LO-dev <libreoffice at lists.freedesktop.org>

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");

(snip)



- -- 
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/

iQEcBAEBAgAGBQJPAdEPAAoJEJp3R7nH3vLx/WsH/3GeeQ8TdO8qXNBZ70gU/jAP
Sk0/Gkoj5MPKkfK+BTv/PEEwEFKUmu0eLYwR4DVGJEqxGi94IfI/0BAMDyH9Y9Ce
hcCBJIWi+KhWocjSYk2tCgYrjSCdOcJQtQH/wB8D+hYUJpyJ93X9mMRgJFnMTUpe
iZ6fCzuuLzJ7tpNKZ769q7ROrTbm7VdSEXx0Sostsx0yt2AsrRppfO5LoqSxPwuq
lkkIiUvKQkAlqwRukM3gNtbL7IxZEIWMn0o1umRnfAXEX+W9VmuLLuVvIanK4KuU
PrtE4j3nNYARThkG8ticuWpEUIMLKfW3m8BK6/yHw7wx+ogT9B7Adx8qPN/7Ujo=
=55k1
-----END PGP SIGNATURE-----


More information about the LibreOffice mailing list