Salome HOME
PAL19785 Anomaly UnionGroup + hdf save
authoreap <eap@opencascade.com>
Thu, 22 May 2008 08:43:10 +0000 (08:43 +0000)
committereap <eap@opencascade.com>
Thu, 22 May 2008 08:43:10 +0000 (08:43 +0000)
    Prevent from whitespace being the last char of family name

src/DriverMED/DriverMED_Family.cxx

index 69265bb1de1b766f103abb7925a550b5eed96d65..45aa1e30a9a329999fe97c2fa04112d41d85a40c 100644 (file)
@@ -318,9 +318,17 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
   for(; aGrIter != myGroupNames.end(); aGrIter++){
     aStr << "_" << *aGrIter;
   }
+  string aValue = aStr.str();
+  // PAL19785 - med forbids whitespace to be the last char in the name
+  MED::TInt 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 ] = '_';
 
   MED::PFamilyInfo anInfo;
-  string aValue = aStr.str();
   if(myId == 0 || myGroupAttributVal == 0){
     anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
                                      aValue,