SOURCES: nurbs++-gcc4.patch (NEW) - C++ fixes needed by gcc 4
qboosh
qboosh at pld-linux.org
Sat Apr 15 20:20:52 CEST 2006
Author: qboosh Date: Sat Apr 15 18:20:52 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- C++ fixes needed by gcc 4
---- Files affected:
SOURCES:
nurbs++-gcc4.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/nurbs++-gcc4.patch
diff -u /dev/null SOURCES/nurbs++-gcc4.patch:1.1
--- /dev/null Sat Apr 15 20:20:52 2006
+++ SOURCES/nurbs++-gcc4.patch Sat Apr 15 20:20:47 2006
@@ -0,0 +1,2744 @@
+--- nurbs++-3.0.11/matrix/matrix_uchar.cpp.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/matrix_uchar.cpp 2006-04-14 22:20:06.938397250 +0200
+@@ -27,6 +27,7 @@
+
+ namespace PLib {
+
++ template<>
+ Matrix<unsigned char>&
+ Matrix<unsigned char>::operator*=(double a)
+ {
+@@ -40,6 +41,7 @@
+ return *this ;
+ }
+
++ template<>
+ Matrix<unsigned char>&
+ Matrix<unsigned char>::operator+=(double a)
+ {
+@@ -52,6 +54,7 @@
+ }
+
+
++ template<>
+ Matrix<unsigned char>&
+ Matrix<unsigned char>::operator-=(double a)
+ {
+@@ -64,6 +67,7 @@
+ }
+
+
++ template<>
+ Matrix<unsigned char>&
+ Matrix<unsigned char>::operator/=(double a)
+ {
+--- nurbs++-3.0.11/matrix/vector.h.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/vector.h 2006-04-14 21:20:46.155862250 +0200
+@@ -69,7 +69,7 @@
+ {
+ public:
+ int rows() const //!< a reference to the size of the vector
+- { return sze ;}
++ { return this->sze ;}
+ Vector() : BasicArray<T>(1) {} //!< Basic constructor
+ Vector(const int r) : BasicArray<T>(r) {}
+ Vector(const Vector<T>& v) : BasicArray<T>(v) {}
+--- nurbs++-3.0.11/matrix/vector.cpp.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/vector.cpp 2006-04-14 22:08:11.165664250 +0200
+@@ -51,16 +51,16 @@
+ if(this==&b)
+ return *this ;
+
+- if ( n() != b.n())
++ if ( this->n() != b.n())
+ {
+ resize(b.n()) ;
+ }
+
+- sze = b.n() ;
++ this->sze = b.n() ;
+ T *pa, *pb ;
+- pa = x-1 ;
++ pa = this->x-1 ;
+ pb = b.x-1 ;
+- for(int i=n();i>0;--i){
++ for(int i=this->n();i>0;--i){
+ *(++pa) = *(++pb) ;
+ }
+ return *this;
+@@ -79,13 +79,13 @@
+ template <class T>
+ Vector<T>& Vector<T>::operator=(const BasicArray<T> &b)
+ {
+- if ( size() != b.size())
++ if ( this->size() != b.size())
+ {
+ resize(b.size()) ;
+ }
+ T *ptr ;
+- ptr = x - 1 ;
+- for(int i=size()-1;i>=0;--i)
++ ptr = this->x - 1 ;
++ for(int i=this->size()-1;i>=0;--i)
+ *(++ptr) = b[i] ;
+
+ return *this;
+@@ -105,9 +105,9 @@
+ template <class T>
+ T Vector<T>::operator=(const T d)
+ {
+- const int sz = size();
++ const int sz = this->size();
+ T *ptr ;
+- ptr = x-1 ;
++ ptr = this->x-1 ;
+ for (int i = sz; i > 0; --i)
+ *(++ptr) = d ;
+
+@@ -130,19 +130,19 @@
+ template <class T>
+ Vector<T>& Vector<T>::operator+=(const Vector<T> &a)
+ {
+- if ( a.size() != size())
++ if ( a.size() != this->size())
+ {
+ #ifdef USE_EXCEPTION
+- throw WrongSize(size(),a.size()) ;
++ throw WrongSize(this->size(),a.size()) ;
+ #else
+ Error error("Vector<T>::operator+=(Vector<T>&)");
+- error << "Vector<T> a += Vector<T> b different sizes, a = " << size() << ", b = " << a.size() ;
++ error << "Vector<T> a += Vector<T> b different sizes, a = " << this->size() << ", b = " << a.size() ;
+ error.fatal() ;
+ #endif
+ }
+- const int sz = size();
++ const int sz = this->size();
+ T *ptr,*aptr ;
+- ptr = x-1 ;
++ ptr = this->x-1 ;
+ aptr = a.x-1 ;
+ for (int i = sz; i >0; --i)
+ *(++ptr) += *(++aptr) ;
+@@ -165,20 +165,20 @@
+ template <class T>
+ Vector<T>& Vector<T>::operator-=(const Vector<T> &a)
+ {
+- if ( a.size() != size())
++ if ( a.size() != this->size())
+ {
+ #ifdef USE_EXCEPTION
+- throw WrongSize(size(),a.size()) ;
++ throw WrongSize(this->size(),a.size()) ;
+ #else
+ Error error("Vector<T>::operator-=(Vector<T>&)");
+- error << "Vector<T> a -= Vector<T> b different sizes, a = " << size() << ", b = " << a.size() ;
++ error << "Vector<T> a -= Vector<T> b different sizes, a = " << this->size() << ", b = " << a.size() ;
+ error.fatal() ;
+ #endif
+ }
+
+- const int sz = size();
++ const int sz = this->size();
+ T *ptr,*aptr ;
+- ptr = x-1 ;
++ ptr = this->x-1 ;
+ aptr = a.x-1 ;
+ for (int i = sz; i > 0; --i)
+ *(++ptr) -= *(++aptr) ;
+@@ -391,7 +391,7 @@
+ }
+
+ T *aptr,*bptr ;
+- aptr = &x[i]-1 ;
++ aptr = &this->x[i]-1 ;
+ bptr = b.x-1 ;
+ for ( int j = b.rows(); j > 0; --j)
+ *(++aptr) = *(++bptr) ;
+@@ -429,7 +429,7 @@
+
+ Vector<T> subvec(l) ;
+ T *aptr, *bptr ;
+- aptr = &x[i] - 1 ;
++ aptr = &this->x[i] - 1 ;
+ bptr = subvec.x -1 ;
+ for ( int j = l; j > 0; --j)
+ *(++bptr) = *(++aptr) ;
+@@ -449,12 +449,12 @@
+ */
+ template <class T>
+ int Vector<T>::minIndex() const {
+- T min = x[0] ;
++ T min = this->x[0] ;
+ int index = 0 ;
+
+- for(int i=1;i<n();i++){
+- if(x[i]<=min){
+- min = x[i] ;
++ for(int i=1;i<this->n();i++){
++ if(this->x[i]<=min){
++ min = this->x[i] ;
+ index = i ;
+ }
+ }
+@@ -523,12 +523,12 @@
+ T a ;
+ T *v1,*v2 ;
+
+- ir = sze-1 ;
++ ir = this->sze-1 ;
+ l = 0 ;
+
+ while(1){
+ if(ir-l<M){ // perform an insertion sort when the array is small enough
+- v1 = &x[l] ;
++ v1 = &this->x[l] ;
+ for(j=l+1;j<=ir;++j){
+ a = *(++v1) ;
+ v2 = v1 ;
+@@ -547,31 +547,31 @@
+ }
+ else{
+ k=(l+ir) >> 1 ;
+- swap(x[k],x[l+1]) ;
+- if(x[l+1] > x[ir]){
+- swap(x[l+1],x[ir]) ;
++ swap(this->x[k],this->x[l+1]) ;
++ if(this->x[l+1] > this->x[ir]){
++ swap(this->x[l+1],this->x[ir]) ;
+ }
+- if(x[l]> x[ir]){
+- swap(x[l],x[ir]) ;
++ if(this->x[l]> this->x[ir]){
++ swap(this->x[l],this->x[ir]) ;
+ }
+- if(x[l+1] > x[l]){
+- swap(x[l+1],x[l]) ;
++ if(this->x[l+1] > this->x[l]){
++ swap(this->x[l+1],this->x[l]) ;
+ }
+ i=l+1 ;
+ j=ir ;
+- a=x[l] ;
+- v1 = &x[i] ;
+- v2 = &x[j] ;
++ a=this->x[l] ;
++ v1 = &this->x[i] ;
++ v2 = &this->x[j] ;
+ while(1){
+ while(*v1 < a) { ++i ; ++v1 ; }
+ while(*v2 > a) { --j ; --v2 ; }
+ if(j<i) break ;
+ if(*v1 == *v2) // both are equal to a...
+ break ;
+- swap(x[i],x[j]) ;
++ swap(this->x[i],this->x[j]) ;
+ }
+- x[l] = x[j] ;
+- x[j] = a ;
++ this->x[l] = this->x[j] ;
++ this->x[j] = a ;
+ jstack += 2 ;
+ if(jstack>=Nstack){
+ istack.resize(istack.n()+Nstack) ; // increase the vector size
+@@ -618,10 +618,10 @@
+ int jstack=0;
+ T a ;
+
+- ir = sze-1 ;
++ ir = this->sze-1 ;
+ l = 0 ;
+
+- index.resize(sze) ;
++ index.resize(this->sze) ;
+ for(i=0;i<index.n();++i)
+ index[i] = i ;
+
+@@ -629,9 +629,9 @@
+ if(ir-l<M){ // perform an insertion sort when the array is small enough
+ for(j=l+1;j<=ir;++j){
+ indext = index[j] ;
+- a = x[indext] ;
++ a = this->x[indext] ;
+ for(i=j-1;i>=0;--i){
+- if(x[index[i]] <= a) break ;
++ if(this->x[index[i]] <= a) break ;
+ index[i+1] = index[i] ;
+ }
+ index[i+1] = indext ;
+@@ -643,24 +643,24 @@
+ else{
+ k=(l+ir) >> 1 ;
+ swap(index[k],index[l+1]) ;
+- if(x[index[l+1]] > x[index[ir]]){
++ if(this->x[index[l+1]] > this->x[index[ir]]){
+ swap(index[l+1],index[ir]) ;
+ }
+- if(x[index[l]]> x[index[ir]]){
++ if(this->x[index[l]]> this->x[index[ir]]){
+ swap(index[l],index[ir]) ;
+ }
+- if(x[index[l+1]] > x[index[l]]){
++ if(this->x[index[l+1]] > this->x[index[l]]){
+ swap(index[l+1],index[l]) ;
+ }
+ i=l+1 ;
+ j=ir ;
+ indext = index[l] ;
+- a=x[indext] ;
++ a=this->x[indext] ;
+ while(1){
+- while(x[index[i]] < a) { ++i ; }
+- while(x[index[j]] > a) { --j ; }
++ while(this->x[index[i]] < a) { ++i ; }
++ while(this->x[index[j]] > a) { --j ; }
+ if(j<i) break ;
+- if(x[index[i]] == x[index[j]])
++ if(this->x[index[i]] == this->x[index[j]])
+ break ;
+ swap(index[i],index[j]) ;
+ }
+--- nurbs++-3.0.11/matrix/cvector.h.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/cvector.h 2006-04-14 21:22:03.036667000 +0200
+@@ -54,10 +54,10 @@
+ CVector(const BasicArray<T>& v) : Vector<T>(v), index(0) {;}
+ virtual ~CVector() {}
+
+- T& operator[](const int i) { return x[i%sze]; }
+- T operator[](const int i) const { return x[i%sze]; }
++ T& operator[](const int i) { return this->x[i%this->sze]; }
++ T operator[](const int i) const { return this->x[i%this->sze]; }
+
+- void put(T v) { x[index] = v ; index = (index+1)%sze; }
++ void put(T v) { this->x[index] = v ; index = (index+1)%this->sze; }
+
+ protected:
+ int index ;
+--- nurbs++-3.0.11/matrix/matrix_int.cpp.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/matrix_int.cpp 2006-04-14 21:56:53.575317500 +0200
+@@ -29,10 +29,12 @@
+
+ namespace PLib {
+
++ template<>
+ void Matrix<int>::qSort(){
+ qsort((char*)m,rows()*cols(),sizeof(int),compareInt) ;
+ }
+
++ template<>
+ Matrix<int>&
+ Matrix<int>::operator*=(double a)
+ {
+@@ -46,6 +48,7 @@
+ return *this ;
+ }
+
++ template<>
+ Matrix<int>&
+ Matrix<int>::operator+=(double a)
+ {
+@@ -57,6 +60,7 @@
+ return *this ;
+ }
+
++ template<>
+ Matrix<int>&
+ Matrix<int>::operator-=(double a)
+ {
+@@ -68,6 +72,7 @@
+ return *this ;
+ }
+
++ template<>
+ Matrix<int>&
+ Matrix<int>::operator/=(double a)
+ {
+--- nurbs++-3.0.11/matrix/vector_int.cpp.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/vector_int.cpp 2006-04-14 22:08:32.931024500 +0200
+@@ -27,6 +27,7 @@
+
+ namespace PLib {
+
++ template<>
+ void Vector<int>::qSortStd(){
+ qsort((char*)memory(),n(),sizeof(int),compareInt) ;
+ }
+--- nurbs++-3.0.11/matrix/matrix.cpp.orig 2002-05-13 23:07:45.000000000 +0200
++++ nurbs++-3.0.11/matrix/matrix.cpp 2006-04-14 21:55:20.841522000 +0200
+@@ -54,19 +54,19 @@
+ if ( this == &a )
+ return *this;
+
+- if ( a.rows() != rows() || a.cols() != cols() ){
++ if ( a.rows() != this->rows() || a.cols() != this->cols() ){
+ resize(a.rows(),a.cols()) ;
+ }
+
+- int sze = rows()*cols() ;
++ int sze = this->rows()*this->cols() ;
+ T *ptr, *aptr ;
+- ptr = m-1 ;
++ ptr = this->m-1 ;
+ aptr = a.m-1 ;
+
+ for (i = sze; i > 0; --i)
+ *(++ptr) = *(++aptr) ;
+
+- by_columns = a.by_columns;
++ this->by_columns = a.by_columns;
+
+ return *this;
+ }
+@@ -100,10 +100,10 @@
+ {
+ int rwz,coz,i,j;
+
+- if ( rows() % a.rows() != 0 || cols() % a.cols() != 0 || rows() < a.rows() || cols() < a.cols() )
++ if ( this->rows() % a.rows() != 0 || this->cols() % a.cols() != 0 || this->rows() < a.rows() || this->cols() < a.cols() )
+ {
+ #ifdef USE_EXCEPTION
+- throw WrongSize2D(rows(),cols(),a.rows(),a.cols()) ;
++ throw WrongSize2D(this->rows(),this->cols(),a.rows(),a.cols()) ;
+ #else
+ Error error("Matrix<T>::submatrix");
+ error << "Matrix and submatrix incommensurate" ;
+@@ -111,13 +111,13 @@
+ #endif
+ }
+
+- if ( sr >= rows()/a.rows() || sr < 0 || sc >= cols()/a.cols() || sc < 0 )
++ if ( sr >= this->rows()/a.rows() || sr < 0 || sc >= this->cols()/a.cols() || sc < 0 )
+ {
+ #ifdef USE_EXCEPTION
+- throw OutOfBound2D(sr,sc,0,rows()/a.rows()-1,0,cols()/a.cols()-1) ;
++ throw OutOfBound2D(sr,sc,0,this->rows()/a.rows()-1,0,this->cols()/a.cols()-1) ;
+ #else
+ Error error("Matrix<T>::submatrix");
+- error << "Submatrix location out of bounds.\nrowblock " << sr << ", " << rows()/a.rows() << " colblock " << sc << ", " << a.cols() << endl ;
++ error << "Submatrix location out of bounds.\nrowblock " << sr << ", " << this->rows()/a.rows() << " colblock " << sc << ", " << a.cols() << endl ;
+ error.fatal() ;
+ #endif
+ }
+@@ -127,7 +127,7 @@
+ #ifdef COLUMN_ORDER
+ for ( i = a.rows()-1; i >= 0; --i )
+ for(j=a.cols()-1;j>=0;--j)
+- elem(i+rwz,j+coz) = a(i,j) ;
++ this->elem(i+rwz,j+coz) = a(i,j) ;
+ #else
+ T *ptr, *aptr ;
+ aptr = a.m - 1;
+@@ -159,7 +159,7 @@
+ // Assign matrix a to this matrix at (i,j)
+ int i, j;
+
+- if ( (rw + a.rows()) > rows() || ( cl + a.cols()) > cols()) {
++ if ( (rw + a.rows()) > this->rows() || ( cl + a.cols()) > this->cols()) {
+ #ifdef USE_EXCEPTION
+ throw MatrixErr();
+ #else
+@@ -172,7 +172,7 @@
+ #ifdef COLUMN_ORDER
+ for(i=0;i<a.rows();++i)
+ for(j=0;j<a.cols();++j)
+- elem(i+rw,j+cl) = a(i,j) ;
++ this->elem(i+rw,j+cl) = a(i,j) ;
+ #else
+ T *pptr,*aptr ;
+ aptr = a.m-1 ;
+@@ -208,7 +208,7 @@
+ Matrix<T> Matrix<T>::get(int rw, int cl, int nr, int nc) const
+ {
+ Matrix<T> getmat(nr,nc) ;
+- if ( (rw+nr) > rows() || (cl+nc) > cols()) {
++ if ( (rw+nr) > this->rows() || (cl+nc) > this->cols()) {
+ #ifdef USE_EXCEPTION
+ throw MatrixErr();
+ #else
+@@ -223,12 +223,12 @@
+ #ifdef COLUMN_ORDER
+ for(i=0;i<nr;++i)
+ for(j=0;j<nc;++j)
+- getmat(i,j) = elem(i+rw,j+cl) ;
++ getmat(i,j) = this->elem(i+rw,j+cl) ;
+ #else
+ T *pptr,*aptr ;
+ aptr = getmat.m-1;
+ for (i = 0; i < nr; ++i) {
+- pptr = &m[(i+rw)*cols()+cl]-1 ;
++ pptr = &m[(i+rw)*this->cols()+cl]-1 ;
+ for ( j = 0; j < nc; ++j)
+ *(++aptr) = *(++pptr) ;
+ }
+@@ -252,11 +252,11 @@
+ double sum, maxsum;
+ int init=0 ;
+ T *pptr ;
+- pptr = m-1 ;
++ pptr = this->m-1 ;
+ maxsum = 0 ; // Silence the warning message
+- for(i=0;i<rows();++i){
++ for(i=0;i<this->rows();++i){
+ sum = 0 ;
+- for ( j = 0; j < cols(); ++j)
++ for ( j = 0; j < this->cols(); ++j)
+ sum += *(++pptr) ;
+ if(init)
+ maxsum = (maxsum>sum) ? maxsum : sum;
+@@ -285,12 +285,12 @@
+ {
+ int i, iend;
+
+- iend = rows();
+- if ( iend > cols() )
+- iend = cols();
++ iend = this->rows();
++ if ( iend > this->cols() )
++ iend = this->cols();
+
+ for (i = iend-1; i >=0; --i)
+- elem(i,i) = a;
++ this->elem(i,i) = a;
+
+ }
+
+@@ -308,10 +308,10 @@
+ template <class T>
+ Vector<T> Matrix<T>::getDiag(){
+ int i, iend;
+- Vector<T> vec(minimum(rows(),cols())) ;
+- iend = minimum(rows(),cols());
++ Vector<T> vec(minimum(this->rows(),this->cols())) ;
++ iend = minimum(this->rows(),this->cols());
+ for (i = iend-1; i >=0; --i)
+- vec[i] = elem(i,i);
++ vec[i] = this->elem(i,i);
+ return vec ;
+ }
+
+@@ -328,8 +328,8 @@
+ Matrix<T>& Matrix<T>::operator+=(double a)
+ {
+ T *p1 ;
+- p1 = m-1 ;
+- const int size = rows()*cols() ;
++ p1 = this->m-1 ;
++ const int size = this->rows()*this->cols() ;
+ for(int i=size; i>0; --i)
+ *(++p1) += a ;
+ return *this ;
+@@ -348,8 +348,8 @@
+ Matrix<T>& Matrix<T>::operator-=(double a)
+ {
+ T *p1 ;
+- p1 = m-1 ;
+- const int size = rows()*cols() ;
++ p1 = this->m-1 ;
++ const int size = this->rows()*this->cols() ;
+ for(int i=size; i>0; --i)
+ *(++p1) -= a ;
+ return *this ;
+@@ -368,8 +368,8 @@
+ Matrix<T>& Matrix<T>::operator*=(double a)
+ {
+ T *p1 ;
+- p1 = m-1 ;
+- const int size = rows()*cols() ;
++ p1 = this->m-1 ;
++ const int size = this->rows()*this->cols() ;
+ for(int i=size; i>0; --i)
+ *(++p1) *= a ;
+ return *this ;
+@@ -388,8 +388,8 @@
+ Matrix<T>& Matrix<T>::operator/=(double a)
+ {
+ T *p1 ;
+- p1 = m-1 ;
+- const int size = rows()*cols() ;
++ p1 = this->m-1 ;
++ const int size = this->rows()*this->cols() ;
+ for(int i=size; i>0; --i)
+ *(++p1) /= a ;
+ return *this ;
+@@ -408,16 +408,16 @@
+ template <class T>
+ Matrix<T>& Matrix<T>::operator+=(const Matrix<T> &a)
+ {
+- if ( a.rows() != rows() || a.cols() != cols() )
++ if ( a.rows() != this->rows() || a.cols() != this->cols() )
+ {
+ #ifdef USE_EXCEPTION
+- throw WrongSize2D(rows(),cols(),a.rows(),a.cols());
++ throw WrongSize2D(this->rows(),this->cols(),a.rows(),a.cols());
+ #else
+ Error error("Matrix<T>::operator+=") ;
+- if ( rows() != a.rows() )
+- error << "Matrices are of diferent size, a.rows() = " << rows() << " and b.rows() = " << a.rows() << endl ;
+- if ( cols() != a.cols())
+- error << "Matrices are of diferent size, a.cols() = " << cols() << " and b.cols() = " << a.cols() << endl ;
++ if ( this->rows() != a.rows() )
++ error << "Matrices are of diferent size, a.rows() = " << this->rows() << " and b.rows() = " << a.rows() << endl ;
++ if ( this->cols() != a.cols())
++ error << "Matrices are of diferent size, a.cols() = " << this->cols() << " and b.cols() = " << a.cols() << endl ;
+ error.fatal() ;
+ #endif
+ }
+@@ -425,8 +425,8 @@
+ int i, sze ;
+ T *aptr,*sptr ;
+ aptr = a.m - 1 ;
+- sptr = m - 1 ;
+- sze = rows()*cols() ;
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list