[FFmpeg-devel] [PATCH] av_register_all not always initializes correctly

Michael Niedermayer michaelni
Thu Jan 3 11:59:26 CET 2008


On Thu, Jan 03, 2008 at 06:24:19AM -0300, Gonzalo Garramu?o wrote:
> This patch also effects ffplay.c and ffmpeg.c, where someone seems to have 
> compensated for this bug by needlessly adding:
>
>     avcodec_register_all();
>
> which is also done inside av_register_all.
>
> There's a similar problem with another static inited variable in 
> imgconvert, but my imgconvert.c is now a tad hosed to create a patch for 
> it.
[...]
> Index: allformats.c
> ===================================================================
> --- allformats.c	(revision 11366)
> +++ allformats.c	(working copy)
> @@ -40,7 +40,7 @@
>   */
>  void av_register_all(void)
>  {
> -    static int inited;
> +    static int inited = 0;

quoting the C spec

If an object that has static storage duration is not initialized explicitly,
then:
 if it has pointer type, it is initialized to a null pointer;
 if it has arithmetic type, it is initialized to (positive or unsigned) zero;
 if it is an aggregate, every member is initialized (recursively) according to these rules;
 if it is a union, the first named member is initialized (recursively) according to these
    rules.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080103/eb37096b/attachment.pgp>



More information about the ffmpeg-devel mailing list