Bug? in mapscript/php

Jos é Luis Campanello jcampanello at FIBERTEL.COM.AR
Mon Dec 19 11:14:26 EST 2005


Hi all!

The compilation of mapscript/php generates the following warning:

php_mapscript.c: In function `php3_ms_img_saveImage':
php_mapscript.c:5997: warning: `tmp' might be used uninitialized in this function

It seems that it is realy a bug rather than a warning, as the code goes something like:

    {           /* no filename - stdout */
        int size=0;
        int   b;
        FILE *tmp;             // ************* HERE SHOULD BE FILE *tmp = NULL;
    .......
    .......
    .......
    .......
            if (pImagepath)
            {
                nBufSize = (strlen(pImagepath)) + strlen(PHPMS_G(tmpId)) + 30;
                pBuf = (char*)emalloc(nBufSize);
                nTmpCount = ++(PHPMS_G(tmpCount));
                sprintf(pBuf, "%s%s%d.svg",
                        pImagepath, PHPMS_G(tmpId), nTmpCount);
                tmp = fopen(pBuf, "w");
            }
            //tmp = tmpfile();
            if (tmp == NULL)   // ************ HERE tmp MAY NOT BE INITIALIZED (line 6035)
            {
                 _phpms_report_mapserver_error(E_WARNING);
                php3_error(E_ERROR, "Unable to open temporary file for SVG output.");
                retVal = -1;
            }

Greetings,

           Jose Luis



More information about the mapserver-dev mailing list