1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00
FFmpeg/libavformat
Andreas Rheinhardt 62af385b91 avformat/dump: Avoid unnecessary implicit calculation of strlen
av_strlcpy() returns the length of the src string to enable
the caller to check for truncation. It is currently used in
the following way in dump_metadata(): Every metadata value
is searched for \b, \n, \v, \f, \r and then the data up to
the first of these characters found is copied to a small
temporary buffer via av_strlcpy() (but of course not more
than fits into said buffer) and then printed; all characters up
to the character found earlier are then treated as consumed.

But this is bad performance-wise if the while string is big
and contains many of these characters, because av_strlcpy()
will unnecessarily calculate the length of the whole remaining string.
(dump_metadata() actually ignored the return value of av_strlcpy().)

Fix this by not copying the data to a temporary buffer at all.
Instead just use %.*s to bound the number of characters output.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-14 15:03:59 +02:00
..
2022-03-15 09:42:29 -03:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:29 -03:00
2022-03-15 09:42:29 -03:00
2022-03-15 09:42:30 -03:00
2022-03-15 09:42:30 -03:00
2022-09-12 11:35:43 +02:00
2022-03-27 11:58:54 +02:00
2022-03-27 11:59:51 +02:00
2022-06-13 22:42:55 +02:00
2022-06-13 22:42:55 +02:00
2022-09-04 15:03:32 -04:00
2022-03-15 09:42:30 -03:00
2022-06-09 20:46:10 +02:00
2022-03-15 09:42:31 -03:00
2022-09-12 11:35:43 +02:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:31 -03:00
2022-03-15 09:42:31 -03:00
2022-03-15 09:42:31 -03:00
2022-03-16 14:05:26 +02:00
2022-03-15 09:42:32 -03:00
2022-03-16 14:05:26 +02:00
2022-03-15 09:42:32 -03:00
2022-03-15 09:42:32 -03:00
2022-03-15 09:42:33 -03:00
2022-03-15 09:42:33 -03:00
2022-04-21 22:42:20 +02:00
2022-03-15 09:42:33 -03:00
2022-03-15 09:42:33 -03:00
2022-09-10 17:32:47 +02:00
2022-06-24 23:07:33 -03:00
2022-05-10 07:37:38 +02:00
2022-07-16 22:40:44 +02:00
2022-03-15 09:42:33 -03:00
2022-03-15 09:42:33 -03:00
2022-05-06 15:57:45 +02:00
2022-09-12 11:35:43 +02:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:34 -03:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:35 -03:00
2022-03-15 09:42:36 -03:00
2022-03-15 09:42:36 -03:00
2022-03-15 09:42:36 -03:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:36 -03:00
2022-03-15 09:42:36 -03:00
2022-03-15 09:42:36 -03:00
2022-03-26 00:42:00 +02:00
2022-03-15 09:42:37 -03:00
2022-07-07 21:52:52 +02:00
2022-08-31 16:24:22 +02:00
2022-03-15 09:42:37 -03:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:37 -03:00
2022-03-15 09:42:37 -03:00
2022-03-15 09:42:37 -03:00
2022-03-15 09:42:37 -03:00
2022-03-15 09:42:37 -03:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:38 -03:00
2022-09-12 11:35:43 +02:00
2022-03-15 09:42:38 -03:00
2022-05-10 07:37:38 +02:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:38 -03:00
2022-03-15 09:42:39 -03:00
2022-03-15 09:42:39 -03:00
2022-03-15 09:42:39 -03:00