2010-05-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Removed DownloadResult's ctor because it has many args.
	* src/DownloadResult.h
	* src/RequestGroup.cc
	* test/XmlRpcMethodTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2010-05-20 12:16:50 +00:00
parent 2284c0a837
commit 8f3cdfb2de
4 changed files with 28 additions and 44 deletions

View File

@ -1,3 +1,10 @@
2010-05-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed DownloadResult's ctor because it has many args.
* src/DownloadResult.h
* src/RequestGroup.cc
* test/XmlRpcMethodTest.cc
2010-05-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-05-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Code cleanup. Code cleanup.

View File

@ -79,27 +79,6 @@ public:
SharedHandle<Option> option; SharedHandle<Option> option;
SharedHandle<MetadataInfo> metadataInfo; SharedHandle<MetadataInfo> metadataInfo;
DownloadResult(gid_t gid,
const std::vector<SharedHandle<FileEntry> >& fileEntries,
bool inMemoryDownload,
uint64_t sessionDownloadLength,
int64_t sessionTime,
downloadresultcode::RESULT result,
const std::vector<gid_t> followedBy,
gid_t belongsTo,
const SharedHandle<Option>& option,
const SharedHandle<MetadataInfo>& metadataInfo):
gid(gid),
fileEntries(fileEntries),
inMemoryDownload(inMemoryDownload),
sessionDownloadLength(sessionDownloadLength),
sessionTime(sessionTime),
result(result),
followedBy(followedBy),
belongsTo(belongsTo),
option(option),
metadataInfo(metadataInfo) {}
}; };
typedef SharedHandle<DownloadResult> DownloadResultHandle; typedef SharedHandle<DownloadResult> DownloadResultHandle;

View File

@ -1057,18 +1057,18 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
sessionDownloadLength += sessionDownloadLength +=
_segmentMan->calculateSessionDownloadLength(); _segmentMan->calculateSessionDownloadLength();
} }
return SharedHandle<DownloadResult> res(new DownloadResult());
SharedHandle<DownloadResult> res->gid = _gid;
(new DownloadResult(_gid, res->fileEntries = _downloadContext->getFileEntries();
_downloadContext->getFileEntries(), res->inMemoryDownload = _inMemoryDownload;
_inMemoryDownload, res->sessionDownloadLength = sessionDownloadLength;
sessionDownloadLength, res->sessionTime = _downloadContext->calculateSessionTime();
_downloadContext->calculateSessionTime(), res->result = downloadResult();
downloadResult(), res->followedBy = _followedByGIDs;
_followedByGIDs, res->belongsTo = _belongsToGID;
_belongsToGID, res->option = _option;
_option, res->metadataInfo = _metadataInfo;
_metadataInfo)); return res;
} }
void RequestGroup::reportDownloadFinished() void RequestGroup::reportDownloadFinished()

View File

@ -674,17 +674,15 @@ void XmlRpcMethodTest::testGatherStoppedDownload()
std::vector<gid_t> followedBy; std::vector<gid_t> followedBy;
followedBy.push_back(3); followedBy.push_back(3);
followedBy.push_back(4); followedBy.push_back(4);
SharedHandle<DownloadResult> d SharedHandle<DownloadResult> d(new DownloadResult());
(new DownloadResult(1, d->gid = 1;
fileEntries, d->fileEntries = fileEntries;
false, d->inMemoryDownload = false;
UINT64_MAX, d->sessionDownloadLength = UINT64_MAX;
1000, d->sessionTime = 1000;
downloadresultcode::FINISHED, d->result = downloadresultcode::FINISHED;
followedBy, d->followedBy = followedBy;
2, d->belongsTo = 2;
SharedHandle<Option>(),
SharedHandle<MetadataInfo>()));
BDE entry = BDE::dict(); BDE entry = BDE::dict();
gatherStoppedDownload(entry, d); gatherStoppedDownload(entry, d);