History

avfiltergraph: silence an uninitialized variable warning

The warning is: libavfilter/avfiltergraph.c: In function ‘avfilter_graph_config’: libavfilter/avfiltergraph.c:528:9: warning: ‘best_idx’ may be used uninitialized in this function [-Wuninitialized] libavfilter/avfiltergraph.c:479:13: note: ‘best_idx’ was declared here Initialize it to an invalid value and add an assert that it's properly set later.

Anton Khirnov committed 14 years ago

Commit e3496e51 parent 34ebbbf1 file · +2 −1Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 1 file). Show all

Unified · Split

libavfilter/avfiltergraph.c+2−1
@@ -476,7 +476,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 475 unmodified lines
476476
477477 for (i = 0; i < filter->nb_outputs; i++) {
478478 AVFilterLink *outlink = filter->outputs[i];
479− int best_idx, best_score = INT_MIN, best_count_diff = INT_MAX;
479+ int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX;
480480
481481 if (outlink->type != AVMEDIA_TYPE_AUDIO ||
482482 outlink->in_channel_layouts->nb_channel_layouts < 2)
@@ -525,6 +525,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 42 unmodified lines
525525 best_count_diff = count_diff;
526526 }
527527 }
528+ av_assert0(best_idx >= 0);
528529 FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0],
529530 outlink->in_channel_layouts->channel_layouts[best_idx]);
530531 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t