Re: [Libreoffice] Cppcheck Same expression on both sides of ''
Hi Julien, On Mon, 2011-05-16 at 19:08 +0200, Julien Nabet wrote: Here a line I get in cppcheck (updated today) : [source/core/layout/flycnt.cxx:1194] - [source/core/layout/flycnt.cxx:1194]: (style) Same expression on both sides of ''. What fun :-) I checked the file git history, it's there since the beginning. while ( pDownFrm ( ( nDown.nMain != LONG_MAX nDownLst nDownLst So - this is the guy. sal_Bool operator( const SwDistance rTwo ) { return nMain rTwo.nMain || ( So - we end up with: that equating to: nDownLst.nSub nDownLst.nSub nDownLst.nSub nDownLst.nSub Which seems like it is always false ;-) so lets just axe that comparison if indeed we have this code in the first checkin (in 2000) ;-) Thanks ! Michael. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] Cppcheck Same expression on both sides of ''
Le 17/05/2011 15:04, Michael Meeks a écrit : ... nDownLst nDownLst So - this is the guy. sal_Bool operator( const SwDistance rTwo ) { return nMain rTwo.nMain || ( So - we end up with: that equating to: nDownLst.nSub nDownLst.nSub nDownLst.nSub nDownLst.nSub Which seems like it is always false ;-) so lets just axe that comparison if indeed we have this code in the first checkin (in 2000) ;-) It's commited and pushed on master. Hope it won't create a new bug ! :-) Perhaps it could be useful to have some writer expert eyes on it. Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] Cppcheck Same expression on both sides of ''
Hello, Here a line I get in cppcheck (updated today) : [source/core/layout/flycnt.cxx:1194] - [source/core/layout/flycnt.cxx:1194]: (style) Same expression on both sides of ''. I checked the file git history, it's there since the beginning. while ( pDownFrm ( ( nDown.nMain != LONG_MAX nDownLst nDownLst pDownFrm-IsInTab()) || bBody != pDownFrm-IsInDocBody() ) ) I saw there was an overload : sal_Bool operator( const SwDistance rTwo ) { return nMain rTwo.nMain || ( nMain == rTwo.nMain nSub rTwo.nSub nSub rTwo.nSub ); } But then ? Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] cppcheck : Same expression on both sides of '!='
Hello all, Joop Kiefte wrote: Maybe worth it to look those places up in the version control history... I've annotated this file and found the added version since Sep 2010. Let's take a look from this link: http://opengrok.libreoffice.org/diff/calc/sc/source/core/tool/rangeutl.cxx?r2=%2Fcalc%2Fsc%2Fsource%2Fcore%2Ftool%2Frangeutl.cxx%40188130067b80960fd509078f2e23fc1636e694abr1=%2Fcalc%2Fsc%2Fsource%2Fcore%2Ftool%2Frangeutl.cxx%40f789f423c79cb68fdf253cbc0291139436e80ec8 Best regards, -- Korrawit Pruegsanusak ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] cppcheck : Same expression on both sides of '!='
On Fri, 2011-05-13 at 23:54 +0700, Korrawit Pruegsanusak wrote: Hello all, Joop Kiefte wrote: Maybe worth it to look those places up in the version control history... I've annotated this file and found the added version since Sep 2010. Let's take a look from this link: http://opengrok.libreoffice.org/diff/calc/sc/source/core/tool/rangeutl.cxx?r2=%2Fcalc%2Fsc%2Fsource%2Fcore%2Ftool%2Frangeutl.cxx%40188130067b80960fd509078f2e23fc1636e694abr1=%2Fcalc%2Fsc%2Fsource%2Fcore%2Ftool%2Frangeutl.cxx%40f789f423c79cb68fdf253cbc0291139436e80ec8 The actual change that matters dates back older than that commit (back in the go-oo times which means you need to dig up the history of the actual patch file itself in the 'build' repository). Anyway, in the latest master I've already made changes to make the code the way it should be. Kohei -- Kohei Yoshida, LibreOffice hacker, Calc kyosh...@novell.com ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] cppcheck : Same expression on both sides of '!='
Le 07/05/2011 16:01, Julien Nabet a écrit : Hello, Here are 2 examples of Same expression on both sides of '!=' I found : [sc/source/core/tool/rangeutl.cxx:507] - [sc/source/core/tool/rangeutl.cxx:507]: (style) Same expression on both sides of '!=' [sc/source/core/tool/rangeutl.cxx:534] - [sc/source/core/tool/rangeutl.cxx:534]: (style) Same expression on both sides of '!=' Is it a special C++ thing (like overloading operator) or is there a problem here ? Hello, Here are the context for both of the cppcheck warnings : 497 if( nOffset = 0 ) 498 { 499 sal_Int32 nIndex = IndexOf( sToken, ':', 0, cQuote ); 500 String aUIString(sToken); 501 502 if( nIndex 0 ) 503 { 504 if ( aUIString.GetChar(0) == (sal_Unicode) '.' ) 505 aUIString.Erase( 0, 1 ); 506 bResult = ((rRange.aStart.Parse( aUIString, const_castScDocument* (pDocument), eConv) SCA_VALID) == SCA_VALID); 507 if (!bResult eConv != eConv) 508 bResult = ((rRange.aStart.Parse( 509 aUIString, const_castScDocument*(pDocument), eConv) SCA_VALID) == SCA_VALID); 510 rRange.aEnd = rRange.aStart; 511 } 512 else 513 { 514 if ( aUIString.GetChar(0) == (sal_Unicode) '.' ) 515 { 516 aUIString.Erase( 0, 1 ); 517 --nIndex; 518 } 519 520 if ( nIndex aUIString.Len() - 1 521 aUIString.GetChar((xub_StrLen)nIndex + 1) == (sal_Unicode) '.' ) 522 aUIString.Erase( (xub_StrLen)nIndex + 1, 1 ); 523 524 bResult = ((rRange.Parse(aUIString, const_castScDocument* (pDocument), eConv) SCA_VALID) == SCA_VALID); 525 526 // #i77703# chart ranges in the file format contain both sheet names, even for an external reference sheet. 527 // This isn't parsed by ScRange, so try to parse the two Addresses then. 528 if (!bResult) 529 { 530 bResult = ((rRange.aStart.Parse( aUIString.Copy(0, (xub_StrLen)nIndex), const_castScDocument*(pDocument), 531 eConv) SCA_VALID) == SCA_VALID) 532 ((rRange.aEnd.Parse( aUIString.Copy((xub_StrLen)nIndex+1), const_castScDocument*(pDocument), 533 eConv) SCA_VALID) == SCA_VALID); 534 if (!bResult eConv != eConv) 535 { 536 bResult = ((rRange.aStart.Parse( aUIString.Copy(0, (xub_StrLen)nIndex), const_castScDocument*(pDocument), Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] cppcheck : Same expression on both sides of '!='
Hello, Here are 2 examples of Same expression on both sides of '!=' I found : [sc/source/core/tool/rangeutl.cxx:507] - [sc/source/core/tool/rangeutl.cxx:507]: (style) Same expression on both sides of '!=' [sc/source/core/tool/rangeutl.cxx:534] - [sc/source/core/tool/rangeutl.cxx:534]: (style) Same expression on both sides of '!=' Is it a special C++ thing (like overloading operator) or is there a problem here ? Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] cppcheck : Same expression on both sides of '!='
Well it does look weird, but its the same object getting compared on both sides, so i think theres a problem there, but better wait for someone with more experience in the code say something about it. On Sat, May 7, 2011 at 9:31 AM, Julien Nabet serval2...@yahoo.fr wrote: Hello, Here are 2 examples of Same expression on both sides of '!=' I found : [sc/source/core/tool/rangeutl.cxx:507] - [sc/source/core/tool/rangeutl.cxx:507]: (style) Same expression on both sides of '!=' [sc/source/core/tool/rangeutl.cxx:534] - [sc/source/core/tool/rangeutl.cxx:534]: (style) Same expression on both sides of '!=' Is it a special C++ thing (like overloading operator) or is there a problem here ? Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] cppcheck : Same expression on both sides of '!='
Maybe worth it to look those places up in the version control history... 2011/5/7 Rafael Dominguez venccsra...@gmail.com: Well it does look weird, but its the same object getting compared on both sides, so i think theres a problem there, but better wait for someone with more experience in the code say something about it. On Sat, May 7, 2011 at 9:31 AM, Julien Nabet serval2...@yahoo.fr wrote: Hello, Here are 2 examples of Same expression on both sides of '!=' I found : [sc/source/core/tool/rangeutl.cxx:507] - [sc/source/core/tool/rangeutl.cxx:507]: (style) Same expression on both sides of '!=' [sc/source/core/tool/rangeutl.cxx:534] - [sc/source/core/tool/rangeutl.cxx:534]: (style) Same expression on both sides of '!=' Is it a special C++ thing (like overloading operator) or is there a problem here ? Julien. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice