> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of Marton
> Balint
> Sent: Samstag, 14. Juni 2025 17:35
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc: Fix path
> handling for Windows
> 
> On Fri, 13 Jun 2025, softworkz . wrote:
> 
> >> -----Original Message-----
> >> From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of
> >> Marton Balint
> >> Sent: Freitag, 13. Juni 2025 23:36
> >> To: FFmpeg development discussions and patches <ffmpeg-
> >> de...@ffmpeg.org>
> >> Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/hlsenc: Fix path
> >> handling for Windows
> >>
> >> On Fri, 13 Jun 2025, softworkz wrote:
> >>
> >>> From: softworkz <softwo...@hotmail.com>
> >>
> >> Can you give an example where the path handling is wrong and where
> >> this
> >> patch fixes it?
> >
> > c:\hls\video1\master.m3u8
> 
> What I meant is that you should try to explain "fix" better in the
> commit message, like:
> 
> When base_output_dirname was determined only '/' was searched for as
> path separator. get_relative_url() on the other hand searched for both
> forward and backward slash regardless of OS.
> 
> Fix these issues by factorizing the separator finder function, only
> search
> for backslash for Windows/DOS and use that in both places.



Hi Marton,

thanks for the nice message, applied in v3.

> >> Is there a trac ticket?
> >
> > Good question, there well may be.

(The reason for the dumb answer was trac being inaccessible on that
day, but I wasn't sure about it while writing)


> Its worth doing a quick search, if there is one you might want to
> reference it in the commit message.

Did a search today for hlsenc, hls, windows, path, slash, backslash in 
various combinations but couldn't find anything.



> >>> Signed-off-by: softworkz <softwo...@hotmail.com>
> >>> ---
> >>> libavformat/hlsenc.c | 43 ++++++++++++++++++++++++++++-----------
> >> ----
> >>> 1 file changed, 28 insertions(+), 15 deletions(-)
> >>>
> >>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> >>> index f81385d0b4..ba1e74e999 100644
> >>> --- a/libavformat/hlsenc.c
> >>> +++ b/libavformat/hlsenc.c
> >>> @@ -329,6 +329,23 @@ static int hlsenc_io_close(AVFormatContext
> >> *s, AVIOContext **pb, char *filename)
> >>>     return ret;
> >>> }
> >>>
> >>> +static int get_last_separator_pos(const char *path)
> >>
> >> size_t
> >
> > Cannot return -1.
> 
> Indeed, actually ptrdiff_t would be the proper type.

Ah sure, updated in v3.



> >>> +{
> >>> +    if (!path || *path == '\0')
> >>> +        return -1;
> >>> +
> >>> +    char *p = strrchr(path, '/');
> >>> +#if HAVE_DOS_PATHS
> >>> +    char *q = strrchr(path, '\\');
> >>> +    p = FFMAX(p, q);
> >>
> >> You are comparing potentially NULL pointers here.
> >
> >
> > It's the same like in av_basename() or av_dirname()
> 
> And those are likely wrong too.

Okay. I've added conditions to only compare non-null pointers.


Will post v3 in a moment.

Thank you,
sw


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to