Skip to content
Snippets Groups Projects
Commit 5b08f736 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

limit PhysicalNames to 128 chars

parent ad9fb0cd
No related branches found
No related tags found
No related merge requests found
......@@ -526,9 +526,12 @@ int GModel::writeMSH(const std::string &name, double version, bool binary,
if(numPhysicalNames()){
fprintf(fp, "$PhysicalNames\n");
fprintf(fp, "%d\n", numPhysicalNames());
for(piter it = firstPhysicalName(); it != lastPhysicalName(); it++)
for(piter it = firstPhysicalName(); it != lastPhysicalName(); it++){
std::string name = it->second;
if(name.size() > 254) name.resize(254);
fprintf(fp, "%d %d \"%s\"\n", it->first.first, it->first.second,
it->second.c_str());
name.c_str());
}
fprintf(fp, "$EndPhysicalNames\n");
}
......
......@@ -895,9 +895,12 @@ int GModel::_writeMSH2(const std::string &name, double version, bool binary,
if(numPhysicalNames()){
fprintf(fp, "$PhysicalNames\n");
fprintf(fp, "%d\n", numPhysicalNames());
for(piter it = firstPhysicalName(); it != lastPhysicalName(); it++)
for(piter it = firstPhysicalName(); it != lastPhysicalName(); it++){
std::string name = it->second;
if(name.size() > 128) name.resize(128);
fprintf(fp, "%d %d \"%s\"\n", it->first.first, it->first.second,
it->second.c_str());
name.c_str());
}
fprintf(fp, "$EndPhysicalNames\n");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment