From: Anthony Geay Date: Thu, 10 Nov 2016 16:38:48 +0000 (+0100) Subject: Limit for compo length from 15 to 16 X-Git-Tag: V8_2_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6db74b4c79d5c8590c0056ca381d3ddb13d99d2;p=tools%2Fmedcoupling.git Limit for compo length from 15 to 16 --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 40dee2a20..47fdb3280 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -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) diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index 8af45dda8..b83d8a84e 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -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); }