diff options
author | lloyd <[email protected]> | 2010-10-13 14:58:58 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 14:58:58 +0000 |
commit | 6e85766cf001183e160c8ca2c0ed3eb40f07125c (patch) | |
tree | df11b301786829bc2f6f545038ec97c2269154d9 /src/asn1/asn1_oid.cpp | |
parent | fcd3aba1ff6b8597b31165474573dbb339479c14 (diff) | |
parent | bb53c6169463a67cc751625cb0a2c47df129a2ab (diff) |
propagate from branch 'net.randombit.botan' (head 6581b789d58717bc6acee5c6a248e2d44c636e40)
to branch 'net.randombit.botan.c++0x' (head 227a989ae94da8f4379ea4b9b0fc0ee8dbdde0c7)
Diffstat (limited to 'src/asn1/asn1_oid.cpp')
-rw-r--r-- | src/asn1/asn1_oid.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/asn1/asn1_oid.cpp b/src/asn1/asn1_oid.cpp index ffe583b90..750eb90f7 100644 --- a/src/asn1/asn1_oid.cpp +++ b/src/asn1/asn1_oid.cpp @@ -50,10 +50,10 @@ void OID::clear() std::string OID::as_string() const { std::string oid_str; - for(u32bit j = 0; j != id.size(); ++j) + for(size_t i = 0; i != id.size(); ++i) { - oid_str += std::to_string(id[j]); - if(j != id.size() - 1) + oid_str += std::to_string(id[i]); + if(i != id.size() - 1) oid_str += '.'; } return oid_str; @@ -66,8 +66,8 @@ bool OID::operator==(const OID& oid) const { if(id.size() != oid.id.size()) return false; - for(u32bit j = 0; j != id.size(); ++j) - if(id[j] != oid.id[j]) + for(size_t i = 0; i != id.size(); ++i) + if(id[i] != oid.id[i]) return false; return true; } @@ -111,11 +111,11 @@ bool operator<(const OID& a, const OID& b) return true; if(oid1.size() > oid2.size()) return false; - for(u32bit j = 0; j != oid1.size(); ++j) + for(size_t i = 0; i != oid1.size(); ++i) { - if(oid1[j] < oid2[j]) + if(oid1[i] < oid2[i]) return true; - if(oid1[j] > oid2[j]) + if(oid1[i] > oid2[i]) return false; } return false; @@ -132,18 +132,18 @@ void OID::encode_into(DER_Encoder& der) const MemoryVector<byte> encoding; encoding.push_back(40 * id[0] + id[1]); - for(u32bit j = 2; j != id.size(); ++j) + for(size_t i = 2; i != id.size(); ++i) { - if(id[j] == 0) + if(id[i] == 0) encoding.push_back(0); else { - u32bit blocks = high_bit(id[j]) + 6; + size_t blocks = high_bit(id[i]) + 6; blocks = (blocks - (blocks % 7)) / 7; - for(u32bit k = 0; k != blocks - 1; ++k) - encoding.push_back(0x80 | ((id[j] >> 7*(blocks-k-1)) & 0x7F)); - encoding.push_back(id[j] & 0x7F); + for(size_t j = 0; j != blocks - 1; ++j) + encoding.push_back(0x80 | ((id[i] >> 7*(blocks-j-1)) & 0x7F)); + encoding.push_back(id[i] & 0x7F); } } der.add_object(OBJECT_ID, UNIVERSAL, encoding); @@ -166,15 +166,15 @@ void OID::decode_from(BER_Decoder& decoder) id.push_back(obj.value[0] / 40); id.push_back(obj.value[0] % 40); - u32bit j = 0; - while(j != obj.value.size() - 1) + size_t i = 0; + while(i != obj.value.size() - 1) { u32bit component = 0; - while(j != obj.value.size() - 1) + while(i != obj.value.size() - 1) { - ++j; - component = (component << 7) + (obj.value[j] & 0x7F); - if(!(obj.value[j] & 0x80)) + ++i; + component = (component << 7) + (obj.value[i] & 0x7F); + if(!(obj.value[i] & 0x80)) break; } id.push_back(component); |