Cppcheck reports "Same expression on both sides" in writerfilter module

julien2412 serval2412 at yahoo.fr
Sat Apr 7 16:17:59 PDT 2012


Hello,

On master repo, cppcheck reported this :
[writerfilter/source/filter/ImportFilter.cxx:227] ->
[writerfilter/source/filter/ImportFilter.cxx:227]: (style) Same expression
on both sides of '||'

Here are the lines :
    225 sal_Bool WriterFilter_supportsService( const OUString& ServiceName )
throw (uno::RuntimeException)
    226 {
    227    return (ServiceName == SERVICE_NAME1 || ServiceName ==
SERVICE_NAME1 );
    228 }

I would just replace the second "SERVICE_NAME1" by SERVICE_NAME2 and here
why :
I took a look at git history and found this :
1) 22/02/2007, with this commit f6badd4232da41601fa09b86d87a925c48f97e75,
SERVICE_NAME2 has been removed.
We can notice this :
-#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"

2) 25/08/2009, with this commit 2780d8bec4d34ff177a0d6428b1f709c17f5c9c7,
SERVICE_NAME2 reappeared but there has been an error in 
"WriterFilter_supportsService" function cause SERVICE_NAME1 appears twice in
it.
We can notice this :
+#define SERVICE_NAME2 "com.sun.star.document.ExportFilter"

So because of the 2 things noticed, I think there should be both and so just
replace "1" by "2" and have "SERVICE_NAME2" as second operand.

Perhaps I'm wrong or missed something, any idea ?

Julien.

--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-reports-Same-expression-on-both-sides-in-writerfilter-module-tp3893599p3893599.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list