Salome HOME
[SALOME platform 0019867]: Export/Import MED problem with Volumes
authoreap <eap@opencascade.com>
Mon, 9 Jun 2008 06:49:26 +0000 (06:49 +0000)
committereap <eap@opencascade.com>
Mon, 9 Jun 2008 06:49:26 +0000 (06:49 +0000)
     Prevent from whitespace being the last char of family name - II

src/DriverMED/DriverMED_Family.cxx

index 45aa1e30a9a329999fe97c2fa04112d41d85a40c..4b34b35d1369bee95c1a34d74e5318e8b0df9f88 100644 (file)
@@ -319,14 +319,15 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
     aStr << "_" << *aGrIter;
   }
   string aValue = aStr.str();
-  // PAL19785 - med forbids whitespace to be the last char in the name
-  MED::TInt maxSize;
+  // PAL19785,0019867 - med forbids whitespace to be the last char in the name
+  int maxSize;
   if ( theWrapper->GetVersion() == MED::eV2_1 )
     maxSize = MED::GetNOMLength<MED::eV2_1>();
   else
     maxSize = MED::GetNOMLength<MED::eV2_2>();
-  if ( aValue.size() >= maxSize && aValue[ maxSize-1 ] == ' ' )
-    aValue[ maxSize-1 ] = '_';
+  int lastCharPos = min( maxSize, (int) aValue.size() ) - 1;
+  while ( isspace( aValue[ lastCharPos ] ))
+    aValue.resize( lastCharPos-- );
 
   MED::PFamilyInfo anInfo;
   if(myId == 0 || myGroupAttributVal == 0){