From: David Wells Date: Sat, 4 Mar 2017 21:51:36 +0000 (-0500) Subject: Reduce the scope of some variables. X-Git-Tag: v8.5.0-rc1~70^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=737bb09f9df04ba1ecdded3d8e055ddf544c6c86;p=dealii.git Reduce the scope of some variables. This was caught by cppcheck. --- diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index f375ccb43a..812f066ae3 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -121,7 +121,6 @@ namespace const char *const plaintextend = plaintext_in + length_in; char *codechar = code_out; char result; - char fragment; result = state_in->result; @@ -130,40 +129,46 @@ namespace while (1) { case step_A: + { if (plainchar == plaintextend) { state_in->result = result; state_in->step = step_A; return codechar - code_out; } - fragment = *plainchar++; + const char fragment = *plainchar++; result = (fragment & 0x0fc) >> 2; *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; + } case step_B: + { if (plainchar == plaintextend) { state_in->result = result; state_in->step = step_B; return codechar - code_out; } - fragment = *plainchar++; + const char fragment = *plainchar++; result |= (fragment & 0x0f0) >> 4; *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; + } case step_C: + { if (plainchar == plaintextend) { state_in->result = result; state_in->step = step_C; return codechar - code_out; } - fragment = *plainchar++; + const char fragment = *plainchar++; result |= (fragment & 0x0c0) >> 6; *codechar++ = base64_encode_value(result); result = (fragment & 0x03f) >> 0; *codechar++ = base64_encode_value(result); } + } } /* control should not reach here */ return codechar - code_out; diff --git a/source/numerics/data_out_rotation.cc b/source/numerics/data_out_rotation.cc index dfab4fb512..0b2de31de6 100644 --- a/source/numerics/data_out_rotation.cc +++ b/source/numerics/data_out_rotation.cc @@ -177,11 +177,11 @@ build_one_patch (const cell_iterator Assert (false, ExcNotImplemented()); }; - unsigned int offset=0; - // then fill in data if (data.n_datasets > 0) { + unsigned int offset=0; + data.reinit_all_fe_values(this->dof_data, *cell); // first fill dof_data for (unsigned int dataset=0; datasetdof_data.size(); ++dataset)