diff options
author | lloyd <[email protected]> | 2010-10-13 12:29:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 12:29:03 +0000 |
commit | b295e186a4681c6c9a96b469e66656dc1f660be7 (patch) | |
tree | 04894bfe84513842598e666ed27e411ae30d4771 /src/asn1/asn1_oid.cpp | |
parent | 406d4f8556d41083bfa551e7a777b0cb02925b6c (diff) |
s/u32bit/size_t/ in asn1
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 820492e18..ae3d48ce2 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 += to_string(id[j]); - if(j != id.size() - 1) + oid_str += 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); |