diff options
author | lloyd <[email protected]> | 2006-05-27 16:41:24 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-05-27 16:41:24 +0000 |
commit | c4204430b1c050c54a464b677c4a90a785542b1a (patch) | |
tree | 980cffcf93a8b74cac0ee155faa6e95fd594739b /src/der_enc.cpp | |
parent | a5c9bc9588c21d97ae66ca56c0198f91d134a7fd (diff) |
Use .empty() instead of comparing .size() to 0 in a few cases, and
reorder an if statement for better readability.
Diffstat (limited to 'src/der_enc.cpp')
-rw-r--r-- | src/der_enc.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/der_enc.cpp b/src/der_enc.cpp index a3d61152b..b389d5694 100644 --- a/src/der_enc.cpp +++ b/src/der_enc.cpp @@ -171,7 +171,7 @@ DER_Encoder& DER_Encoder::start_cons(ASN1_Tag type_tag, *************************************************/ DER_Encoder& DER_Encoder::end_cons() { - if(subsequences.size() == 0) + if(subsequences.empty()) throw Invalid_State("DER_Encoder::end_cons: No such sequence"); SecureVector<byte> seq = subsequences[subsequences.size()-1].get_contents(); @@ -214,10 +214,11 @@ DER_Encoder& DER_Encoder::raw_bytes(const MemoryRegion<byte>& val) *************************************************/ DER_Encoder& DER_Encoder::raw_bytes(const byte bytes[], u32bit length) { - if(subsequences.size() == 0) - contents.append(bytes, length); - else + if(subsequences.size()) subsequences[subsequences.size()-1].add_bytes(bytes, length); + else + contents.append(bytes, length); + return (*this); } |