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. _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice