Re: [FFmpeg-devel] [PATCH 2/2] lavf/dashenc: Use avpriv_io_delete to delete files.

2018-11-29 Thread Jeyapal, Karthick

On 11/29/18 11:48 PM, Andrey Semashev wrote:
> This fixes incorrect handling of file URIs (i.e. when the filename starts
> with "file:", possibly followed by URI authority).
> ---
>  libavformat/dashenc.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 6ce70e0076..426dc91bcc 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -25,6 +25,7 @@
>  #include 
>  #endif
>  
> +#include "libavutil/error.h"
I guess this include is redundant. error.h is already included from avutil.h. I 
don't know the ffmpeg coding policy for such redundant includes. 
But in case the coding policy mandates you include it, I would suggest you add 
this include after "libavutil/avstring.h" so that the alphabetical order is 
maintained.
Apart from this minor issue the patch looks fine.
>  #include "libavutil/avassert.h"
>  #include "libavutil/avutil.h"
>  #include "libavutil/avstring.h"
> @@ -1326,8 +1327,13 @@ static void dashenc_delete_file(AVFormatContext *s, 
> char *filename) {
>  
>  av_dict_free(_opts);
>  ff_format_io_close(s, );
> -} else if (unlink(filename) < 0) {
> -av_log(s, AV_LOG_ERROR, "failed to delete %s: %s\n", filename, 
> strerror(errno));
> +} else {
> +int res = avpriv_io_delete(filename);
> +if (res < 0) {
> +char errbuf[AV_ERROR_MAX_STRING_SIZE];
> +av_strerror(res, errbuf, sizeof(errbuf));
> +av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : 
> AV_LOG_ERROR), "failed to delete %s: %s\n", filename, errbuf);
> +}
>  }
>  }
>  

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] lavf/dashenc: Use avpriv_io_delete to delete files.

2018-11-29 Thread Andrey Semashev
This fixes incorrect handling of file URIs (i.e. when the filename starts
with "file:", possibly followed by URI authority).
---
 libavformat/dashenc.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 6ce70e0076..426dc91bcc 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -25,6 +25,7 @@
 #include 
 #endif
 
+#include "libavutil/error.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avutil.h"
 #include "libavutil/avstring.h"
@@ -1326,8 +1327,13 @@ static void dashenc_delete_file(AVFormatContext *s, char 
*filename) {
 
 av_dict_free(_opts);
 ff_format_io_close(s, );
-} else if (unlink(filename) < 0) {
-av_log(s, AV_LOG_ERROR, "failed to delete %s: %s\n", filename, 
strerror(errno));
+} else {
+int res = avpriv_io_delete(filename);
+if (res < 0) {
+char errbuf[AV_ERROR_MAX_STRING_SIZE];
+av_strerror(res, errbuf, sizeof(errbuf));
+av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : 
AV_LOG_ERROR), "failed to delete %s: %s\n", filename, errbuf);
+}
 }
 }
 
-- 
2.19.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel