Cppcheck: false positive in pptx-text.cxx ?

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Jan 20 10:55:17 PST 2013


Hey Julien,

2013/1/20 julien2412 <serval2412 at yahoo.fr>:
> Hello,
>
> Cppcheck reported this:
> sd/source/filter/eppt/pptx-text.cxx
> 1235    copyCtorPointerCopying  style   Value of pointer 'mpImplTextObj', which
> points to allocated memory, is copied in copy constructor instead of
> allocating new memory.
>
>    1233 TextObj::TextObj( const TextObj& rTextObj )
>    1234 {
>    1235     mpImplTextObj =
> const_cast<TextObj&>(rTextObj).mpImplTextObj;
>    1236     mpImplTextObj->mnRefCount++;
>    1237 }
>
> I must recognize I don't know what to think about this since I know too
> little about C++.
> Something is wrong here or just a false positive?
>

While the comment is correct it is not really an error in this case.
Someone implemented here manualy ref counting. If you want to remove
the warning you can replace the raw pointer + the ref counting
variable with a  boost::shared_ptr.

Regards,
Markus


More information about the LibreOffice mailing list