mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 12:28:26 +01:00
AssignSegments: quiet -Warray-bounds warning
the number of segments are previously validated, but an explicit check is needed to avoid a warning under gcc-4.9 Change-Id: Ifa7c0dd7f3f075b3860fa8ec176d2c98ff54fcea
This commit is contained in:
parent
32f67e309f
commit
c8a87bb62d
@ -141,7 +141,11 @@ static void MergeHistograms(const VP8Histogram* const in,
|
|||||||
|
|
||||||
static void AssignSegments(VP8Encoder* const enc,
|
static void AssignSegments(VP8Encoder* const enc,
|
||||||
const int alphas[MAX_ALPHA + 1]) {
|
const int alphas[MAX_ALPHA + 1]) {
|
||||||
const int nb = enc->segment_hdr_.num_segments_;
|
// 'num_segments_' is previously validated and <= NUM_MB_SEGMENTS, but an
|
||||||
|
// explicit check is needed to avoid spurious warning about 'n + 1' exceeding
|
||||||
|
// array bounds of 'centers' with some compilers (noticed with gcc-4.9).
|
||||||
|
const int nb = (enc->segment_hdr_.num_segments_ < NUM_MB_SEGMENTS) ?
|
||||||
|
enc->segment_hdr_.num_segments_ : NUM_MB_SEGMENTS;
|
||||||
int centers[NUM_MB_SEGMENTS];
|
int centers[NUM_MB_SEGMENTS];
|
||||||
int weighted_average = 0;
|
int weighted_average = 0;
|
||||||
int map[MAX_ALPHA + 1];
|
int map[MAX_ALPHA + 1];
|
||||||
|
Loading…
Reference in New Issue
Block a user