[FFmpeg-devel] [PATCH] ffprobe: Eliminate pointless union in unit_value struct

Stefano Sabatini stefasab at gmail.com
Thu Sep 13 09:02:19 CEST 2012


On date Wednesday 2012-09-12 14:48:30 -0400, Derek Buitenhuis encoded:
> On 12/09/2012 1:45 PM, Stefano Sabatini wrote:
> >> There is no point to this union, as even if it is passed an integer,
> >> it is immediately put into a double anyway, inside the only function
> >> that uses it.
> > 
> > The idea was to avoid potentially lossy casts (double->int).
> 
> It got cast anyway, though.
> 
> > Do you have a specific reason to apply this patch (e.g. get rid of the
> > union)?
> > 
> > Otherwise I could rework the code in order to avoid the silly
> > int->int->double path.
> 
> The c99-to-c89 converter (for MSVC support) doesn't currently handle designated
> initializers or compound literals with nested unions or structs, e.g:
> 
> someType var = { .first.seconed = 0 };
> 
> This is the only place it occurs in FFmpeg, and is one of the last things that needs
> to be done for MSVC support. Since this union didn't actually -do- anything, I thought
> it'd be easier to remove it properly. If it does have some actual use after a future
> patch, we can hold MSVC support until the converter gets support for it, or just disable
> ffprobe when building for MSVC.

Check attached patches.
-- 
FFmpeg = Fast & Fanciful Monstrous Political Eretic Game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ffprobe-avoid-potentially-lossy-long-long-int-double.patch
Type: text/x-diff
Size: 1542 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120913/059d354a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-ffprobe-kill-initializer-with-nested-union-field-def.patch
Type: text/x-diff
Size: 2187 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120913/059d354a/attachment-0001.bin>


More information about the ffmpeg-devel mailing list