[FFmpeg-devel] [PATCH v2 1/4] avutil/avstring: support input path is a null pointer or empty string

Limin Wang lance.lmwang at gmail.com
Tue Sep 17 04:21:37 EEST 2019


On Mon, Sep 16, 2019 at 09:30:15PM +0200, Michael Niedermayer wrote:
> On Mon, Sep 16, 2019 at 07:25:13PM +0800, lance.lmwang at gmail.com wrote:
> > From: Limin Wang <lance.lmwang at gmail.com>
> > 
> > Reviewed-by: Tomas Härdin <tjoppen at acc.umu.se>
> > Reviewed-by: Liu Steven <lq at chinaffmpeg.org>
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> >  libavutil/avstring.c | 12 ++++++++----
> >  libavutil/avstring.h | 13 +++++++++----
> >  2 files changed, 17 insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavutil/avstring.c b/libavutil/avstring.c
> > index 4c068f5bc5..551ca5daee 100644
> > --- a/libavutil/avstring.c
> > +++ b/libavutil/avstring.c
> > @@ -257,8 +257,12 @@ char *av_strireplace(const char *str, const char *from, const char *to)
> >  
> >  const char *av_basename(const char *path)
> >  {
> > -    char *p = strrchr(path, '/');
> > +    char *p = NULL;
> 
> the NULL assignment is unneeded
Yes, it's unneeded, I will remove it.

> 
> 
> > +
> > +    if (!path || *path == '\0')
> > +        return ".";
> >  
> > +    p = strrchr(path, '/');
> 
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list