Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Noel Grandin-2 wrote
...
Are you sure we can remove "pConv = DDE_FREECHANNEL;"? the test about if
equal or different from DDE_FREECHANNEL seems
used in the code.

Indeed cppcheck returned this:
[basic/source/runtime/ddectrl.cxx:136]: (style) Variable 'pConv' is
assigned a value that is never used.
but it seems a false positive since pConv is a pointer on a specific
element of aConvList

pConv is a local variable, so the code that was removed was a dead
assignment.

However, now that you mention it, it is possible that the method in
question should actually look like:

     123 SbError SbiDdeControl::Terminate( size_t nChannel )
     124 {
     125     if (!nChannel || nChannel > aConvList.size())
     126     {
     127         return SbERR_DDE_NO_CHANNEL;
     128     }
     129     DdeConnection* pConv = aConvList[nChannel-1];
     130
     131     if( pConv == DDE_FREECHANNEL )
     132     {
     133         return SbERR_DDE_NO_CHANNEL;
     134     }
     135     delete pConv;
     136     aConvList[nChannel-1] = DDE_FREECHANNEL;  // <<<<<<<<<<<< fix
     137
     138     return 0L;
     139 }
...

You're right! Since it's a local var, the assignment will be useless. Your
change must be the right fix.
I really should  think twice before posting the morning... :-)

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/Re-About-last-cppcheck-fixes-tp4140364p4140382.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.