[vlc-commits] demux:mkv: favor sizeof() on static strings to strlen()
Steve Lhomme
git at videolan.org
Wed Mar 21 15:08:15 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 21 14:10:49 2018 +0100| [2456913597aae482f62c9c4f2f9397c01d5b4466] | committer: Hugo Beauzée-Luyssen
demux:mkv: favor sizeof() on static strings to strlen()
(cherry picked from commit d8aea6d3e187e3163007119487160dfa59f6eb05)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2456913597aae482f62c9c4f2f9397c01d5b4466
---
modules/demux/mkv/matroska_segment_parse.cpp | 2 +-
modules/demux/mkv/util.cpp | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 132e142ed6..4bd4eaacee 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1594,7 +1594,7 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
* we try to fix it. They fixed it in 16.0.0. */
const char* app = vars.obj->psz_writing_application;
if( p_extra && p_extra[0] == 0 && app != NULL &&
- strncmp(app, "mkvmerge", strlen("mkvmerge")) == 0 )
+ strncmp(app, "mkvmerge", sizeof("mkvmerge")-1) == 0 )
{
int major_version;
if( sscanf(app, "mkvmerge v%d.", &major_version) && major_version < 16 )
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index fcb4064682..45a53fba99 100644
--- a/modules/demux/mkv/util.cpp
+++ b/modules/demux/mkv/util.cpp
@@ -386,10 +386,10 @@ block_t * packetize_wavpack( const mkv_track_t & tk, uint8_t * buffer, size_t s
void MkvTree_va( demux_t& demuxer, int i_level, const char* fmt, va_list args)
{
- static char const * indent = "| ";
- static char const * prefix = "+ ";
- static int const indent_len = strlen( indent );
- static int const prefix_len = strlen( prefix );
+ static char indent[] = "| ";
+ static char prefix[] = "+ ";
+ static int const indent_len = sizeof( indent ) - 1;
+ static int const prefix_len = sizeof( prefix ) - 1;
char fixed_buffer[256] = {};
size_t const static_len = sizeof( fixed_buffer );
More information about the vlc-commits
mailing list