remove some -Wshadow warnings

these are quite noisy, but it's not a big deal to remove
them.

Change-Id: I5deb08f10263feb77e2cc8a70be44ad4f725febd
This commit is contained in:
skal
2013-01-21 17:20:14 +01:00
parent 8189feda50
commit 0d19fbff51
12 changed files with 92 additions and 85 deletions

View File

@ -310,8 +310,8 @@ static void SaveOutput(const WebPDecBuffer* const buffer,
if (ok) {
printf("Saved file %s\n", out_file);
if (verbose) {
const double time = StopwatchReadAndReset(&stop_watch);
printf("Time to write output: %.3fs\n", time);
const double write_time = StopwatchReadAndReset(&stop_watch);
printf("Time to write output: %.3fs\n", write_time);
}
} else {
fprintf(stderr, "Error writing file %s !!\n", out_file);
@ -462,8 +462,8 @@ int main(int argc, const char *argv[]) {
status = WebPDecode(data, data_size, &config);
if (verbose) {
const double time = StopwatchReadAndReset(&stop_watch);
printf("Time to decode picture: %.3fs\n", time);
const double decode_time = StopwatchReadAndReset(&stop_watch);
printf("Time to decode picture: %.3fs\n", decode_time);
}
end:
free((void*)data);

View File

@ -801,12 +801,11 @@ static int Process(const WebPMuxConfig* config) {
WebPMux* mux = NULL;
WebPData chunk;
WebPMuxError err = WEBP_MUX_OK;
int index = 0;
int ok = 1;
const Feature* const feature = &config->feature_;
switch (config->action_type_) {
case ACTION_GET:
case ACTION_GET: {
ok = CreateMux(config->input_, &mux);
if (!ok) goto Err2;
switch (feature->type_) {
@ -832,21 +831,22 @@ static int Process(const WebPMuxConfig* config) {
break;
}
break;
case ACTION_SET:
}
case ACTION_SET: {
switch (feature->type_) {
case FEATURE_ANMF: {
int i;
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
mux = WebPMuxNew();
if (mux == NULL) {
ERROR_GOTO2("ERROR (%s): Could not allocate a mux object.\n",
ErrorString(WEBP_MUX_MEMORY_ERROR), Err2);
}
for (index = 0; index < feature->arg_count_; ++index) {
switch (feature->args_[index].subtype_) {
for (i = 0; i < feature->arg_count_; ++i) {
switch (feature->args_[i].subtype_) {
case SUBTYPE_BGCOLOR: {
uint32_t bgcolor;
ok = ParseBgcolorArgs(feature->args_[index].params_, &bgcolor);
ok = ParseBgcolorArgs(feature->args_[i].params_, &bgcolor);
if (!ok) {
ERROR_GOTO1("ERROR: Could not parse the background color \n",
Err2);
@ -856,7 +856,7 @@ static int Process(const WebPMuxConfig* config) {
}
case SUBTYPE_LOOP: {
const long loop_count =
strtol(feature->args_[index].params_, NULL, 10);
strtol(feature->args_[i].params_, NULL, 10);
if (loop_count != (int)loop_count) {
// Note: This is only a 'necessary' condition for loop_count
// to be valid. The 'sufficient' conditioned in checked in
@ -870,10 +870,10 @@ static int Process(const WebPMuxConfig* config) {
case SUBTYPE_ANMF: {
WebPMuxFrameInfo frame;
frame.id = WEBP_CHUNK_ANMF;
ok = ReadFileToWebPData(feature->args_[index].filename_,
ok = ReadFileToWebPData(feature->args_[i].filename_,
&frame.bitstream);
if (!ok) goto Err2;
ok = ParseFrameArgs(feature->args_[index].params_, &frame);
ok = ParseFrameArgs(feature->args_[i].params_, &frame);
if (!ok) {
WebPDataClear(&frame.bitstream);
ERROR_GOTO1("ERROR: Could not parse frame properties.\n",
@ -883,7 +883,7 @@ static int Process(const WebPMuxConfig* config) {
WebPDataClear(&frame.bitstream);
if (err != WEBP_MUX_OK) {
ERROR_GOTO3("ERROR (%s): Could not add a frame at index %d."
"\n", ErrorString(err), index, Err2);
"\n", ErrorString(err), i, Err2);
}
break;
}
@ -901,19 +901,20 @@ static int Process(const WebPMuxConfig* config) {
break;
}
case FEATURE_FRGM:
case FEATURE_FRGM: {
int i;
mux = WebPMuxNew();
if (mux == NULL) {
ERROR_GOTO2("ERROR (%s): Could not allocate a mux object.\n",
ErrorString(WEBP_MUX_MEMORY_ERROR), Err2);
}
for (index = 0; index < feature->arg_count_; ++index) {
for (i = 0; i < feature->arg_count_; ++i) {
WebPMuxFrameInfo frgm;
frgm.id = WEBP_CHUNK_FRGM;
ok = ReadFileToWebPData(feature->args_[index].filename_,
ok = ReadFileToWebPData(feature->args_[i].filename_,
&frgm.bitstream);
if (!ok) goto Err2;
ok = ParseFragmentArgs(feature->args_[index].params_, &frgm);
ok = ParseFragmentArgs(feature->args_[i].params_, &frgm);
if (!ok) {
WebPDataClear(&frgm.bitstream);
ERROR_GOTO1("ERROR: Could not parse fragment properties.\n",
@ -923,14 +924,15 @@ static int Process(const WebPMuxConfig* config) {
WebPDataClear(&frgm.bitstream);
if (err != WEBP_MUX_OK) {
ERROR_GOTO3("ERROR (%s): Could not add a fragment at index %d.\n",
ErrorString(err), index, Err2);
ErrorString(err), i, Err2);
}
}
break;
}
case FEATURE_ICCP:
case FEATURE_EXIF:
case FEATURE_XMP:
case FEATURE_XMP: {
ok = CreateMux(config->input_, &mux);
if (!ok) goto Err2;
ok = ReadFileToWebPData(feature->args_[0].filename_, &chunk);
@ -942,15 +944,16 @@ static int Process(const WebPMuxConfig* config) {
ErrorString(err), kDescriptions[feature->type_], Err2);
}
break;
default:
}
default: {
ERROR_GOTO1("ERROR: Invalid feature for action 'set'.\n", Err2);
break;
}
}
ok = WriteWebP(mux, config->output_);
break;
case ACTION_STRIP:
}
case ACTION_STRIP: {
ok = CreateMux(config->input_, &mux);
if (!ok) goto Err2;
if (feature->type_ == FEATURE_ICCP || feature->type_ == FEATURE_EXIF ||
@ -966,16 +969,17 @@ static int Process(const WebPMuxConfig* config) {
}
ok = WriteWebP(mux, config->output_);
break;
case ACTION_INFO:
}
case ACTION_INFO: {
ok = CreateMux(config->input_, &mux);
if (!ok) goto Err2;
ok = (DisplayInfo(mux) == WEBP_MUX_OK);
break;
default:
}
default: {
assert(0); // Invalid action.
break;
}
}
Err2: