Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
On Fri, May 04, 2012 at 01:03:22PM -0400, Sean McGovern wrote: > On Friday, May 4, 2012, Diego Biurrun wrote: > > On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: > >> On 4/26/12, Sean McGovern wrote: > >> > --- > >> > tests/rotozoom.c | 15 --- > >> > tests/videogen.c | 15 --- > >> > 2 files changed, 24 insertions(+), 6 deletions(-) > >> > > >> > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > >> > index 9ce45cd..d9cfb42 100644 > >> > --- a/tests/rotozoom.c > >> > +++ b/tests/rotozoom.c > >> > >> Ping. > > > > The patch is good, I could queue it tomorrow. It does, however, conflict > > with the code duplication refactoring patch I just sent for these > programs. > > > > Applying your patch on top of mine would be somewhat more elegant and > > simple. > > I have no problem with depending on your patch. Do you need me to rebase or > can you do that? I'll push my patch in a moment and then try to rebase yours on top of mine in the next days. If you want to beat me to it, feel free... Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
On Friday, May 4, 2012, Diego Biurrun wrote: > On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: >> On 4/26/12, Sean McGovern wrote: >> > --- >> > tests/rotozoom.c | 15 --- >> > tests/videogen.c | 15 --- >> > 2 files changed, 24 insertions(+), 6 deletions(-) >> > >> > diff --git a/tests/rotozoom.c b/tests/rotozoom.c >> > index 9ce45cd..d9cfb42 100644 >> > --- a/tests/rotozoom.c >> > +++ b/tests/rotozoom.c >> >> Ping. > > The patch is good, I could queue it tomorrow. It does, however, conflict > with the code duplication refactoring patch I just sent for these programs. > > Applying your patch on top of mine would be somewhat more elegant and > simple. Hi Diego, I have no problem with depending on your patch. Do you need me to rebase or can you do that? -- Sean McG. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: > On 4/26/12, Sean McGovern wrote: > > --- > > tests/rotozoom.c | 15 --- > > tests/videogen.c | 15 --- > > 2 files changed, 24 insertions(+), 6 deletions(-) > > > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > > index 9ce45cd..d9cfb42 100644 > > --- a/tests/rotozoom.c > > +++ b/tests/rotozoom.c > > Ping. The patch is good, I could queue it tomorrow. It does, however, conflict with the code duplication refactoring patch I just sent for these programs. Applying your patch on top of mine would be somewhat more elegant and simple. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
On 4/26/12, Sean McGovern wrote: > --- > tests/rotozoom.c | 15 --- > tests/videogen.c | 15 --- > 2 files changed, 24 insertions(+), 6 deletions(-) > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > index 9ce45cd..d9cfb42 100644 > --- a/tests/rotozoom.c > +++ b/tests/rotozoom.c Ping. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
On Wed, Apr 25, 2012 at 07:03:47PM -0400, Sean McGovern wrote: > > --- a/tests/rotozoom.c > +++ b/tests/rotozoom.c > @@ -23,10 +23,21 @@ > > +static void check_result(size_t size) > +{ > +if(errno) > +{ For future reference: This is not K&R style, check out the relevant section in the developer docs again, it should be if (...) { Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite()
Sean McGovern writes: > --- > tests/rotozoom.c | 17 ++--- > tests/videogen.c | 17 ++--- > 2 files changed, 28 insertions(+), 6 deletions(-) > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > index 9ce45cd..eea67c3 100644 > --- a/tests/rotozoom.c > +++ b/tests/rotozoom.c > @@ -23,10 +23,21 @@ > #include > #include > #include > +#include > +#include > > #define FIXP (1 << 16) > #define MY_PI 205887 // (M_PI * FIX) > > +static void check_result(size_t size) > +{ > +if(errno) POSIX functions only set errno if there was an error. > +{ > +fprintf(stderr, strerror(errno)); I believe this will give some kind of warning about the format string with some gcc versions. It is also missing a newline. It's better to use a "%s\n" format. > +exit(-1); exit() it typically called with a small positive number (usually 1) on failure. The exit status of the process is the low 8 bits of this value. > +} > +} Here's an untested idea for a generic error checker: #define err_if(expr) do { \ if (expr) { \ fprintf(stderr, "%s\n", strerror(errno)); \ exit(1); \ } \ } while (0) To be used like this: err_if(fwrite(buf, size, n, file) != n); -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel