Repository navigation
Preclude C-style arrays - #3251
Conversation
Conflicts: cpp/core/dwi/tractography/GT/particlegrid.cpp cpp/core/dwi/tractography/GT/particlegrid.h
Conflicts: cpp/cmd/sh2peaks.cpp
| points.resize(3 * number_of_points); | ||
| input.read((char *)points.data(), 3 * number_of_points * sizeof(float)); | ||
| input.read(reinterpret_cast<char *>(points.data()), | ||
| 3UL * static_cast<unsigned long>(number_of_points) * sizeof(float)); |
There was a problem hiding this comment.
warning: narrowing conversion from 'unsigned long' to signed type 'streamsize' (aka 'long') is implementation-defined [bugprone-narrowing-conversions]
3UL * static_cast<unsigned long>(number_of_points) * sizeof(float));
^| for (size_t neighbour_index = 0; neighbour_index != 8; ++neighbour_index) { | ||
| assign_pos_of(lower_corner + neighbour_offsets[neighbour_index]).to(voxel); | ||
| in_vertex_values[neighbour_index] = 0.0f; | ||
| in_vertex_values[neighbour_index] = 0.0F; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
in_vertex_values[neighbour_index] = 0.0F;
^| const uint32_t indices[3]{edge_to_output_vertex[*first_edge], | ||
| edge_to_output_vertex[*(first_edge + 2)], | ||
| edge_to_output_vertex[*(first_edge + 1)]}; | ||
| const auto &row = cube_triangle_table[code]; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
const auto &row = cube_triangle_table[code];
^| edge_to_output_vertex[*(first_edge + 1)]}; | ||
| const auto &row = cube_triangle_table[code]; | ||
| for (ssize_t first_edge_index = 0; row[first_edge_index] >= 0; first_edge_index += 3) { | ||
| const std::array<uint32_t, 3> indices{edge_to_output_vertex[row[first_edge_index]], |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
const std::array<uint32_t, 3> indices{edge_to_output_vertex[row[first_edge_index]],
^| const auto &row = cube_triangle_table[code]; | ||
| for (ssize_t first_edge_index = 0; row[first_edge_index] >= 0; first_edge_index += 3) { | ||
| const std::array<uint32_t, 3> indices{edge_to_output_vertex[row[first_edge_index]], | ||
| edge_to_output_vertex[row[first_edge_index + 2]], |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
edge_to_output_vertex[row[first_edge_index + 2]],
^| int font_width[256], font_height; | ||
| float font_tex_pos[256], font_tex_width[256]; | ||
| std::array<int, 256> font_width; | ||
| int font_height; |
There was a problem hiding this comment.
warning: member variable 'font_height' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
int font_height;
^| float font_tex_pos[256], font_tex_width[256]; | ||
| std::array<int, 256> font_width; | ||
| int font_height; | ||
| std::array<float, 256> font_tex_pos; |
There was a problem hiding this comment.
warning: member variable 'font_tex_pos' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<float, 256> font_tex_pos;
^| std::array<int, 256> font_width; | ||
| int font_height; | ||
| std::array<float, 256> font_tex_pos; | ||
| std::array<float, 256> font_tex_width; |
There was a problem hiding this comment.
warning: member variable 'font_tex_width' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<float, 256> font_tex_width;
^|
|
||
| protected: | ||
| GLfloat v[4]; | ||
| std::array<GLfloat, 4> v; |
There was a problem hiding this comment.
warning: member variable 'v' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<GLfloat, 4> v;
^|
|
||
| protected: | ||
| GLfloat m[16]; | ||
| std::array<GLfloat, 16> m; |
There was a problem hiding this comment.
warning: member variable 'm' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<GLfloat, 16> m;
^| protected: | ||
| GL::mat4 MV, iMV, P, iP, MVP, iMVP; | ||
| GLint viewport[4]; | ||
| std::array<GLint, 4> viewport; |
There was a problem hiding this comment.
warning: member variable 'viewport' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<GLint, 4> viewport;
^|
|
||
| protected: | ||
| GLuint index[3]; | ||
| std::array<GLuint, 3> index; |
There was a problem hiding this comment.
warning: member variable 'index' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<GLuint, 3> index;
^|
|
||
| protected: | ||
| GLuint index[3]; | ||
| std::array<GLuint, 3> index; |
There was a problem hiding this comment.
warning: member variable 'index' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::array<GLuint, 3> index;
^
Further extension of #3212.
Closes #3240.
There was a comment in #2665 that it would be preferable to avoid the use of C-style arrays, and it immediately occurred to me that we should be able to enforce this; as noted in #3243 this may not be an optimal solution, but it's possible, and I was having fun with regexes.
Note that there's a somewhat unrelated change hidden in here:
sh2peakswas using its own direction set, and in trying to refactor for this change it was vastly easier to instead make use of the internally-defined set. But this does mean that there's scope for the outcomes of that command to change; and also it may not be terribly discoverable being part of this PR. So it might be safer for me to create that in a standalone PR.