Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in security/ r=keeler
authorSylvestre Ledru <sledru@mozilla.com>
Tue, 07 Feb 2017 13:22:44 +0100
changeset 342527 a39e29e8f86432c4b7ac0b5c4d9618d899a4953e
parent 342526 4d65d08fe6c07f055c759d2ebdb69646f69e60f3
child 342528 2f804e38c8cb0e4e9f2d41cbb60393341d09b3a0
push id31357
push userkwierso@gmail.com
push dateTue, 14 Feb 2017 00:49:21 +0000
treeherdermozilla-central@bca082441767 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1337358
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in security/ r=keeler MozReview-Commit-ID: yfkQVEp2do
security/pkix/lib/pkixnames.cpp
security/pkix/lib/pkixocsp.cpp
--- a/security/pkix/lib/pkixnames.cpp
+++ b/security/pkix/lib/pkixnames.cpp
@@ -1603,22 +1603,22 @@ LocaleInsensitveToLower(uint8_t a)
   return a;
 }
 
 bool
 StartsWithIDNALabel(Input id)
 {
   static const uint8_t IDN_ALABEL_PREFIX[4] = { 'x', 'n', '-', '-' };
   Reader input(id);
-  for (size_t i = 0; i < sizeof(IDN_ALABEL_PREFIX); ++i) {
+  for (const uint8_t prefixByte : IDN_ALABEL_PREFIX) {
     uint8_t b;
     if (input.Read(b) != Success) {
       return false;
     }
-    if (b != IDN_ALABEL_PREFIX[i]) {
+    if (b != prefixByte) {
       return false;
     }
   }
   return true;
 }
 
 bool
 ReadIPv4AddressComponent(Reader& input, bool lastComponent,
--- a/security/pkix/lib/pkixocsp.cpp
+++ b/security/pkix/lib/pkixocsp.cpp
@@ -959,18 +959,18 @@ CreateEncodedOCSPRequest(TrustDomain& tr
   uint8_t* d = out;
   *d++ = 0x30; *d++ = totalLen - 2u;  // OCSPRequest (SEQUENCE)
   *d++ = 0x30; *d++ = totalLen - 4u;  //   tbsRequest (SEQUENCE)
   *d++ = 0x30; *d++ = totalLen - 6u;  //     requestList (SEQUENCE OF)
   *d++ = 0x30; *d++ = totalLen - 8u;  //       Request (SEQUENCE)
   *d++ = 0x30; *d++ = totalLen - 10u; //         reqCert (CertID SEQUENCE)
 
   // reqCert.hashAlgorithm
-  for (size_t i = 0; i < sizeof(hashAlgorithm); ++i) {
-    *d++ = hashAlgorithm[i];
+  for (const uint8_t hashAlgorithmByte : hashAlgorithm) {
+    *d++ = hashAlgorithmByte;
   }
 
   // reqCert.issuerNameHash (OCTET STRING)
   *d++ = 0x04;
   *d++ = hashLen;
   Result rv = trustDomain.DigestBuf(certID.issuer, DigestAlgorithm::sha1, d,
                                     hashLen);
   if (rv != Success) {