mirror of https://github.com/aria2/aria2
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use std::vector::reserve() for fileEntries and pieceHashes in bittorrent_helper * src/bittorrent_helper.ccpull/1/head
parent
e45a0e7e5f
commit
e1d63f3aea
|
@ -1,3 +1,9 @@
|
|||
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Use std::vector::reserve() for fileEntries and pieceHashes in
|
||||
bittorrent_helper
|
||||
* src/bittorrent_helper.cc
|
||||
|
||||
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed calls to Request::resetUrl() in AbstractCommand.cc.
|
||||
|
|
|
@ -112,6 +112,7 @@ static void extractPieceHash(const SharedHandle<DownloadContext>& ctx,
|
|||
size_t numPieces)
|
||||
{
|
||||
std::vector<std::string> pieceHashes;
|
||||
pieceHashes.reserve(numPieces);
|
||||
for(size_t i = 0; i < numPieces; ++i) {
|
||||
pieceHashes.push_back(Util::toHex(hashData.data()+i*hashLength,
|
||||
hashLength));
|
||||
|
@ -184,6 +185,7 @@ static void extractFileEntries
|
|||
const BDE& filesList = infoDict[C_FILES];
|
||||
std::vector<SharedHandle<FileEntry> > fileEntries;
|
||||
if(filesList.isList()) {
|
||||
fileEntries.reserve(filesList.size());
|
||||
uint64_t length = 0;
|
||||
off_t offset = 0;
|
||||
// multi-file mode
|
||||
|
|
Loading…
Reference in New Issue