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


Le 17/11/2010 17:08, Caolán McNamara a écrit :

 On Fri, 2010-11-12 at 12:44 +0100, Julien wrote:

 Hello,

 I'm currently running the last version of cppcheck (i updated with git
 this morning) and i get this error :
 I don't understand where's the pb with snprintf, pString has a size of
 1024 and snprintf takes a size of 1024.

 Is this a false positive to give to the cppcheck guys ?

 Well I think so. if you replace nBezString in the sprintf line with a
 raw 1024 does it complain ?

 C.


After several tests, i noticed for these lines in
libs-gui/vcl/unx/source/printergfx/common_gfx.cxx (from line 530):
PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath,
const BYTE* pFlgAry)
{
    const sal_uInt32 nBezString = 1024;
    sal_Char pString[nBezString];

    if ( nPoints>  1&&  maLineColor.Is()&&  pPath )
    {
        PSSetColor (maLineColor);
        PSSetColor ();
        PSSetLineWidth ();

        snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(),
pPath[0].Y());

There's no more cppcheck errors if if i change the line :
const sal_uInt32 nBezString = 1024;

into this :
sal_uInt32 nBezString = 1024;

Before i create a tracker for cppcheck guy, i'd like to know what you
think about it ?

Julien.


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.