From: ageay Date: Mon, 18 Feb 2013 16:20:58 +0000 (+0000) Subject: Edward code review X-Git-Tag: V6_main_FINAL~351 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d810298bc41d9d60bf6baffd3c8cd561616a621;p=tools%2Fmedcoupling.git Edward code review --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index a74b583bd..75eb31a15 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -2001,7 +2001,7 @@ double DataArrayDouble::accumulate(int compId) const throw(INTERP_KERNEL::Except const double *ptr=getConstPointer(); int nbTuple=getNumberOfTuples(); int nbComps=getNumberOfComponents(); - if(compId>=nbComps) + if(compId<0 || compId>=nbComps) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !"); double ret=0.; for(int i=0;i(fabs)); + declareAsNew(); } void DataArrayDouble::applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception) @@ -5267,7 +5268,7 @@ int DataArrayInt::accumulate(int compId) const throw(INTERP_KERNEL::Exception) const int *ptr=getConstPointer(); int nbTuple=getNumberOfTuples(); int nbComps=getNumberOfComponents(); - if(compId>=nbComps) + if(compId<0 || compId>=nbComps) throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !"); int ret=0; for(int i=0;i(std::abs)); + declareAsNew(); } void DataArrayInt::applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception)