mirror of
https://github.com/mpv-player/mpv
synced 2025-01-08 16:10:29 +00:00
client API: allow returning float properties as integers
I'm starting to think that being type-strict with this interface actually sucks. This commit is a step towards being less strict.
This commit is contained in:
parent
596231bc97
commit
5bddff6a24
@ -723,6 +723,10 @@ static bool conv_node_to_format(void *dst, mpv_format dst_fmt, mpv_node *src)
|
||||
*(double *)dst = src->u.int64;
|
||||
return true;
|
||||
}
|
||||
if (dst_fmt == MPV_FORMAT_INT64 && src->format == MPV_FORMAT_DOUBLE) {
|
||||
if (src->u.double_ >= INT64_MIN && src->u.double_ <= INT64_MAX)
|
||||
*(int64_t *)dst = src->u.double_;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user