Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: crypto/rsa_private_key.cc

Issue 8533028: RSAPrivateKey vector push_back cleanups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | crypto/rsa_private_key_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key.cc
diff --git a/crypto/rsa_private_key.cc b/crypto/rsa_private_key.cc
index 8290d1602ae5771cead6dc92e3c95c1e1cf732a6..2d849cdbd7a661894a5bbfbd09d4b69e4d44b117 100644
--- a/crypto/rsa_private_key.cc
+++ b/crypto/rsa_private_key.cc
@@ -81,8 +81,7 @@ bool PrivateKeyInfoCodec::Export(std::vector<uint8>* output) {
// Copy everying into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -107,8 +106,7 @@ bool PrivateKeyInfoCodec::ExportPublicKeyInfo(std::vector<uint8>* output) {
// Copy everything into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -124,8 +122,7 @@ bool PrivateKeyInfoCodec::ExportPublicKey(std::vector<uint8>* output) {
// Copy everything into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -238,10 +235,7 @@ bool PrivateKeyInfoCodec::ReadIntegerWithExpectedSize(uint8** pos,
READ_ASSERT(out->size() <= expected_size);
}
- while (pad) {
- out->push_back(0x00);
- pad--;
- }
+ out->insert(out->end(), pad, 0x00);
out->insert(out->end(), temp.begin(), temp.end());
// Reverse output if little-endian.
« no previous file with comments | « no previous file | crypto/rsa_private_key_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698