From: Soft Works <softworkz@hotmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Fix path handling on Windows Date: Sat, 15 Jan 2022 07:30:28 +0000 Message-ID: <DM8P223MB036585B9D42D2ADF3FBB53FABA559@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AM7PR03MB66603F521BB0591EF4B0499A8F559@AM7PR03MB6660.eurprd03.prod.outlook.com> > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Andreas > Rheinhardt > Sent: Saturday, January 15, 2022 7:40 AM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Fix path handling on > Windows > > ffmpegagent: > > From: softworkz <softworkz@hotmail.com> > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > --- > > avformat/hlsenc: Fix path handling on Windows > > > > Handling for DOS path separators was missing > > > > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr- > ffstaging-19%2Fsoftworkz%2Fsubmit_hlspath-v1 > > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging- > 19/softworkz/submit_hlspath-v1 > > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/19 > > > > libavformat/hlsenc.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > > index ef8973cea1..eff7f4212e 100644 > > --- a/libavformat/hlsenc.c > > +++ b/libavformat/hlsenc.c > > @@ -3028,6 +3028,10 @@ static int hls_init(AVFormatContext *s) > > } > > > > p = strrchr(vs->m3u8_name, '/'); > > +#if HAVE_DOS_PATHS > > + p = FFMAX(p, strrchr(vs->m3u8_name, '\\')); > > +#endif > > + > > if (p) { > > char tmp = *(++p); > > *p = '\0'; > > > > base-commit: c936c319bd54f097cc1d75b1ee1c407d53215d71 > > > Thanks for reviewing. > 1. You seem to be under the impression that NULL <= all other pointers. > This is wrong. Relational operators acting on pointers are only defined > when both point to the same object (the case of "one past the last > element of an array" is also allowed) and are undefined behaviour otherwise. The case about NULL is interesting - I wasn't aware of that. Is it practically relevant, i.e. is there any platform where casting (void *)0 does not evaluate to 0 ? > 2. Apart from that: Your code would potentially evaluate strrchr() > multiple times which is bad style (given that this function is likely > marked as pure the compiler could probably optimize the second call > away, but this is not a given). It's not my code. It's code copied from avstring.c - so please blame whoever that wrote. Regarding performance, I'm not sure whether this is relevant in any way, given the low frequency of execution and putting it into relation to all the other things that ffmpeg is doing usually. > 3. The code in av_basename() is also wrong. ... > 4. Is there actually a reason why you don't use av_basename() directly here? Yes, multiple: 1. Different behavior - those functions are returning a "." when not found 2. The docs tell it's required to copy a string before supplying it to those functions (as they may changing the string). 3. The hlsenc code changes the string temporarily and restores it after wards. The same couldn't be done when using the avstring functions. Thanks, softworkz _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-01-15 7:30 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-15 2:23 ffmpegagent 2022-01-15 6:40 ` Andreas Rheinhardt 2022-01-15 7:30 ` Soft Works [this message] 2022-01-15 18:33 ` Andreas Rheinhardt 2022-01-15 21:17 ` Soft Works 2022-01-15 21:28 ` Soft Works 2022-01-15 21:45 ` Andreas Rheinhardt 2022-01-15 22:29 ` Soft Works
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DM8P223MB036585B9D42D2ADF3FBB53FABA559@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM \ --to=softworkz@hotmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git