Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
tarot
Commits
a1e56938
Commit
a1e56938
authored
Dec 14, 2019
by
Vivien Kraus
Browse files
Silence ubsan
parent
891ee8db
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libtarot/event/tarot/game_event_private_impl.h
View file @
a1e56938
...
...
@@ -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
)
{
memcpy
(
event
->
data
,
data
,
n
*
sizeof
(
*
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
;
}
memcpy
(
cards
,
event
->
data
+
start
,
max
*
sizeof
(
*
cards
));
if
(
max
!=
0
)
{
memcpy
(
cards
,
event
->
data
+
start
,
max
*
sizeof
(
*
cards
));
}
}
static
inline
TarotGameEventError
...
...
src/libtarot/game/tarot/game_private_impl.h
View file @
a1e56938
...
...
@@ -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
);
memcpy
(
dest
,
hand
->
buffer
+
start
,
max
*
sizeof
(
TarotCard
));
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
;
}
memcpy
(
bids
,
h
.
bids
->
bids
+
start
,
max
*
sizeof
(
TarotBid
));
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
;
}
memcpy
(
dog
,
buffer
+
start
,
max
*
sizeof
(
TarotCard
));
if
(
max
!=
0
)
{
memcpy
(
dog
,
buffer
+
start
,
max
*
sizeof
(
TarotCard
));
}
return
ret
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment