From: David Wells Date: Thu, 17 May 2018 21:59:00 +0000 (-0400) Subject: Change some dereferences to pointer arithmetic. X-Git-Tag: v9.1.0-rc1~1132^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4664128c23589a16cd64588b19a9d5cf19a6063d;p=dealii.git Change some dereferences to pointer arithmetic. This avoids dereferencing (and then calculating the address of) an entry one past the end. --- diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 025e8b63b6..05c4d26961 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -2269,7 +2269,7 @@ next_cell: const unsigned int local_pos_recv = vertices_recv_buffers[i][2*j]; const types::global_vertex_index global_id_recv = vertices_recv_buffers[i][2*j+1]; const std::string cellid_recv(&cellids_recv_buffers[i][max_cellid_size*j], - &cellids_recv_buffers[i][max_cellid_size*(j+1)]); + &cellids_recv_buffers[i][max_cellid_size*j] + max_cellid_size); bool found = false; typename std::set::iterator cell_set_it = missing_vert_cells.begin(), diff --git a/tests/manifold/transfinite_manifold_07.cc b/tests/manifold/transfinite_manifold_07.cc index fe5687f580..f6e634fd5e 100644 --- a/tests/manifold/transfinite_manifold_07.cc +++ b/tests/manifold/transfinite_manifold_07.cc @@ -227,9 +227,7 @@ void concentric_disks(Triangulation<2> &tria, cell_idx++; } - tria.create_triangulation(std::vector>(&vertices[0], &vertices[n_vert]), - cells, - SubCellData()); // no boundary information + tria.create_triangulation(vertices, cells, SubCellData()); // no boundary information double eps = 1e-5 * x[0]; unsigned int label = 100;