From 724c4a913f3dc80e9eb436501f5c8545bb31cd7b Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 24 Feb 2012 13:36:46 +0000 Subject: [PATCH] Warning hunting --- src/MEDLoader/MEDFileField.cxx | 7 ++-- src/MEDLoader/MEDFileField.hxx | 1 + src/MEDLoader/MEDFileMesh.cxx | 26 +++++++------- src/MEDLoader/MEDFileMeshElt.cxx | 6 ++-- src/MEDLoader/MEDLoader.cxx | 53 +++++++++++++--------------- src/MEDLoader/SauvMedConvertor.cxx | 38 ++++++++++---------- src/MEDLoader/SauvReader.cxx | 2 +- src/MEDLoader/Test/MEDLoaderTest.cxx | 6 ++-- 8 files changed, 69 insertions(+), 70 deletions(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 134f13694..39ee3c466 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -378,7 +378,6 @@ void MEDFileFieldPerMeshPerTypePerDisc::finishLoading(med_idt fid, int profileIt int order=getOrder(); TypeOfField type=getType(); INTERP_KERNEL::NormalizedCellType geoType=getGeoType(); - int profilesize; med_geometry_type mgeoti; med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti); DataArrayDouble *arr=getArray(); @@ -1839,6 +1838,10 @@ void MEDFieldFieldGlobsReal::simpleRepr(std::ostream& oss) const oss << "NO GLOBAL INFORMATION !\n"; } +MEDFieldFieldGlobsReal::~MEDFieldFieldGlobsReal() +{ +} + void MEDFieldFieldGlobsReal::shallowCpyGlobs(const MEDFieldFieldGlobsReal& other) { _globals=other._globals; @@ -3223,7 +3226,7 @@ try:MEDFileFieldMultiTSWithoutDAS(fieldName),MEDFieldFieldGlobsReal(fileName) if(found) { nbstep2=nbOfStep; - _field_type=_field_type=MEDFileUtilities::TraduceFieldType(typcha); + _field_type=MEDFileUtilities::TraduceFieldType(typcha); _infos.resize(ncomp); for(int j=0;j getPflsReallyUsed() const = 0; virtual std::vector getLocsReallyUsed() const = 0; + virtual ~MEDFieldFieldGlobsReal(); // void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception); void loadProfileInFile(med_idt fid, int id); diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 169644111..a29ccb091 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -252,8 +252,8 @@ void MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector int i=0; for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) { - std::string name=getFamilyNameGivenId(*it1); - fams[i]=name; + std::string name2=getFamilyNameGivenId(*it1); + fams[i]=name2; } _groups[oname]=fams; } @@ -287,15 +287,15 @@ void MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(std::vector::const_iterator it=grps.begin();it!=grps.end();it++) + for(std::vector::const_iterator it3=grps.begin();it3!=grps.end();it3++) { - std::map< std::string, std::vector >::iterator it2=_groups.find(*it); + std::map< std::string, std::vector >::iterator it2=_groups.find(*it3); if(it2!=_groups.end()) (*it2).second.push_back(fName); else { - std::vector grps(1,fName); - _groups[*it]=grps; + std::vector grps2(1,fName); + _groups[*it3]=grps2; } } } @@ -747,10 +747,10 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector > grps2(grps.size()); - for(unsigned int i=0;isetName(grps[i]->getName().c_str()); + grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]); + grps2[ii]->setName(grps[ii]->getName().c_str()); } std::vector grps3(grps2.begin(),grps2.end()); fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups); @@ -945,7 +945,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh return false; } } - std::vector< MEDCouplingAutoRefCountObjectPtr > _ms; + //std::vector< MEDCouplingAutoRefCountObjectPtr > _ms; return true; } @@ -954,13 +954,13 @@ void MEDFileUMesh::clearNonDiscrAttributes() const MEDFileMesh::clearNonDiscrAttributes(); const DataArrayDouble *coo1=_coords; if(coo1) - ((DataArrayDouble *)coo1)->setName("");//This parameter is not discriminant for comparison + (const_cast(coo1))->setName("");//This parameter is not discriminant for comparison const DataArrayInt *famc1=_fam_coords; if(famc1) - ((DataArrayInt *)famc1)->setName("");//This parameter is not discriminant for comparison + (const_cast(famc1))->setName("");//This parameter is not discriminant for comparison const DataArrayInt *numc1=_num_coords; if(numc1) - ((DataArrayInt *)numc1)->setName("");//This parameter is not discriminant for comparison + (const_cast(numc1))->setName("");//This parameter is not discriminant for comparison for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *tmp=(*it); diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index f183f85ed..88fa052e5 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -270,7 +270,7 @@ void MEDFileUMeshPerType::write(med_idt fid, const char *mname, int mdim, const int *bt=bigtab; for(int i=0;i MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileN if(found) for(int j=0;j MEDLoader::GetTypesOfField(const char *file if(nbPdt>0) { bool found=false; - for(int i=0;i MEDLoaderNS::getIdsFromGroups(const char *fileName, const char std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); for(int j=0;jgetConstPointer(); - for(int i=0;igetConstPointer(); - for(int i=0;igetConstPointer(); - for(int i=0;i MEDLoader::ReadFieldsOnSameMes // for(int itId=1;itId<(int)its.size();itId++) { - std::list fieldPerCellType; - double time; - std::vector infos; - MEDLoaderNS::readFieldDoubleDataInMedFile(fileName,meshName,fieldName,its[itId].first,its[itId].second,type,fieldPerCellType,time,infos); - std::vector familiesToKeep; - std::vector typesToKeep; - if(type==ON_CELLS || type==ON_GAUSS_PT || type==ON_GAUSS_NE) - for(std::list::const_iterator iter=fieldPerCellType.begin();iter!=fieldPerCellType.end();iter++) - typesToKeep.push_back((*iter).getType()); - ret[itId]=MEDLoaderNS::readFieldDoubleLev2(fileName,type,meshDim,cellRenum,m1,infos,fieldName,its[itId].first,its[itId].second,time,fieldPerCellType); + std::list fieldPerCellType2; + double timmee; + std::vector infoss; + MEDLoaderNS::readFieldDoubleDataInMedFile(fileName,meshName,fieldName,its[itId].first,its[itId].second,type,fieldPerCellType2,timmee,infoss); + ret[itId]=MEDLoaderNS::readFieldDoubleLev2(fileName,type,meshDim,cellRenum,m1,infoss,fieldName,its[itId].first,its[itId].second,timmee,fieldPerCellType2); //clean-up - MEDLoaderNS::releaseMEDFileCoreFrmt(fieldPerCellType); + MEDLoaderNS::releaseMEDFileCoreFrmt(fieldPerCellType2); } delete [] cellRenum; return ret; @@ -2524,7 +2519,7 @@ void MEDLoaderNS::appendFieldDirectly(const char *fileName, const ParaMEDMEM::ME } MEDfileClose(fid); if(renum) - ((ParaMEDMEM::MEDCouplingFieldDouble *)f)->decrRef(); + f->decrRef(); } /*! @@ -2569,7 +2564,7 @@ void MEDLoaderNS::writeFieldAndMeshDirectly(const char *fileName, const ParaMEDM std::string fieldName(f->getName()); if(fieldName.empty()) throw INTERP_KERNEL::Exception("Trying to write a field with no name ! MED file format needs a not empty field name !"); - MEDCouplingUMesh *mesh=dynamic_cast((MEDCouplingMesh *)f->getMesh()); + MEDCouplingUMesh *mesh=dynamic_cast(const_cast(f->getMesh())); if(mesh) { bool isRenumbering; diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 19fa3a7ba..0357275a5 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -101,7 +101,7 @@ namespace { if ( const int * conn = getGibi2MedQuadraticInterlace( type )) { - Cell* ma = (Cell*) & aCell; + Cell* ma = const_cast(&aCell); //cout << "###### BEFORE ConvertQuadratic() " << *ma << endl; vector< Node* > new_nodes( ma->_nodes.size() ); for ( size_t i = 0; i < new_nodes.size(); ++i ) @@ -199,7 +199,7 @@ namespace inline void reverse(const Cell & aCell, const vector > & swapVec ) { - Cell* ma = (Cell*) & aCell; + Cell* ma = const_cast(&aCell); for ( unsigned i = 0; i < swapVec.size(); ++i ) std::swap( ma->_nodes[ swapVec[i].first ], ma->_nodes[ swapVec[i].second ]); @@ -392,17 +392,17 @@ std::ostream& SauvUtilities::operator<< (std::ostream& os, const SauvUtilities:: int Group::size() const { - int size = 0; + int sizze = 0; if ( !_relocTable.empty() ) - size = _relocTable.size(); + sizze = _relocTable.size(); else if ( _medGroup ) - size = _medGroup->getNumberOfTuples(); + sizze = _medGroup->getNumberOfTuples(); else if ( !_cells.empty() ) - size = _cells.size(); + sizze = _cells.size(); else for ( size_t i = 0; i < _groups.size(); ++i ) - size += _groups[i]->size(); - return size; + sizze += _groups[i]->size(); + return sizze; } //================================================================================ @@ -1601,10 +1601,10 @@ void IntermediateMED::orientFaces3D() { if ( manifold ) { - list::iterator i = ml.begin(); + list::iterator ii = ml.begin(); cout << nbFaceByLink << " faces by 1 link:"; - for( ; i!= ml.end(); i++ ) - cout << "in sub-mesh " << fgm[ *i ]->_name << endl << **i; + for( ; ii!= ml.end(); ii++ ) + cout << "in sub-mesh " << fgm[ *ii ]->_name << endl << **ii; } manifold = false; } @@ -2401,19 +2401,19 @@ IntermediateMED::~IntermediateMED() /*! * \brief CellsByDimIterator constructor */ -CellsByDimIterator::CellsByDimIterator( const IntermediateMED & medi, int dim) +CellsByDimIterator::CellsByDimIterator( const IntermediateMED & medi, int dimm) { myImed = & medi; - init( dim ); + init( dimm ); } /*! * \brief Initialize iteration on cells of given dimention */ -void CellsByDimIterator::init(const int dim) +void CellsByDimIterator::init(const int dimm) { myCurType = -1; myTypeEnd = INTERP_KERNEL::NORM_HEXA20 + 1; - myDim = dim; + myDim = dimm; } /*! * \brief return next set of Cell's of required dimension @@ -2430,11 +2430,11 @@ const std::set< Cell > * CellsByDimIterator::nextType() */ int CellsByDimIterator::dim(const bool last) const { - int type = myCurType; + int typp = myCurType; if ( !last ) - while ( type < myTypeEnd && myImed->_cellsByType[type].empty() ) - ++type; - return type < myTypeEnd ? getDimension( TCellType( type )) : 4; + while ( typp < myTypeEnd && myImed->_cellsByType[typp].empty() ) + ++typp; + return typp < myTypeEnd ? getDimension( TCellType( typp )) : 4; } // END CellsByDimIterator ======================================================== diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index c3f41d87d..ca3c924ce 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -1069,7 +1069,7 @@ void SauvReader::read_PILE_TABLES (const int nbObjects, else { // pass table - for ( int i = 0; i < 4; ++i ) next(); + for ( int ii = 0; ii < 4; ++ii ) next(); } } } // for (int itable = 0; itable < nbObjects; itable++) diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index ae93d5d1c..323fa31fd 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -182,7 +182,7 @@ void MEDLoaderTest::testFieldRW3() const char name1[]="AField"; const char name3[]="AMesh1"; MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1(); - ((MEDCouplingMesh *)f1->getMesh())->setName(name3); + (const_cast(f1->getMesh()))->setName(name3); f1->setName(name1); f1->setTime(10.,8,9); double *tmp=f1->getArray()->getPointer(); @@ -204,7 +204,7 @@ void MEDLoaderTest::testFieldRW3() f1->decrRef(); f1=buildVecFieldOnNodes_1(); f1->setName(name1); - ((MEDCouplingMesh *)f1->getMesh())->setName(name3); + (const_cast(f1->getMesh()))->setName(name3); f1->setTime(110.,8,9); MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(110.,108,109); @@ -409,7 +409,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() f1->checkCoherency(); const int arr2[6]={2,4,5,3,6,7}; MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+6); - ((MEDCouplingMesh *)f2->getMesh())->setName(f1->getMesh()->getName()); + (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName()); MEDLoader::WriteField(fileName,f2,false);//<- false important for the test // MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f2->getMesh()->getName(),0,f2->getName(),2,7); -- 2.39.2