@@ -145,12 +145,11 @@ void ScramShaBackend::addAttribute(std::ostream& out,
145145 break ;
146146
147147 case ' r' : // client nonce.. printable characters
148- for (auto iter = value. begin (); iter != value. end (); ++iter ) {
149- if (*iter == ' ,' || !isprint (*iter )) {
148+ for (const auto & c : value) {
149+ if (c == ' ,' || !isprint (c )) {
150150 throw std::invalid_argument (
151- " ScramShaBackend::addAttribute: "
152- " Invalid character in client"
153- " nonce" );
151+ " ScramShaBackend::addAttribute: Invalid character in "
152+ " client nonce" );
154153 }
155154 }
156155 out << value;
@@ -177,12 +176,11 @@ void ScramShaBackend::addAttribute(std::ostream& out,
177176 break ;
178177
179178 case ' e' :
180- for (auto iter = value. begin (); iter != value. end (); ++iter ) {
181- if (*iter == ' ,' || !isprint (*iter )) {
179+ for (const auto & c : value) {
180+ if (c == ' ,' || !isprint (c )) {
182181 throw std::invalid_argument (
183- " ScramShaBackend::addAttribute: "
184- " Invalid character in error"
185- " message" );
182+ " ScramShaBackend::addAttribute: Invalid character in "
183+ " error message" );
186184 }
187185 }
188186 out << value;
@@ -276,7 +274,7 @@ std::string ScramShaBackend::getClientProof() {
276274 proof.resize (clientKey.size ());
277275
278276 auto total = proof.size ();
279- for (unsigned int ii = 0 ; ii < total; ++ii) {
277+ for (std:: size_t ii = 0 ; ii < total; ++ii) {
280278 proof[ii] = ck[ii] ^ cs[ii];
281279 }
282280
@@ -293,7 +291,7 @@ ServerBackend::ServerBackend(server::ServerContext& ctx,
293291 /* Generate a challenge */
294292 cb::RandomGenerator randomGenerator;
295293
296- std::array<char , 8 > nonce;
294+ std::array<char , 8 > nonce{} ;
297295 if (!randomGenerator.getBytes (nonce.data (), nonce.size ())) {
298296 logging::log (&context,
299297 logging::Level::Error,
@@ -499,7 +497,7 @@ ClientBackend::ClientBackend(client::GetUsernameCallback& user_cb,
499497 ScramShaBackend (mechanism, algo) {
500498 cb::RandomGenerator randomGenerator;
501499
502- std::array<char , 8 > nonce;
500+ std::array<char , 8 > nonce{} ;
503501 if (!randomGenerator.getBytes (nonce.data (), nonce.size ())) {
504502 logging::log (&context,
505503 logging::Level::Error,
0 commit comments