Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in security/ r?keeler
MozReview-Commit-ID: yfkQVEp2do
--- 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) {