Salome HOME
Limit for compo length from 15 to 16 V8_2_0b1
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 10 Nov 2016 16:38:48 +0000 (17:38 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 10 Nov 2016 16:38:48 +0000 (17:38 +0100)
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDLoaderBase.cxx

index 40dee2a20cd7141fd92b01a84178a886d52d3f46..47fdb3280652dc879710fe43f7678c37b3ff78ba 100644 (file)
@@ -2858,8 +2858,8 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const
       std::string info=coo->getInfoOnComponent(i);
       std::string c,u;
       MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
-      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
-      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
+      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
+      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
     }
   MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit));
   if(_univ_wr_status)
index 8af45dda8de09af891ed2f546f9236a009d21f6e..b83d8a84ec82ee07a8c531581488ed72906672e4 100644 (file)
@@ -177,7 +177,8 @@ void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int be
           return ;
         }
     }
-  int n=strlen(src);
+  int n(strlen(src));
+  std::fill(dest,dest+maxLgth,' ');
   strncpy(dest,src,n);
 }