Skip to content

Commit 0bb7dcb

Browse files
committed
fftools/textformat: Remove redundant casts
Signed-off-by: softworkz <softworkz@hotmail.com>
1 parent 8c97d32 commit 0bb7dcb

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

fftools/graph/graphprint.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
161161
{
162162
unsigned i;
163163
for (i = 0; src[i] && i < dst_size - 1; i++)
164-
dst[i] = (char)av_toupper(src[i]);
164+
dst[i] = av_toupper(src[i]);
165165
dst[i] = 0;
166166
return dst;
167167
}
@@ -261,7 +261,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
261261
case AVMEDIA_TYPE_VIDEO:
262262

263263
if (hw_frames_ctx && hw_frames_ctx->data) {
264-
AVHWFramesContext * hwfctx = (AVHWFramesContext *)hw_frames_ctx->data;
264+
AVHWFramesContext *hwfctx = hw_frames_ctx->data;
265265
const AVPixFmtDescriptor *pix_desc_hw = av_pix_fmt_desc_get(hwfctx->format);
266266
const AVPixFmtDescriptor *pix_desc_sw = av_pix_fmt_desc_get(hwfctx->sw_format);
267267
if (pix_desc_hw && pix_desc_sw)
@@ -317,7 +317,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
317317
print_fmt_opt("sample_rate", "%d/%d", link->time_base.num, link->time_base.den);
318318

319319
if (hw_frames_ctx && hw_frames_ctx->data)
320-
print_hwframescontext(gpc, (AVHWFramesContext *)hw_frames_ctx->data);
320+
print_hwframescontext(gpc, hw_frames_ctx->data);
321321
av_buffer_unref(&hw_frames_ctx);
322322
}
323323

@@ -397,7 +397,7 @@ static void print_filter(GraphPrintContext *gpc, const AVFilterContext *filter,
397397
}
398398

399399
if (filter->hw_device_ctx) {
400-
AVHWDeviceContext *device_context = (AVHWDeviceContext *)filter->hw_device_ctx->data;
400+
AVHWDeviceContext *device_context = filter->hw_device_ctx->data;
401401
print_hwdevicecontext(gpc, device_context);
402402
if (filter->extra_hw_frames > 0)
403403
print_int("extra_hw_frames", filter->extra_hw_frames);
@@ -498,17 +498,17 @@ static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AV
498498
print_int("input_index", ifilter->index);
499499

500500
if (ifilter->linklabel)
501-
print_str("link_label", (const char*)ifilter->linklabel);
501+
print_str("link_label", ifilter->linklabel);
502502

503503
if (ifilter->filter) {
504504
print_id("filter_id", ifilter->filter->name);
505505
print_str("filter_name", ifilter->filter->filter->name);
506506
}
507507

508508
if (ifilter->linklabel && ifilter->filter)
509-
av_dict_set(&input_map, ifilter->filter->name, (const char *)ifilter->linklabel, 0);
509+
av_dict_set(&input_map, ifilter->filter->name, ifilter->linklabel, 0);
510510
else if (ifilter->input_name && ifilter->filter)
511-
av_dict_set(&input_map, ifilter->filter->name, (const char *)ifilter->input_name, 0);
511+
av_dict_set(&input_map, ifilter->filter->name, ifilter->input_name, 0);
512512

513513
print_str("media_type", av_get_media_type_string(media_type));
514514

@@ -529,7 +529,7 @@ static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AV
529529
print_str("name", ofilter->output_name);
530530

531531
if (fg->outputs[i]->linklabel)
532-
print_str("link_label", (const char*)fg->outputs[i]->linklabel);
532+
print_str("link_label", fg->outputs[i]->linklabel);
533533

534534
if (ofilter->filter) {
535535
print_id("filter_id", ofilter->filter->name);
@@ -752,7 +752,7 @@ static int print_streams(GraphPrintContext *gpc, InputFile **ifiles, int nb_ifil
752752

753753
for (int n = nb_ofiles - 1; n >= 0; n--) {
754754
OutputFile *of = ofiles[n];
755-
Muxer *muxer = (Muxer *)of;
755+
Muxer *muxer = of;
756756

757757
if (!muxer->fc)
758758
continue;
@@ -1069,7 +1069,7 @@ static int print_filtergraphs_priv(FilterGraph **graphs, int nb_graphs, InputFil
10691069
goto cleanup;
10701070
}
10711071

1072-
avio_write(avio, (const unsigned char *)target_buf.str, FFMIN(target_buf.len, target_buf.size - 1));
1072+
avio_write(avio, target_buf.str, FFMIN(target_buf.len, target_buf.size - 1));
10731073

10741074
if ((ret = avio_closep(&avio)) < 0)
10751075
av_log(NULL, AV_LOG_ERROR, "Error closing graph output file, loss of information possible: %s\n", av_err2str(ret));

fftools/resources/resman.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in
7676
memset(&strm, 0, sizeof(strm));
7777

7878
// Allocate output buffer with extra byte for null termination
79-
buf = (uint8_t *)av_mallocz(chunk + 1);
79+
buf = av_mallocz(chunk + 1);
8080
if (!buf) {
8181
av_log(ctx, AV_LOG_ERROR, "Failed to allocate decompression buffer\n");
8282
return AVERROR(ENOMEM);
@@ -112,7 +112,7 @@ static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in
112112
buf[*out_len] = 0; // Ensure null termination
113113

114114
inflateEnd(&strm);
115-
*out = (char *)buf;
115+
*out = buf;
116116
return Z_OK;
117117
}
118118
#endif
@@ -156,7 +156,7 @@ char *ff_resman_get_string(FFResourceId resource_id)
156156
char *out = NULL;
157157
size_t out_len;
158158

159-
int ret = decompress_gzip(ctx, (uint8_t *)resource_definition.data, *resource_definition.data_len, &out, &out_len);
159+
int ret = decompress_gzip(ctx, resource_definition.data, *resource_definition.data_len, &out, &out_len);
160160

161161
if (ret) {
162162
av_log(ctx, AV_LOG_ERROR, "Unable to decompress the resource with ID %d\n", resource_id);

fftools/textformat/avtextformat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
209209

210210
/* validate replace string */
211211
{
212-
const uint8_t *p = (uint8_t *)tctx->string_validation_replacement;
213-
const uint8_t *endp = p + strlen((const char *)p);
212+
const uint8_t *p = tctx->string_validation_replacement;
213+
const uint8_t *endp = p + strlen(p);
214214
while (*p) {
215215
const uint8_t *p0 = p;
216216
int32_t code;
@@ -313,7 +313,7 @@ void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t va
313313

314314
static inline int validate_string(AVTextFormatContext *tctx, char **dstp, const char *src)
315315
{
316-
const uint8_t *p, *endp, *srcp = (const uint8_t *)src;
316+
const uint8_t *p, *endp, *srcp = src;
317317
AVBPrint dstbuf;
318318
AVBPrint invalid_seq;
319319
int invalid_chars_nb = 0, ret = 0;
@@ -557,7 +557,7 @@ void avtext_print_data_hash(AVTextFormatContext *tctx, const char *key,
557557
av_hash_init(tctx->hash);
558558
av_hash_update(tctx->hash, data, size);
559559
len = snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(tctx->hash));
560-
av_hash_final_hex(tctx->hash, (uint8_t *)&buf[len], (int)sizeof(buf) - len);
560+
av_hash_final_hex(tctx->hash, &buf[len], (int)sizeof(buf) - len);
561561
avtext_print_string(tctx, key, buf, 0);
562562
}
563563

fftools/textformat/tf_compact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static void compact_print_section_header(AVTextFormatContext *tctx, const void *
158158

159159
/* define a prefix for elements not contained in an array or
160160
in a wrapper, or for array elements with a type */
161-
const char *element_name = (char *)av_x_if_null(section->element_name, section->name);
161+
const char *element_name = av_x_if_null(section->element_name, section->name);
162162
AVBPrint *section_pbuf = &tctx->section_pbuf[tctx->level];
163163

164164
compact->nested_section[tctx->level] = 1;

fftools/textformat/tf_default.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
5757
unsigned i;
5858

5959
for (i = 0; src[i] && i < dst_size - 1; i++)
60-
dst[i] = (char)av_toupper(src[i]);
60+
dst[i] = av_toupper(src[i]);
6161
dst[i] = 0;
6262
return dst;
6363
}

0 commit comments

Comments
 (0)