Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
uint32_t rle_packet_size = 1;
rle_packet_size += (src_ptr[0] & 0x80) ? bytes_per_pixel : (bytes_per_pixel * rle_count);
if ((rle_packet_size > src_bytes_left) || (pixel_count + rle_count) > row_width)
return D3DXERR_INVALIDDATA;
if (src_ptr[0] & 0x80)
{
uint32_t i;
for (i = 0; i < rle_count; ++i)
memcpy(&dst_row[(pixel_count + i) * bytes_per_pixel], src_ptr + 1, bytes_per_pixel);
}
else
{
memcpy(&dst_row[pixel_count * bytes_per_pixel], (src_ptr + 1), rle_packet_size - 1);
No need for parentheses around `src_ptr + 1`. Only mentioning it because in the `memcpy()` right above there are none...