[FFmpeg-devel] [PATCH] Fix printf usage in vhook

Benoit Fouet benoit.fouet
Fri Sep 5 13:12:45 CEST 2008


Hi,

JonY wrote:
> Benoit Fouet wrote:
>> Stefano Sabatini wrote:
>>> On date Friday 2008-09-05 09:46:20 +0200, Benoit Fouet encoded:
>>>
>>>> Hi,
>>>>
>>>> Stefano Sabatini wrote:
>>>>
>>>>> On date Friday 2008-09-05 09:14:41 +0800, JonY encoded:
>>>>>
>>>>> [...]
>>>>>
>>>>>
>>>>>
>>>>>> Index: libavutil/internal.h
>>>>>> ===================================================================
>>>>>> --- libavutil/internal.h    (revision 15214)
>>>>>> +++ libavutil/internal.h    (working copy)
>>>>>> @@ -242,7 +242,7 @@
>>>>>>   #define strcat
>>>>>> strcat_is_forbidden_due_to_security_issues_use_av_strlcat
>>>>>>   #undef  exit
>>>>>>   #define exit exit_is_forbidden
>>>>>> -#if !(defined(LIBAVFORMAT_BUILD) || defined(FFMPEG_FRAMEHOOK_H))
>>>>>> +#if !(defined(LIBAVFORMAT_BUILD) || defined(AVFORMAT_FRAMEHOOK_H))
>>>>>>   #undef  printf
>>>>>>   #define printf please_use_av_log
>>>>>>   #undef  fprintf
>>>>>>
>>>>>>
>>>>> That looks like an hack to quickly fix it, the correct solution seems
>>>>> to me to *not use* f?printf but av_log as in your previous patch (and
>>>>> #undef it when it is necessary to write to file), then maybe we can
>>>>> remove that ifdeffery.
>>>>>
>>>>>
>>>>>
>>>> anyway, if FFMPEG_FRAMEHOOK_H has been renamed to AVFORMAT_FRAMEHOOK_H
>>>> in the new multiple inclusions guard naming scheme, this should be
>>>> reflected in internal.h
>>>>
>>> Well we have two possible choices:
>>> 1) fix the header inclusion guard name in internal.h
>>> 2) #undef fprintf in those files which use it to print to file (rather
>>> than to log something, which was wrong and has already been fixed) and
>>> remove that condition from the directive in internal.h
>>>
>>> I have a *very* slightly preference for the second solution, but feel
>>> free to apply the first one as proposed by JonY if you prefer that.
>>>
>>>
>>
>> if there are no more reason to have a special case for framehook in
>> internal.h, I'm all for dropping FFMPEG_FRAMEHOOK_H reference from there
>> totally.
>>
>
> Patch OK?
> ------------------------------------------------------------------------
>
> Index: vhook/fish.c
> ===================================================================
> --- vhook/fish.c	(revision 15216)
> +++ vhook/fish.c	(working copy)
> @@ -48,6 +48,7 @@
>  #include "libavformat/framehook.h"
>  #include "libavcodec/dsputil.h"
>  #include "libswscale/swscale.h"
> +#undef fprintf
>  
>  static int sws_flags = SWS_BICUBIC;
>  
> Index: vhook/ppm.c
> ===================================================================
> --- vhook/ppm.c	(revision 15216)
> +++ vhook/ppm.c	(working copy)
> @@ -29,6 +29,7 @@
>  #include "libavformat/framehook.h"
>  #include "libavformat/avformat.h"
>  #include "libswscale/swscale.h"
> +#undef fprintf
>  
>  static int sws_flags = SWS_BICUBIC;
>  
> Index: libavutil/internal.h
> ===================================================================
> --- libavutil/internal.h	(revision 15216)
> +++ libavutil/internal.h	(working copy)
> @@ -242,7 +242,7 @@
>  #define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat
>  #undef  exit
>  #define exit exit_is_forbidden
> -#if !(defined(LIBAVFORMAT_BUILD) || defined(FFMPEG_FRAMEHOOK_H))
> +#if !defined(LIBAVFORMAT_BUILD)
>   

#ifndef
and it should be ok apart from that, unless somebody objects

-- 
Benoit Fouet
Purple Labs S.A.
www.purplelabs.com




More information about the ffmpeg-devel mailing list