From f824cccac7311647a8bd22d193d3aac2b961a1dd Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 18 Nov 2019 12:07:36 +0200 Subject: fbs: use std::array and .at() Use std::array and .at() to get bounds checking. Signed-off-by: Tomi Valkeinen --- kms++/src/dmabufframebuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kms++/src/dmabufframebuffer.cpp') diff --git a/kms++/src/dmabufframebuffer.cpp b/kms++/src/dmabufframebuffer.cpp index feac116..d36eb89 100644 --- a/kms++/src/dmabufframebuffer.cpp +++ b/kms++/src/dmabufframebuffer.cpp @@ -32,7 +32,7 @@ DmabufFramebuffer::DmabufFramebuffer(Card& card, uint32_t width, uint32_t height throw std::invalid_argument("the size of fds, pitches and offsets has to match number of planes"); for (int i = 0; i < format_info.num_planes; ++i) { - FramebufferPlane& plane = m_planes[i]; + FramebufferPlane& plane = m_planes.at(i); plane.prime_fd = fds[i]; @@ -65,7 +65,7 @@ DmabufFramebuffer::~DmabufFramebuffer() uint8_t* DmabufFramebuffer::map(unsigned plane) { - FramebufferPlane& p = m_planes[plane]; + FramebufferPlane& p = m_planes.at(plane); if (p.map) return p.map; @@ -80,7 +80,7 @@ uint8_t* DmabufFramebuffer::map(unsigned plane) int DmabufFramebuffer::prime_fd(unsigned plane) { - FramebufferPlane& p = m_planes[plane]; + FramebufferPlane& p = m_planes.at(plane); return p.prime_fd; } -- cgit v1.2.3