From 8924cbc6f26177d91aea19a80259c71de15caa87 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 24 Nov 2011 10:50:53 +0000 Subject: [PATCH] fix loadInMEDFileDS() to stop reading XDR file at ENREGISTREMENT DE TYPE 5 --- src/MEDLoader/SauvReader.cxx | 37 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index f9e150a43..c3f41d87d 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -125,23 +125,17 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS() throw(INTERP_KERNEL::Exc recordNumber = getInt(); // read the record - switch ( recordNumber ) - { - case 2: - readRecord2(); - break; - case 4: - readRecord4(); - break; - case 7: - readRecord7(); - break; - case 5: - break; - default: - if ( !isASCII() ) - THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); - } + if ( recordNumber == 2 ) + readRecord2(); + else if (recordNumber == 4 ) + readRecord4(); + else if (recordNumber == 7 ) + readRecord7(); + else if (recordNumber == 5 ) + break; // stop reading + else + if ( !isASCII() ) + THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); } ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS(); @@ -245,9 +239,10 @@ int SauvReader::readPileNumber(int& nbNamedObjects, int& nbObjects) THROW_IK_EXCEPTION("Invalid nb of named objects: " << nbNamedObjects << lineNb() ); if ( nbObjects<0) THROW_IK_EXCEPTION("Invalid nb of objects: " << nbObjects << lineNb() ); - if ( nbObjects_nbNodes*(_iMed->_spaceDim+1)) ) - THROW_IK_EXCEPTION("Erroor of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() ); + THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() ); // there are coordinates + density for each node _iMed->_coords.resize( nbReals - nbReals/(_iMed->_spaceDim+1)); -- 2.39.2