[vlc-devel] [PATCH] lua: work around 32-bit integers limitation in vlc.var
filip at atch.se
Tue Nov 29 02:01:57 CET 2016
On 2016-11-28 23:56, vlc-devel wrote:
> From: Pierre Ynard <linkfanel at yahoo.fr>
> To: vlc-devel at videolan.org
> > Using `sizeof` is not really what you want, you should compare the
> > *max*/*min* value of the two types in order to properly check if the
> > value will fit.
> > #if LUA_MININTEGER > INT64_MIN || LUA_MAXINTEGER < INT64_MAX
> > if( val.i_int < LUA_MININTEGER || val.i_int > LUA_MAXINTEGER )
> Lua provides no such macro or anything workable. As I said it would have
> to be added with autoconf, but in my opinion that's not worth it.
The above is not entirely true, but you are correct in that it is not
guaranteed to work for *VLC* (since we do not require `lua >= 5.3`).
Lua `5.3` defines `LUA_MININTEGER` and `LUA_MAXINTEGER`, and I
honestly assumed that it had been around longer than `5.3` (but this,
as you imply, is not the case).
There are *hacks* (with heavy emphasize on the usage of "hack") that
would allow for a middle-ground for what you and I want even for lua
`5.1`: though I will refrain from replying until I have explored some
I will try to come up with something that is not *too* bad during the
next few hours.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vlc-devel