[FFmpeg-devel] qt-faststart refactor exit code

Frank Barchard fbarchard
Tue Jun 30 18:53:11 CEST 2009


On Tue, Jun 30, 2009 at 8:09 AM, Diego Biurrun <diego at biurrun.de> wrote:

>
> I get a warning with gcc, this should be easy to trigger...
>

Thanks... I get it too.
C:\ffmpeg-mainline\tools>gcc -Wall qt-faststart.c
qt-faststart.c: In function 'main':
qt-faststart.c:133: warning: format '%I64d' expects type 'int', but argument
2 has type 'uint64_t'

gcc is confused about I64.  An ugly work around is to use %I64llu which
avoids the warning and runs correctly on MinGW.

// MinGW gcc 4.3 warning work around#ifdef __MINGW32__#undef
PRIu64#define PRIu64       "I64llu"#endif

*It is really a MinGW gcc issue and should be patched in inttypes,
printf or gcc.*

*-Wformat=0 will disable the warning.*

I agree a decimal would be more readable.  The version I submitted used 0x"
PRIX64, which is unsigned int and has 0x for hex notation.  The currently
committed one is PRId64, but still has 0x in the text and passes an
uint64_t.  I suggest removing 0x and changing to PRIu64.  To test the printf

ftyp_atom = 0;//malloc(ftyp_atom_size);if (!ftyp_atom) {
    printf ("could not allocate %"PRIu64" byte for ftyp atom\n",
     1234567890123456ULL+atom_size);

qt-faststart.exe mobile.mp4 bob.mov
could not allocate 1234567890123480 byte for ftyp atom

Here is the change (also attached)

Index: tools/qt-faststart.c
===================================================================
--- tools/qt-faststart.c        (revision 19309)
+++ tools/qt-faststart.c        (working copy)
@@ -129,7 +129,7 @@
             ftyp_atom_size = atom_size;
             ftyp_atom = malloc(ftyp_atom_size);
             if (!ftyp_atom) {
-                printf ("could not allocate 0x%"PRId64" byte for ftyp
atom\n",
+                printf ("could not allocate %"PRIu64" byte for ftyp
atom\n",
                         atom_size);
                 fclose(infile);
                 return 1;
@@ -170,7 +170,7 @@
     moov_atom_size = atom_size;
     moov_atom = malloc(moov_atom_size);
     if (!moov_atom) {
-        printf ("could not allocate 0x%"PRId64" byte for moov atom\n",
+        printf ("could not allocate %"PRIu64" byte for moov atom\n",
             atom_size);
         fclose(infile);
         return 1;



> > > > >
> > > > > Diego
> > > > > _______________________________________________
> > > > > ffmpeg-devel mailing list
> > > > > ffmpeg-devel at mplayerhq.hu
> > > > > https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> > > > >
> > >
> > > Please remove quoted text you do not reply to, thanks.
> > >
> > > Diego
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel at mplayerhq.hu
> > > https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> > >
>
> I asked you for something there, oh well...
>
> Diego
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt-faststart.diff
Type: application/octet-stream
Size: 899 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090630/36d14167/attachment.obj>



More information about the ffmpeg-devel mailing list