[FFmpeg-devel] [PATCH v2 2/3] fftools/textformat: Remove redundant casts
softworkz
ffmpegagent at gmail.com
Fri Jul 4 22:29:24 EEST 2025
From: softworkz <softworkz at hotmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
---
fftools/graph/graphprint.c | 14 +++++++-------
fftools/resources/resman.c | 6 +++---
fftools/textformat/avtextformat.c | 8 ++++----
fftools/textformat/tf_compact.c | 2 +-
fftools/textformat/tf_default.c | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/fftools/graph/graphprint.c b/fftools/graph/graphprint.c
index 242eaf8ba1..f940d1d789 100644
--- a/fftools/graph/graphprint.c
+++ b/fftools/graph/graphprint.c
@@ -161,7 +161,7 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
{
unsigned i;
for (i = 0; src[i] && i < dst_size - 1; i++)
- dst[i] = (char)av_toupper(src[i]);
+ dst[i] = av_toupper(src[i]);
dst[i] = 0;
return dst;
}
@@ -261,7 +261,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
case AVMEDIA_TYPE_VIDEO:
if (hw_frames_ctx && hw_frames_ctx->data) {
- AVHWFramesContext * hwfctx = (AVHWFramesContext *)hw_frames_ctx->data;
+ AVHWFramesContext *hwfctx = (AVHWFramesContext *)hw_frames_ctx->data;
const AVPixFmtDescriptor *pix_desc_hw = av_pix_fmt_desc_get(hwfctx->format);
const AVPixFmtDescriptor *pix_desc_sw = av_pix_fmt_desc_get(hwfctx->sw_format);
if (pix_desc_hw && pix_desc_sw)
@@ -498,7 +498,7 @@ static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AV
print_int("input_index", ifilter->index);
if (ifilter->linklabel)
- print_str("link_label", (const char*)ifilter->linklabel);
+ print_str("link_label", ifilter->linklabel);
if (ifilter->filter) {
print_id("filter_id", ifilter->filter->name);
@@ -506,9 +506,9 @@ static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AV
}
if (ifilter->linklabel && ifilter->filter)
- av_dict_set(&input_map, ifilter->filter->name, (const char *)ifilter->linklabel, 0);
+ av_dict_set(&input_map, ifilter->filter->name, ifilter->linklabel, 0);
else if (ifilter->input_name && ifilter->filter)
- av_dict_set(&input_map, ifilter->filter->name, (const char *)ifilter->input_name, 0);
+ av_dict_set(&input_map, ifilter->filter->name, ifilter->input_name, 0);
print_str("media_type", av_get_media_type_string(media_type));
@@ -529,7 +529,7 @@ static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AV
print_str("name", ofilter->output_name);
if (fg->outputs[i]->linklabel)
- print_str("link_label", (const char*)fg->outputs[i]->linklabel);
+ print_str("link_label", fg->outputs[i]->linklabel);
if (ofilter->filter) {
print_id("filter_id", ofilter->filter->name);
@@ -1069,7 +1069,7 @@ static int print_filtergraphs_priv(FilterGraph **graphs, int nb_graphs, InputFil
goto cleanup;
}
- avio_write(avio, (const unsigned char *)target_buf.str, FFMIN(target_buf.len, target_buf.size - 1));
+ avio_write(avio, target_buf.str, FFMIN(target_buf.len, target_buf.size - 1));
if ((ret = avio_closep(&avio)) < 0)
av_log(NULL, AV_LOG_ERROR, "Error closing graph output file, loss of information possible: %s\n", av_err2str(ret));
diff --git a/fftools/resources/resman.c b/fftools/resources/resman.c
index aa53e96bf4..4c517b62c0 100644
--- a/fftools/resources/resman.c
+++ b/fftools/resources/resman.c
@@ -76,7 +76,7 @@ static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in
memset(&strm, 0, sizeof(strm));
// Allocate output buffer with extra byte for null termination
- buf = (uint8_t *)av_mallocz(chunk + 1);
+ buf = av_mallocz(chunk + 1);
if (!buf) {
av_log(ctx, AV_LOG_ERROR, "Failed to allocate decompression buffer\n");
return AVERROR(ENOMEM);
@@ -112,7 +112,7 @@ static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in
buf[*out_len] = 0; // Ensure null termination
inflateEnd(&strm);
- *out = (char *)buf;
+ *out = buf;
return Z_OK;
}
#endif
@@ -156,7 +156,7 @@ char *ff_resman_get_string(FFResourceId resource_id)
char *out = NULL;
size_t out_len;
- int ret = decompress_gzip(ctx, (uint8_t *)resource_definition.data, *resource_definition.data_len, &out, &out_len);
+ int ret = decompress_gzip(ctx, resource_definition.data, *resource_definition.data_len, &out, &out_len);
if (ret) {
av_log(ctx, AV_LOG_ERROR, "Unable to decompress the resource with ID %d\n", resource_id);
diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c
index 651a84578c..39ab4cecb7 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -209,8 +209,8 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
/* validate replace string */
{
- const uint8_t *p = (uint8_t *)tctx->string_validation_replacement;
- const uint8_t *endp = p + strlen((const char *)p);
+ const uint8_t *p = tctx->string_validation_replacement;
+ const uint8_t *endp = p + strlen(p);
while (*p) {
const uint8_t *p0 = p;
int32_t code;
@@ -313,7 +313,7 @@ void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t va
static inline int validate_string(AVTextFormatContext *tctx, char **dstp, const char *src)
{
- const uint8_t *p, *endp, *srcp = (const uint8_t *)src;
+ const uint8_t *p, *endp, *srcp = src;
AVBPrint dstbuf;
AVBPrint invalid_seq;
int invalid_chars_nb = 0, ret = 0;
@@ -557,7 +557,7 @@ void avtext_print_data_hash(AVTextFormatContext *tctx, const char *key,
av_hash_init(tctx->hash);
av_hash_update(tctx->hash, data, size);
len = snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(tctx->hash));
- av_hash_final_hex(tctx->hash, (uint8_t *)&buf[len], (int)sizeof(buf) - len);
+ av_hash_final_hex(tctx->hash, &buf[len], (int)sizeof(buf) - len);
avtext_print_string(tctx, key, buf, 0);
}
diff --git a/fftools/textformat/tf_compact.c b/fftools/textformat/tf_compact.c
index 62717bba0a..3f38f24f94 100644
--- a/fftools/textformat/tf_compact.c
+++ b/fftools/textformat/tf_compact.c
@@ -158,7 +158,7 @@ static void compact_print_section_header(AVTextFormatContext *tctx, const void *
/* define a prefix for elements not contained in an array or
in a wrapper, or for array elements with a type */
- const char *element_name = (char *)av_x_if_null(section->element_name, section->name);
+ const char *element_name = av_x_if_null(section->element_name, section->name);
AVBPrint *section_pbuf = &tctx->section_pbuf[tctx->level];
compact->nested_section[tctx->level] = 1;
diff --git a/fftools/textformat/tf_default.c b/fftools/textformat/tf_default.c
index 2c91a8dec4..ee0c4137e0 100644
--- a/fftools/textformat/tf_default.c
+++ b/fftools/textformat/tf_default.c
@@ -57,7 +57,7 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
unsigned i;
for (i = 0; src[i] && i < dst_size - 1; i++)
- dst[i] = (char)av_toupper(src[i]);
+ dst[i] = av_toupper(src[i]);
dst[i] = 0;
return dst;
}
--
ffmpeg-codebot
More information about the ffmpeg-devel
mailing list