[FFmpeg-devel] [PATCH] Make parse_date return INT64_MIN in case of unparsable input
Stefano Sabatini
stefano.sabatini-lala
Wed Sep 19 13:22:31 CEST 2007
On date Wednesday 2007-09-19 12:28:08 +0200, Michael Niedermayer encoded:
> Hi
>
> On Wed, Sep 19, 2007 at 11:27:39AM +0200, Stefano Sabatini wrote:
[...]
> > Index: libavformat/utils.c
> > ===================================================================
> > --- libavformat/utils.c (revision 10526)
> > +++ libavformat/utils.c (working copy)
> > @@ -2621,17 +2621,19 @@
> > if (!q) {
> > /* parse datestr as S+ */
> > dt.tm_sec = strtol(p, (char **)&q, 10);
> > + if (q == p) {
> > + /* set q to NULL to signal that the parsing didn't succeed */
> > + q = NULL;
> > + } else {
> > dt.tm_min = 0;
> > dt.tm_hour = 0;
> > + }
> > }
> > }
>
> instead of the if/else blah a simple
> if(q == p)
> return INT64_MIN;
>
> seems to be simpler
Fixed.
> [...]
> > +static void parse_time_or_die(int64_t *us, const char *timestr, int is_duration)
> > +{
> > + *us = parse_date(timestr, is_duration);
> > + if (*us == INT64_MIN) {
> > + fprintf(stderr, "Invalid %s specification: %s\n",
> > + is_duration ? "duration" : "date", timestr);
> > + exit(1);
> > + }
> > +}
>
> return us; would be cleaner IMHO
Fixed.
> and iam fine with the patch except these
[...]
Thanks all for your reviews, hopefully this will be the last one.
Regards.
--
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-parse-date-return-int64min-if-unparsable-input-07.patch
Type: text/x-diff
Size: 5441 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070919/5fd69053/attachment.patch>
More information about the ffmpeg-devel
mailing list