remove -Wshadow warnings

"warning: declaration of ‘index’ shadows a global declaration"

Change-Id: I65f079aa4cd300cd1b3887a040b75c6b0f36ca1d
This commit is contained in:
Pascal Massimino 2013-09-14 02:02:09 -07:00
parent bf3a29b302
commit 2f5e893400

View File

@ -107,11 +107,11 @@ static int EncodeFrame(const WebPConfig* const config, WebPPicture* const pic,
return 1; return 1;
} }
// Returns cached frame at given 'index'. // Returns cached frame at given 'position' index.
static EncodedFrame* CacheGetFrame(const WebPFrameCache* const cache, static EncodedFrame* CacheGetFrame(const WebPFrameCache* const cache,
size_t index) { size_t position) {
assert(cache->start + index < cache->size); assert(cache->start + position < cache->size);
return &cache->encoded_frames[cache->start + index]; return &cache->encoded_frames[cache->start + position];
} }
// Calculate the penalty incurred if we encode given frame as a key frame // Calculate the penalty incurred if we encode given frame as a key frame
@ -137,9 +137,9 @@ int WebPFrameCacheAddFrame(WebPFrameCache* const cache,
WebPPicture* const sub_frame_pic, WebPPicture* const sub_frame_pic,
const WebPMuxFrameInfo* const key_frame_info, const WebPMuxFrameInfo* const key_frame_info,
WebPPicture* const key_frame_pic) { WebPPicture* const key_frame_pic) {
const size_t index = cache->count; const size_t position = cache->count;
EncodedFrame* const encoded_frame = CacheGetFrame(cache, index); EncodedFrame* const encoded_frame = CacheGetFrame(cache, position);
assert(index < cache->size); assert(position < cache->size);
assert(sub_frame_pic != NULL || key_frame_pic != NULL); assert(sub_frame_pic != NULL || key_frame_pic != NULL);
if (sub_frame_pic != NULL && !SetFrame(config, sub_frame_info, sub_frame_pic, if (sub_frame_pic != NULL && !SetFrame(config, sub_frame_info, sub_frame_pic,
&encoded_frame->sub_frame)) { &encoded_frame->sub_frame)) {
@ -153,7 +153,7 @@ int WebPFrameCacheAddFrame(WebPFrameCache* const cache,
++cache->count; ++cache->count;
if (sub_frame_pic == NULL && key_frame_pic != NULL) { // Keyframe. if (sub_frame_pic == NULL && key_frame_pic != NULL) { // Keyframe.
cache->keyframe = index; cache->keyframe = position;
cache->flush_count = cache->count; cache->flush_count = cache->count;
cache->count_since_key_frame = 0; cache->count_since_key_frame = 0;
} else { } else {
@ -164,7 +164,7 @@ int WebPFrameCacheAddFrame(WebPFrameCache* const cache,
} else { // Analyze size difference of the two variants. } else { // Analyze size difference of the two variants.
const int64_t curr_delta = KeyFramePenalty(encoded_frame); const int64_t curr_delta = KeyFramePenalty(encoded_frame);
if (curr_delta <= cache->best_delta) { // Pick this as keyframe. if (curr_delta <= cache->best_delta) { // Pick this as keyframe.
cache->keyframe = index; cache->keyframe = position;
cache->best_delta = curr_delta; cache->best_delta = curr_delta;
cache->flush_count = cache->count - 1; // We can flush previous frames. cache->flush_count = cache->count - 1; // We can flush previous frames.
} }