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>
Code cleanup.

View File

@ -79,27 +79,6 @@ public:
SharedHandle<Option> option;
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;

View File

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

View File

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