Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
matteodelabre committed Apr 23, 2021
1 parent 1a2f89c commit 93fea07
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "../rmioc/screen.hpp"
#include <algorithm>
#include <chrono>
#include <climits>
#include <cstring>
#include <ostream>
#include <stdexcept>
Expand Down Expand Up @@ -189,17 +190,20 @@ void screen::recv_update(
return;
}

std::size_t pixel_size = that->device.get_bits_per_pixel() / 8;
std::size_t pixel_size = that->device.get_bits_per_pixel() / CHAR_BIT;

std::size_t dest_stride = that->device.get_xres_memory() * pixel_size;
std::size_t dest_size = dest_stride * that->device.get_yres_memory();
uint8_t* const dest = that->device.get_data();

// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
uint8_t* dest_line = dest + y * dest_stride + x * pixel_size;

std::size_t buffer_stride = w * pixel_size;
std::size_t buffer_size = buffer_stride * h;
const uint8_t* buffer_line = buffer;

// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
while (dest_line < dest + dest_size && buffer_line < buffer + buffer_size)
{
std::memcpy(
Expand All @@ -208,7 +212,10 @@ void screen::recv_update(
std::min(dest_stride - x * pixel_size, buffer_stride)
);

// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
dest_line += dest_stride;

// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
buffer_line += buffer_stride;
}
}
Expand Down

0 comments on commit 93fea07

Please sign in to comment.