Przeglądaj źródła

Fix compilation warnings about using memcpy with our maths vector types.

legacy
Sam Hocevar 6 lat temu
rodzic
commit
a0a5fa0342
4 zmienionych plików z 10 dodań i 10 usunięć
  1. +5
    -5
      src/image/codec/oric-image.cpp
  2. +1
    -1
      src/image/kernel.cpp
  3. +2
    -2
      src/image/resample.cpp
  4. +2
    -2
      src/tileset.cpp

+ 5
- 5
src/image/codec/oric-image.cpp Wyświetl plik

@@ -338,7 +338,7 @@ static uint8_t bestmove(ivec3 const *in, u8vec2 bgfg,

int besterror = 0x7ffffff;
uint8_t bestcommand = 0x10;
memcpy(bestrgb, nop_rgb, sizeof(bestrgb));
memcpy((void *)bestrgb, nop_rgb, sizeof(bestrgb));

for (uint8_t command : command_list)
{
@@ -461,13 +461,13 @@ static uint8_t bestmove(ivec3 const *in, u8vec2 bgfg,
{
besterror = curerror + suberror;
bestcommand = command;
memcpy(bestrgb, rgb, sizeof(bestrgb));
memcpy((void *)bestrgb, rgb, sizeof(bestrgb));
}
}

*error = besterror;
if (out)
memcpy(out, bestrgb, sizeof(bestrgb));
memcpy((void *)out, bestrgb, sizeof(bestrgb));

return bestcommand;
}
@@ -483,8 +483,8 @@ void OricImageCodec::WriteScreen(image &img, array<uint8_t> &result)
src.resize(size + ivec2(1));
dst.resize(size + ivec2(1));

memset(src.data(), 0, src.bytes());
memset(dst.data(), 0, dst.bytes());
memset((void *)src.data(), 0, src.bytes());
memset((void *)dst.data(), 0, dst.bytes());

/* Import pixels into our custom format */
for (int y = 0; y < size.y; y++)


+ 1
- 1
src/image/kernel.cpp Wyświetl plik

@@ -131,7 +131,7 @@ array2d<float> image::kernel::blue_noise(ivec2 size, ivec2 gsize)

/* Generate an array with about 10% random dots */
int const ndots = (size.x * size.y + 9) / 10;
memset(dots.data(), 0, dots.bytes());
memset((void *)dots.data(), 0, dots.bytes());
for (int n = 0; n < ndots; )
{
ivec2 pos(lol::rand(size.x), lol::rand(size.y));


+ 2
- 2
src/image/resample.cpp Wyświetl plik

@@ -148,13 +148,13 @@ static image ResizeBresenham(image &src, ivec2 size)
array<vec4> aline, line;
aline.resize(size.x);
line.resize(size.x);
memset(line.data(), 0, line.bytes());
memset((void *)line.data(), 0, line.bytes());

int remy = 0;

for (int y = 0, y0 = 0; y < size.y; y++)
{
memset(aline.data(), 0, aline.bytes());
memset((void *)aline.data(), 0, aline.bytes());

for (int toty = 0; toty < oldsize.y; )
{


+ 2
- 2
src/tileset.cpp Wyświetl plik

@@ -250,8 +250,8 @@ void TileSet::BlitTile(uint32_t id, mat4 model, vec3 *vertex, vec2 *texture)
}
else
{
memset(vertex, 0, 6 * sizeof(vec3));
memset(texture, 0, 6 * sizeof(vec2));
memset((void *)vertex, 0, 6 * sizeof(vec3));
memset((void *)texture, 0, 6 * sizeof(vec2));
}
}



Ładowanie…
Anuluj
Zapisz