Commit a1e56938 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Silence ubsan

parent 891ee8db
......@@ -31,7 +31,10 @@ event_size (size_t n_data)
static inline void
event_copy_data (TarotGameEvent * event, size_t n, const unsigned int *data)
{
if (n != 0)
{
memcpy (event->data, data, n * sizeof (*data));
}
event->n = n;
}
......@@ -416,7 +419,10 @@ event_get_data (const TarotGameEvent * event, size_t *n, size_t start,
{
max = event->n;
}
if (max != 0)
{
memcpy (cards, event->data + start, max * sizeof (*cards));
}
}
static inline TarotGameEventError
......
......@@ -680,7 +680,10 @@ query_hand (const TarotHand * hand, size_t *n, size_t start, size_t max,
}
*n = n_available;
assert (start + max <= n_available);
if (max != 0)
{
memcpy (dest, hand->buffer + start, max * sizeof (TarotCard));
}
}
static inline TarotGameError
......@@ -774,7 +777,10 @@ game_get_bids (const TarotGame * game, size_t *n, TarotPlayer start,
{
max = *n - start;
}
if (max != 0)
{
memcpy (bids, h.bids->bids + start, max * sizeof (TarotBid));
}
ret = TAROT_GAME_OK;
}
return ret;
......@@ -2403,7 +2409,10 @@ game_can_autoreveal (const TarotGame * game, size_t *n_dog, size_t start,
{
max = n - start;
}
if (max != 0)
{
memcpy (dog, buffer + start, max * sizeof (TarotCard));
}
return ret;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment