diff options
author | softworkz <softworkz@hotmail.com> | 2025-04-29 02:07:30 +0200 |
---|---|---|
committer | softworkz <softworkz@hotmail.com> | 2025-05-15 23:04:44 +0200 |
commit | 5f90eea8a8d97bf07f6ee101f8a786ef3e3a1d43 (patch) | |
tree | 3f1b6c1cfd06140c605679e220cf6db8e1a8d9ad /fftools/textformat/tf_default.c | |
parent | 8f42d90413f64574b8e15de27fc2430102843dbf (diff) | |
download | ffmpeg-5f90eea8a8d97bf07f6ee101f8a786ef3e3a1d43.tar.gz |
fftools/textformat: Apply quality improvements
Perform multiple improvements to increase code robustness.
In particular:
- favor unsigned counters for loops
- add missing checks
- avoid possible leaks
- move variable declarations to inner scopes when feasible
- provide explicit type-casting when needed
Signed-off-by: softworkz <softworkz@hotmail.com>
Diffstat (limited to 'fftools/textformat/tf_default.c')
-rw-r--r-- | fftools/textformat/tf_default.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fftools/textformat/tf_default.c b/fftools/textformat/tf_default.c index 2c5047eafd..ad97173b0b 100644 --- a/fftools/textformat/tf_default.c +++ b/fftools/textformat/tf_default.c @@ -68,9 +68,10 @@ DEFINE_FORMATTER_CLASS(default); /* lame uppercasing routine, assumes the string is lower case ASCII */ static inline char *upcase_string(char *dst, size_t dst_size, const char *src) { - int i; + unsigned i; + for (i = 0; src[i] && i < dst_size - 1; i++) - dst[i] = av_toupper(src[i]); + dst[i] = (char)av_toupper(src[i]); dst[i] = 0; return dst; } @@ -106,6 +107,9 @@ static void default_print_section_footer(AVTextFormatContext *wctx) const struct AVTextFormatSection *section = wctx->section[wctx->level]; char buf[32]; + if (!section) + return; + if (def->noprint_wrappers || def->nested_section[wctx->level]) return; |