Browse Source

fixed dynamic array allocation

Johannes R 12 years ago
parent
commit
0564acca3c
1 changed files with 6 additions and 3 deletions
  1. 6 3
      core/image/ColorImageT.tcc

+ 6 - 3
core/image/ColorImageT.tcc

@@ -22,8 +22,9 @@ ColorImageT<P>& ColorImageT<P>::operator=(const ColorT<P> &color)
   ippiSet_C3R(color.color(), this->getPixelPointer(), this->getStepsize(),
                 ippiSize);
 #else
-  Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
-  P *row[this->height()];
+  //Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
+  P* pos=reinterpret_cast<P*>(this->getPixelPointer());
+  P **row = new P*[this->height()];
     for(int y=0;y<this->height(); ++y) {
     row[y]=reinterpret_cast<P*>(pos);
     pos+=this->getStepsize();
@@ -37,6 +38,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const ColorT<P> &color)
         }
         }
   }
+	delete [] p;
 #endif
     return *this;
 }
@@ -50,7 +52,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const P c[3])
               ippiSize);
 #else
   Ipp8u* pos=reinterpret_cast<Ipp8u*>(this->getPixelPointer());
-  P *row[this->height()];
+  P *row = new P[this->height()];
   for(int y=0;y<this->height(); ++y) {
     row[y]=reinterpret_cast<P*>(pos);
     pos+=this->getStepsize();
@@ -64,6 +66,7 @@ ColorImageT<P>& ColorImageT<P>::operator=(const P c[3])
       }
     }
   }
+  delete [] p;
 #endif
   return *this;
 }