Re: [Libreoffice] About Same expression on both sides of '||' in LockEntrySequence.cxx
On Sun, 2012-01-15 at 09:04 -0800, julien2412 wrote: First, I thought about just replacing the above line by this one : if ( !pCtx-hasType || !pCtx-hasScope ) I have no idea, but http://rfc-ref.org/RFC-TEXTS/2518/chapter23.html has... !ELEMENT lockentry (lockscope, locktype) !ELEMENT lockscope (exclusive | shared) !ELEMENT locktype (write) and this is LockEntrySequence_endelement_callback presumably to be called on processing the close tag, so I would expect that at the end of a lockentry tag we should have both a locktype and a lockscope case STATE_LOCKENTRY: - if ( !pCtx-hasType || !pCtx-hasType ) + if ( !pCtx-hasType || !pCtx-hasScope ) return 1; // abort on the basis that presumably if either the type or scope of the lock is missing then its busted assuming (a big ask) I read the dtd correctly. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] About Same expression on both sides of '||' in LockEntrySequence.cxx
At 17:15 16-1-2012, Caol�n McNamara wrote: On Sun, 2012-01-15 at 09:04 -0800, julien2412 wrote: First, I thought about just replacing the above line by this one : if ( !pCtx-hasType || !pCtx-hasScope ) I have no idea, but http://rfc-ref.org/RFC-TEXTS/2518/chapter23.html has... !ELEMENT lockentry (lockscope, locktype) !ELEMENT lockscope (exclusive | shared) !ELEMENT locktype (write) and this is LockEntrySequence_endelement_callback presumably to be called on processing the close tag, so I would expect that at the end of a lockentry tag we should have both a locktype and a lockscope case STATE_LOCKENTRY: - if ( !pCtx-hasType || !pCtx-hasType ) + if ( !pCtx-hasType || !pCtx-hasScope ) return 1; // abort on the basis that presumably if either the type or scope of the lock is missing then its busted assuming (a big ask) I read the dtd correctly. That's a correct reading. A lockentry element must contain both a lockscope element and a locktype element (in that sequence!). Best regards, Christophe (just commenting on the DTD part) C. -- Christophe Strobbe K.U.Leuven - Dept. of Electrical Engineering - SCD Research Group on Document Architectures Kasteelpark Arenberg 10 bus 2442 B-3001 Leuven-Heverlee BELGIUM tel: +32 16 32 85 51 http://www.docarch.be/ Twitter: @RabelaisA11y --- Open source for accessibility: results from the AEGIS project www.aegis-project.eu --- Please don't invite me to Facebook, Quechup or other social networks. You may have agreed to their privacy policy, but I haven't. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] About Same expression on both sides of '||' in LockEntrySequence.cxx
Hello, Cppcheck detects this : core/ucb/source/ucp/webdav/LockEntrySequence.cxx 174 duplicateExpression style Same expression on both sides of '||'. case STATE_LOCKENTRY: if ( !pCtx-hasType || !pCtx-hasType ) -- Here return 1; // abort break; First, I thought about just replacing the above line by this one : if ( !pCtx-hasType || !pCtx-hasScope ) But I wonder if it should be || or Any idea ? Julien. -- View this message in context: http://nabble.documentfoundation.org/About-Same-expression-on-both-sides-of-in-LockEntrySequence-cxx-tp3661021p3661021.html Sent from the Dev mailing list archive at Nabble.com. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] About Same expression on both sides of '||' in LockEntrySequence.cxx
On Sun, Jan 15, 2012 at 09:04:23AM -0800, julien2412 serval2...@yahoo.fr wrote: Cppcheck detects this : core/ucb/source/ucp/webdav/LockEntrySequence.cxx 174 duplicateExpression style Same expression on both sides of '||'. case STATE_LOCKENTRY: if ( !pCtx-hasType || !pCtx-hasType ) -- Here return 1; // abort break; First, I thought about just replacing the above line by this one : if ( !pCtx-hasType || !pCtx-hasScope ) But I wonder if it should be || or Hi Julien, Given that it's the same expression (and it's not a method that could have side-effects), it doesn't matter if it's || or , so I would go ahead with your first thought. Miklos pgpnEQl654ZUM.pgp Description: PGP signature ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] About Same expression on both sides of '||' in LockEntrySequence.cxx
Hi Miklos, Sorry, I badly explained what I meant in the last lines. When I told this But I wonder if it should be || or , I meant i don't know if it should be if ( !pCtx-hasType || !pCtx-hasScope ) or if ( !pCtx-hasType !pCtx-hasScope ) Julien -- View this message in context: http://nabble.documentfoundation.org/About-Same-expression-on-both-sides-of-in-LockEntrySequence-cxx-tp3661021p3661197.html Sent from the Dev mailing list archive at Nabble.com. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice