prefixed members rows and cols with m_ to avoid -Wshadow

This commit is contained in:
Erik Frojdh
2024-03-08 15:23:38 +01:00
parent dec072c090
commit e8f81e618d
3 changed files with 30 additions and 29 deletions

View File

@ -3,20 +3,19 @@
template <typename DataType>
Frame<DataType>::Frame(std::byte* bytes, ssize_t rows, ssize_t cols):
rows(rows), cols(cols) {
data = new DataType[rows*cols];
std::memcpy(data, bytes, rows*cols*sizeof(DataType));
m_rows(rows), m_cols(cols) {
m_data = new DataType[rows*cols];
std::memcpy(m_data, bytes, m_rows*m_cols*sizeof(DataType));
}
template <typename DataType>
DataType Frame<DataType>::get(int row, int col) {
if (row < 0 || row >= rows || col < 0 || col >= cols) {
if (row < 0 || row >= m_rows || col < 0 || col >= m_cols) {
std::cerr << "Invalid row or column index" << std::endl;
return 0;
}
return data[row*cols + col];
return m_data[row*m_cols + col];
}