Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str
@ 2022-10-04 14:40 Marvin Scholz
  2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 2/3] fftools/ffprobe: " Marvin Scholz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marvin Scholz @ 2022-10-04 14:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marvin Scholz

av_err2str which is a wrapper for av_strerror already calls
strerror_r if available and if not has a fallback for the other
error codes that would be handled by that, so manually calling
strerror again if it fails is not necessary.
---
 fftools/cmdutils.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f911c52be2..beef8ce385 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -798,12 +798,7 @@ do {                                                                           \
 
 void print_error(const char *filename, int err)
 {
-    char errbuf[128];
-    const char *errbuf_ptr = errbuf;
-
-    if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
-        errbuf_ptr = strerror(AVUNERROR(err));
-    av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
+    av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, av_err2str(err));
 }
 
 int read_yesno(void)
-- 
2.37.0 (Apple Git-136)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] fftools/ffprobe: Use av_err2str
  2022-10-04 14:40 [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str Marvin Scholz
@ 2022-10-04 14:40 ` Marvin Scholz
  2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg_opt: " Marvin Scholz
  2022-10-13 14:50 ` [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: " Anton Khirnov
  2 siblings, 0 replies; 4+ messages in thread
From: Marvin Scholz @ 2022-10-04 14:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marvin Scholz

av_err2str which is a wrapper for av_strerror already calls
strerror_r if available and if not has a fallback for the other
error codes that would be handled by that, so manually calling
strerror again if it fails is not necessary.
---
 fftools/ffprobe.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 421ada5bd8..9b7e82fd8c 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3279,15 +3279,9 @@ static int show_format(WriterContext *w, InputFile *ifile)
 
 static void show_error(WriterContext *w, int err)
 {
-    char errbuf[128];
-    const char *errbuf_ptr = errbuf;
-
-    if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
-        errbuf_ptr = strerror(AVUNERROR(err));
-
     writer_print_section_header(w, SECTION_ID_ERROR);
     print_int("code", err);
-    print_str("string", errbuf_ptr);
+    print_str("string", av_err2str(err));
     writer_print_section_footer(w);
 }
 
-- 
2.37.0 (Apple Git-136)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg_opt: Use av_err2str
  2022-10-04 14:40 [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str Marvin Scholz
  2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 2/3] fftools/ffprobe: " Marvin Scholz
@ 2022-10-04 14:40 ` Marvin Scholz
  2022-10-13 14:50 ` [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: " Anton Khirnov
  2 siblings, 0 replies; 4+ messages in thread
From: Marvin Scholz @ 2022-10-04 14:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marvin Scholz

This simplifies the code as there is no other place the error buffer
is needed, so the av_err2str helper macro can be used.
---
 fftools/ffmpeg_opt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 8f57b699f1..272a772283 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3716,7 +3716,6 @@ static int open_files(OptionGroupList *l, const char *inout,
 int ffmpeg_parse_options(int argc, char **argv)
 {
     OptionParseContext octx;
-    uint8_t error[128];
     int ret;
 
     memset(&octx, 0, sizeof(octx));
@@ -3767,8 +3766,7 @@ int ffmpeg_parse_options(int argc, char **argv)
 fail:
     uninit_parse_context(&octx);
     if (ret < 0) {
-        av_strerror(ret, error, sizeof(error));
-        av_log(NULL, AV_LOG_FATAL, "%s\n", error);
+        av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret));
     }
     return ret;
 }
-- 
2.37.0 (Apple Git-136)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str
  2022-10-04 14:40 [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str Marvin Scholz
  2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 2/3] fftools/ffprobe: " Marvin Scholz
  2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg_opt: " Marvin Scholz
@ 2022-10-13 14:50 ` Anton Khirnov
  2 siblings, 0 replies; 4+ messages in thread
From: Anton Khirnov @ 2022-10-13 14:50 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Marvin Scholz

Patchset looks good, will push.

-- 
Anton Khirnov
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 14:40 [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Use av_err2str Marvin Scholz
2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 2/3] fftools/ffprobe: " Marvin Scholz
2022-10-04 14:40 ` [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg_opt: " Marvin Scholz
2022-10-13 14:50 ` [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: " Anton Khirnov

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