From 4664128c23589a16cd64588b19a9d5cf19a6063d Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 17 May 2018 17:59:00 -0400 Subject: [PATCH] Change some dereferences to pointer arithmetic. This avoids dereferencing (and then calculating the address of) an entry one past the end. --- source/grid/grid_tools.cc | 2 +- tests/manifold/transfinite_manifold_07.cc | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) 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; -- 2.39.5