From 31592c145bec6f8713543ddda45641b659e76c7b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 21 Jun 2012 20:18:15 -0700 Subject: [PATCH] Fix one bogus and one questionable use of 'reserve' --- src/HashedObject.cpp | 2 -- src/PubKeyCache.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/HashedObject.cpp b/src/HashedObject.cpp index 68a7512b3..ceb7a1b2a 100644 --- a/src/HashedObject.cpp +++ b/src/HashedObject.cpp @@ -80,8 +80,6 @@ HashedObject::pointer HashedObject::retrieve(const uint256& hash) std::string type; uint32 index; std::vector data; - data.reserve(8192); - { ScopedLock sl(theApp->getHashNodeDB()->getDBLock()); Database* db = theApp->getHashNodeDB()->getDB(); diff --git a/src/PubKeyCache.cpp b/src/PubKeyCache.cpp index f870908f6..011996954 100644 --- a/src/PubKeyCache.cpp +++ b/src/PubKeyCache.cpp @@ -17,7 +17,7 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id) sql.append(id.humanAccountID()); sql.append("';'"); std::vector data; - data.reserve(65); // our public keys are actually 33 bytes + data.resize(66); // our public keys are actually 33 bytes int pkSize; { // is it in the database @@ -25,7 +25,7 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id) Database* db=theApp->getTxnDB()->getDB(); if(!db->executeSQL(sql) || !db->startIterRows()) return CKey::pointer(); - pkSize=db->getBinary("PubKey", &(data.front()), data.size()); + pkSize = db->getBinary("PubKey", &(data.front()), data.size()); db->endIterRows(); } data.resize(pkSize);