Showing the changes to libavfilter/avfilter.c (1 of 34 files). Show all
Unified · Split
| @@ -101,18 +101,16 @@ void ff_command_queue_pop(AVFilterContext *filter) · 100 unmodified lines | ||
| 101 | 101 | av_free(c); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | −int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, | |
| 104 | +int ff_append_pad(unsigned *count, | |
| 105 | 105 | AVFilterPad **pads, AVFilterLink ***links, |
| 106 | 106 | AVFilterPad *newpad) |
| 107 | 107 | { |
| 108 | 108 | AVFilterLink **newlinks; |
| 109 | 109 | AVFilterPad *newpads; |
| 110 | − unsigned i; | |
| 111 | − | |
| 112 | − idx = FFMIN(idx, *count); | |
| 110 | + unsigned idx = *count; | |
| 113 | 111 | |
| 114 | − newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); | |
| 115 | − newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); | |
| 112 | + newpads = av_realloc_array(*pads, idx + 1, sizeof(*newpads)); | |
| 113 | + newlinks = av_realloc_array(*links, idx + 1, sizeof(*newlinks)); | |
| 116 | 114 | if (newpads) |
| 117 | 115 | *pads = newpads; |
| 118 | 116 | if (newlinks) |
| @@ -120,15 +118,10 @@ int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, · 1 unmodified line | ||
| 120 | 118 | if (!newpads || !newlinks) |
| 121 | 119 | return AVERROR(ENOMEM); |
| 122 | 120 | |
| 123 | − memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); | |
| 124 | − memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); | |
| 125 | 121 | memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); |
| 126 | 122 | (*links)[idx] = NULL; |
| 127 | 123 | |
| 128 | 124 | (*count)++; |
| 129 | − for (i = idx + 1; i < *count; i++) | |
| 130 | − if ((*links)[i]) | |
| 131 | − (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; | |
| 132 | 125 | |
| 133 | 126 | return 0; |
| 134 | 127 | } |