Skip to content

Commit 91c366e

Browse files
committed
Fix of string copying issue.
1 parent e9d3bb1 commit 91c366e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

hermes2d/src/mesh/mesh_reader_h2d.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ namespace Hermes
181181
//// vertices ////////////////////////////////////////////////////////////////
182182

183183
n = m.n_vert;
184-
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'vertices' must be a list.", filename);
185-
if (n < 2) throw Hermes::Exceptions::MeshLoadFailureException("File %s: invalid number of vertices.", filename);
184+
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'vertices' must be a list.", filename.c_str());
185+
if (n < 2) throw Hermes::Exceptions::MeshLoadFailureException("File %s: invalid number of vertices.", filename.c_str());
186186

187187
// create a hash table large enough
188188
int size = HashTable::H2D_DEFAULT_HASH_SIZE;
@@ -207,8 +207,8 @@ namespace Hermes
207207
//// elements ////////////////////////////////////////////////////////////////
208208

209209
n = m.n_el;
210-
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'elements' must be a list.", filename);
211-
if (n < 1) throw Hermes::Exceptions::MeshLoadFailureException("File %s: no elements defined.", filename);
210+
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'elements' must be a list.", filename.c_str());
211+
if (n < 1) throw Hermes::Exceptions::MeshLoadFailureException("File %s: no elements defined.", filename.c_str());
212212

213213
// create elements
214214
mesh->nactive = 0;
@@ -229,7 +229,7 @@ namespace Hermes
229229
if (nv < 4 || nv > 5)
230230
{
231231
delete[] idx;
232-
throw Hermes::Exceptions::MeshLoadFailureException("File %s: element #%d: wrong number of vertex indices.", filename, i);
232+
throw Hermes::Exceptions::MeshLoadFailureException("File %s: element #%d: wrong number of vertex indices.", filename.c_str(), i);
233233
}
234234

235235
if (nv == 4) {
@@ -251,7 +251,7 @@ namespace Hermes
251251
if (idx[j] < 0 || idx[j] >= mesh->ntopvert)
252252
{
253253
delete[] idx;
254-
throw Hermes::Exceptions::MeshLoadFailureException("File %s: error creating element #%d: vertex #%d does not exist.", filename, i, idx[j]);
254+
throw Hermes::Exceptions::MeshLoadFailureException("File %s: error creating element #%d: vertex #%d does not exist.", filename.c_str(), i, idx[j]);
255255
}
256256

257257
Node *v0 = &mesh->nodes[idx[0]], *v1 = &mesh->nodes[idx[1]], *v2 = &mesh->nodes[idx[2]];
@@ -293,7 +293,7 @@ namespace Hermes
293293

294294
en = mesh->peek_edge_node(v1, v2);
295295
if (en == nullptr)
296-
throw Hermes::Exceptions::MeshLoadFailureException("File %s: boundary data #%d: edge %d-%d does not exist", filename, i, v1, v2);
296+
throw Hermes::Exceptions::MeshLoadFailureException("File %s: boundary data #%d: edge %d-%d does not exist", filename.c_str(), i, v1, v2);
297297

298298
std::string bnd_marker;
299299
bnd_marker = m.bdy_type[i];
@@ -322,7 +322,7 @@ namespace Hermes
322322
if (m.n_curv > 0)
323323
{
324324
n = m.n_curv;
325-
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'curves' must be a list.", filename);
325+
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'curves' must be a list.", filename.c_str());
326326

327327
// load curved edges
328328
for (i = 0; i < n; i++)
@@ -351,7 +351,7 @@ namespace Hermes
351351
if (m.n_ref > 0)
352352
{
353353
n = m.n_ref;
354-
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'refinements' must be a list.", filename);
354+
if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'refinements' must be a list.", filename.c_str());
355355

356356
// perform initial refinements
357357
for (i = 0; i < n; i++)

0 commit comments

Comments
 (0)