Strange error

Michael Thaler michael.thaler at ph.tum.de
Tue Jun 28 22:38:17 CEST 2005


Hello,

I get the following error and don't understand it. The relevant piece of code 
is

if(yscale < 1.0)
        {
                QUANTUM **tmpRowsMem = new QUANTUM*[ (int)(fwidth / yscale * 2 
+ 1) ];
                for(int i = 0; i < (int)(fwidth / yscale * 2 + 1); i++)
                {
                        tmpRowsMem[i] = new QUANTUM[ width * m_pixelSize ];
                        Q_CHECK_PTR(tmpRowsMem[i]);
                }
        } 
        else 
        {
                QUANTUM **tmpRowsMem = new QUANTUM*[ (int)(fwidth * 2 + 1) ];
                for(int i = 0; i < (int)(fwidth * 2 + 1); i++)
                {
                        tmpRowsMem[i] = new QUANTUM[ width * m_pixelSize ];
                        Q_CHECK_PTR(tmpRowsMem[i]);
                }
        }

,,,

tmpRows[ contribY.p[srcpos].m_pixel ] = tmpRowsMem[ srcpos ];

Now I get the error:

kis_scale_visitor.cc: In member function `void KisScaleVisitor::scale(double,
   double, KisProgressDisplayInterface*, enumFilterType)':
kis_scale_visitor.cc:224: error: `tmpRowsMem' undeclared (first use this
   function)
kis_scale_visitor.cc:224: error: (Each undeclared identifier is reported only
   once for each function it appears in.)
make[2]: *** [kis_scale_visitor.lo] Fehler 1
make[2]: Leaving directory `/usr/local/src/kde/koffice/krita/core'
make[1]: *** [install-recursive] Fehler 1
make[1]: Leaving directory `/usr/local/src/kde/koffice/krita/core'
make: *** [install-recursive] Fehler 1

When I move 

 tmpRowsMem[i] = new QUANTUM[ width * m_pixelSize ];

outside of the if-statement, it works fine. Does anybody understand this? 
Maybe I am too tired, but the else statement should ensure that tmpRowsMem is 
always declared, shouldn't it? So why does it only work when I move the 
declaration of  tmpRowsMem outside of the if statement?

Greetings,
Michael


More information about the kimageshop mailing list