[FFmpeg-devel] qt-faststart refactor exit code

Baptiste Coudurier baptiste.coudurier
Tue Jun 30 01:49:54 CEST 2009


Frank Barchard wrote:
> On Mon, Jun 29, 2009 at 3:24 PM, Diego Biurrun <diego at biurrun.de> wrote:
> 
>> On Mon, Jun 29, 2009 at 03:15:45PM -0700, Frank Barchard wrote:
>>> On Mon, Jun 29, 2009 at 2:52 PM, Diego Biurrun <diego at biurrun.de> wrote:
>>>
>>>> On Mon, Jun 29, 2009 at 01:51:03PM -0700, Frank Barchard wrote:
>>>>> Also note theres a minor bug with the existing code using %llx.
>>>>> I deferred fixing it, as y'all seem to prefer separate submissions
>>>>> for each fix.
>>>> Sounds like something I could apply right away...
>>> okay, I'm getting faster at these diffs.  The old code used %llX, which
>>> doesnt work properly on MinGW.  It also assumes long long is int64, which
>>> isn't guaranteed on all future compilers.  Standard GCC C99 inttypes.h
>>> provides
>>> #define PRIX64 "llX"
>>> and maps to MinGW
>>> #define PRIX64 "I64X"
>>>
>>> Only 2 lines are affected, so heres the change:
>>>
>>> --- tools/qt-faststart.orig.c   2009-05-07 21:41:30.000000000 -0700
>>> +++ tools/qt-faststart.llx.c    2009-06-29 15:11:42.968285000 -0700
>> That does not apply cleanly at all.  Also, your patch is mangled.
> 
> 
> Sorry about the newbie mistakes.  I was diff-ing from a git branch.
> This time I did this
> svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg_mainline
> svn diff -x -w tools/qt-faststart.c >faststart.diff
> and tested by doing this
> patch -p0 <faststart.diff
> 
> 
>>
>>> @@ -170,7 +170,7 @@ int main(int argc, char *argv[])
>>>      moov_atom_size = atom_size;
>>>      moov_atom = malloc(moov_atom_size);
>>>      if (!moov_atom) {
>>> -        printf ("could not allocate 0x%llX byte for moov atom\n",
>>> +        printf ("could not allocate 0x" PRIX64 "X byte for moov atom\n",
>> This is not correct, the '%' is gone..
>>
> 
> doh!  Fixed.  Hard to test, since it only happens errors.   I tried it with
> a 4 compilers and ran it, but the error doesnt normally come up.  By forcing
> malloc to fail I confirmed the printf with PRIX64 works:
> qt-faststart.exe bali.mov bob.mov
> could not allocate 0x18 byte for ftyp atom
> qt-faststart.exe bali.mov bob.mov
> could not allocate 0x201AB byte for moov atom

Code IMHO should be using PRId64 here, size is better in decimal.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list