mirror of
https://github.com/aria2/aria2.git
synced 2025-04-07 06:27:37 +03:00
Replaced gid_t with a2_gid_t cause gid_t is commonly used as group ID.
This commit is contained in:
parent
09c120da9b
commit
6e818a06dc
10 changed files with 62 additions and 62 deletions
|
@ -45,7 +45,7 @@
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
SharedHandle<DownloadContext>
|
SharedHandle<DownloadContext>
|
||||||
BtRegistry::getDownloadContext(gid_t gid) const
|
BtRegistry::getDownloadContext(a2_gid_t gid) const
|
||||||
{
|
{
|
||||||
return get(gid).downloadContext_;
|
return get(gid).downloadContext_;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ SharedHandle<DownloadContext>
|
||||||
BtRegistry::getDownloadContext(const std::string& infoHash) const
|
BtRegistry::getDownloadContext(const std::string& infoHash) const
|
||||||
{
|
{
|
||||||
SharedHandle<DownloadContext> dctx;
|
SharedHandle<DownloadContext> dctx;
|
||||||
for(std::map<gid_t, BtObject>::const_iterator i = pool_.begin(),
|
for(std::map<a2_gid_t, BtObject>::const_iterator i = pool_.begin(),
|
||||||
eoi = pool_.end(); i != eoi; ++i) {
|
eoi = pool_.end(); i != eoi; ++i) {
|
||||||
if(bittorrent::getTorrentAttrs((*i).second.downloadContext_)->infoHash ==
|
if(bittorrent::getTorrentAttrs((*i).second.downloadContext_)->infoHash ==
|
||||||
infoHash) {
|
infoHash) {
|
||||||
|
@ -65,14 +65,14 @@ BtRegistry::getDownloadContext(const std::string& infoHash) const
|
||||||
return dctx;
|
return dctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtRegistry::put(gid_t gid, const BtObject& obj)
|
void BtRegistry::put(a2_gid_t gid, const BtObject& obj)
|
||||||
{
|
{
|
||||||
pool_[gid] = obj;
|
pool_[gid] = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
BtObject BtRegistry::get(gid_t gid) const
|
BtObject BtRegistry::get(a2_gid_t gid) const
|
||||||
{
|
{
|
||||||
std::map<gid_t, BtObject>::const_iterator i = pool_.find(gid);
|
std::map<a2_gid_t, BtObject>::const_iterator i = pool_.find(gid);
|
||||||
if(i == pool_.end()) {
|
if(i == pool_.end()) {
|
||||||
return BtObject();
|
return BtObject();
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,7 +80,7 @@ BtObject BtRegistry::get(gid_t gid) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BtRegistry::remove(gid_t gid)
|
bool BtRegistry::remove(a2_gid_t gid)
|
||||||
{
|
{
|
||||||
return pool_.erase(gid);
|
return pool_.erase(gid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,22 +79,22 @@ struct BtObject {
|
||||||
|
|
||||||
class BtRegistry {
|
class BtRegistry {
|
||||||
private:
|
private:
|
||||||
std::map<gid_t, BtObject> pool_;
|
std::map<a2_gid_t, BtObject> pool_;
|
||||||
public:
|
public:
|
||||||
SharedHandle<DownloadContext>
|
SharedHandle<DownloadContext>
|
||||||
getDownloadContext(gid_t gid) const;
|
getDownloadContext(a2_gid_t gid) const;
|
||||||
|
|
||||||
SharedHandle<DownloadContext>
|
SharedHandle<DownloadContext>
|
||||||
getDownloadContext(const std::string& infoHash) const;
|
getDownloadContext(const std::string& infoHash) const;
|
||||||
|
|
||||||
void put(gid_t gid, const BtObject& obj);
|
void put(a2_gid_t gid, const BtObject& obj);
|
||||||
|
|
||||||
BtObject get(gid_t gid) const;
|
BtObject get(a2_gid_t gid) const;
|
||||||
|
|
||||||
template<typename OutputIterator>
|
template<typename OutputIterator>
|
||||||
OutputIterator getAllDownloadContext(OutputIterator dest)
|
OutputIterator getAllDownloadContext(OutputIterator dest)
|
||||||
{
|
{
|
||||||
for(std::map<gid_t, BtObject>::const_iterator i = pool_.begin(),
|
for(std::map<a2_gid_t, BtObject>::const_iterator i = pool_.begin(),
|
||||||
eoi = pool_.end(); i != eoi; ++i) {
|
eoi = pool_.end(); i != eoi; ++i) {
|
||||||
*dest++ = (*i).second.downloadContext_;
|
*dest++ = (*i).second.downloadContext_;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
|
|
||||||
void removeAll();
|
void removeAll();
|
||||||
|
|
||||||
bool remove(gid_t gid);
|
bool remove(a2_gid_t gid);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -54,7 +54,7 @@ class MetadataInfo;
|
||||||
|
|
||||||
struct DownloadResult
|
struct DownloadResult
|
||||||
{
|
{
|
||||||
gid_t gid;
|
a2_gid_t gid;
|
||||||
|
|
||||||
std::vector<SharedHandle<FileEntry> > fileEntries;
|
std::vector<SharedHandle<FileEntry> > fileEntries;
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ struct DownloadResult
|
||||||
|
|
||||||
// This field contains GIDs. See comment in
|
// This field contains GIDs. See comment in
|
||||||
// RequestGroup.cc::followedByGIDs_.
|
// RequestGroup.cc::followedByGIDs_.
|
||||||
std::vector<gid_t> followedBy;
|
std::vector<a2_gid_t> followedBy;
|
||||||
|
|
||||||
// This field contains GID. See comment in
|
// This field contains GID. See comment in
|
||||||
// RequestGroup.cc::belongsToGID_.
|
// RequestGroup.cc::belongsToGID_.
|
||||||
gid_t belongsTo;
|
a2_gid_t belongsTo;
|
||||||
|
|
||||||
SharedHandle<Option> option;
|
SharedHandle<Option> option;
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
gid_t RequestGroup::gidCounter_ = 0;
|
a2_gid_t RequestGroup::gidCounter_ = 0;
|
||||||
|
|
||||||
RequestGroup::RequestGroup(const SharedHandle<Option>& option)
|
RequestGroup::RequestGroup(const SharedHandle<Option>& option)
|
||||||
: gid_(newGID()),
|
: gid_(newGID()),
|
||||||
|
@ -1319,7 +1319,7 @@ bool RequestGroup::p2pInvolved() const
|
||||||
#endif // !ENABLE_BITTORRENT
|
#endif // !ENABLE_BITTORRENT
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t RequestGroup::newGID()
|
a2_gid_t RequestGroup::newGID()
|
||||||
{
|
{
|
||||||
if(gidCounter_ == INT64_MAX) {
|
if(gidCounter_ == INT64_MAX) {
|
||||||
gidCounter_ = 0;
|
gidCounter_ = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class BtRuntime;
|
||||||
class PeerStorage;
|
class PeerStorage;
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
|
|
||||||
typedef int64_t gid_t;
|
typedef int64_t a2_gid_t;
|
||||||
|
|
||||||
class RequestGroup {
|
class RequestGroup {
|
||||||
public:
|
public:
|
||||||
|
@ -83,9 +83,9 @@ public:
|
||||||
USER_REQUEST
|
USER_REQUEST
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
static gid_t gidCounter_;
|
static a2_gid_t gidCounter_;
|
||||||
|
|
||||||
gid_t gid_;
|
a2_gid_t gid_;
|
||||||
|
|
||||||
SharedHandle<Option> option_;
|
SharedHandle<Option> option_;
|
||||||
|
|
||||||
|
@ -161,13 +161,13 @@ private:
|
||||||
// example, downloads generated by PostDownloadHandler), this field
|
// example, downloads generated by PostDownloadHandler), this field
|
||||||
// has the GID of generated RequestGroups. empty list means there is
|
// has the GID of generated RequestGroups. empty list means there is
|
||||||
// no such RequestGroup.
|
// no such RequestGroup.
|
||||||
std::vector<gid_t> followedByGIDs_;
|
std::vector<a2_gid_t> followedByGIDs_;
|
||||||
|
|
||||||
// If this download is a part of another download(for example,
|
// If this download is a part of another download(for example,
|
||||||
// downloading torrent file described in Metalink file), this field
|
// downloading torrent file described in Metalink file), this field
|
||||||
// has the GID of parent RequestGroup. 0 means this is a parent
|
// has the GID of parent RequestGroup. 0 means this is a parent
|
||||||
// RequestGroup.
|
// RequestGroup.
|
||||||
gid_t belongsToGID_;
|
a2_gid_t belongsToGID_;
|
||||||
|
|
||||||
SharedHandle<MetadataInfo> metadataInfo_;
|
SharedHandle<MetadataInfo> metadataInfo_;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public:
|
||||||
return numConcurrentCommand_;
|
return numConcurrentCommand_;
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t getGID() const
|
a2_gid_t getGID() const
|
||||||
{
|
{
|
||||||
return gid_;
|
return gid_;
|
||||||
}
|
}
|
||||||
|
@ -503,17 +503,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<gid_t>& followedBy() const
|
const std::vector<a2_gid_t>& followedBy() const
|
||||||
{
|
{
|
||||||
return followedByGIDs_;
|
return followedByGIDs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void belongsTo(gid_t gid)
|
void belongsTo(a2_gid_t gid)
|
||||||
{
|
{
|
||||||
belongsToGID_ = gid;
|
belongsToGID_ = gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t belongsTo() const
|
a2_gid_t belongsTo() const
|
||||||
{
|
{
|
||||||
return belongsToGID_;
|
return belongsToGID_;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ public:
|
||||||
|
|
||||||
static void resetGIDCounter() { gidCounter_ = 0; }
|
static void resetGIDCounter() { gidCounter_ = 0; }
|
||||||
|
|
||||||
static gid_t newGID();
|
static a2_gid_t newGID();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -167,7 +167,7 @@ SharedHandle<RequestGroup> RequestGroupMan::getRequestGroup(size_t index) const
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
Iterator findByGID(Iterator first, Iterator last, gid_t gid)
|
Iterator findByGID(Iterator first, Iterator last, a2_gid_t gid)
|
||||||
{
|
{
|
||||||
for(; first != last; ++first) {
|
for(; first != last; ++first) {
|
||||||
if((*first)->getGID() == gid) {
|
if((*first)->getGID() == gid) {
|
||||||
|
@ -179,7 +179,7 @@ Iterator findByGID(Iterator first, Iterator last, gid_t gid)
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
SharedHandle<RequestGroup>
|
SharedHandle<RequestGroup>
|
||||||
RequestGroupMan::findRequestGroup(gid_t gid) const
|
RequestGroupMan::findRequestGroup(a2_gid_t gid) const
|
||||||
{
|
{
|
||||||
std::deque<SharedHandle<RequestGroup> >::const_iterator i =
|
std::deque<SharedHandle<RequestGroup> >::const_iterator i =
|
||||||
findByGID(requestGroups_.begin(), requestGroups_.end(), gid);
|
findByGID(requestGroups_.begin(), requestGroups_.end(), gid);
|
||||||
|
@ -191,7 +191,7 @@ RequestGroupMan::findRequestGroup(gid_t gid) const
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<RequestGroup>
|
SharedHandle<RequestGroup>
|
||||||
RequestGroupMan::findReservedGroup(gid_t gid) const
|
RequestGroupMan::findReservedGroup(a2_gid_t gid) const
|
||||||
{
|
{
|
||||||
std::deque<SharedHandle<RequestGroup> >::const_iterator i =
|
std::deque<SharedHandle<RequestGroup> >::const_iterator i =
|
||||||
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
||||||
|
@ -203,7 +203,7 @@ RequestGroupMan::findReservedGroup(gid_t gid) const
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RequestGroupMan::changeReservedGroupPosition
|
size_t RequestGroupMan::changeReservedGroupPosition
|
||||||
(gid_t gid, int pos, HOW how)
|
(a2_gid_t gid, int pos, HOW how)
|
||||||
{
|
{
|
||||||
std::deque<SharedHandle<RequestGroup> >::iterator i =
|
std::deque<SharedHandle<RequestGroup> >::iterator i =
|
||||||
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
||||||
|
@ -246,7 +246,7 @@ size_t RequestGroupMan::changeReservedGroupPosition
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RequestGroupMan::removeReservedGroup(gid_t gid)
|
bool RequestGroupMan::removeReservedGroup(a2_gid_t gid)
|
||||||
{
|
{
|
||||||
std::deque<SharedHandle<RequestGroup> >::iterator i =
|
std::deque<SharedHandle<RequestGroup> >::iterator i =
|
||||||
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
findByGID(reservedGroups_.begin(), reservedGroups_.end(), gid);
|
||||||
|
@ -735,7 +735,7 @@ TransferStat RequestGroupMan::calculateStat()
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<DownloadResult>
|
SharedHandle<DownloadResult>
|
||||||
RequestGroupMan::findDownloadResult(gid_t gid) const
|
RequestGroupMan::findDownloadResult(a2_gid_t gid) const
|
||||||
{
|
{
|
||||||
for(std::deque<SharedHandle<DownloadResult> >::const_iterator i =
|
for(std::deque<SharedHandle<DownloadResult> >::const_iterator i =
|
||||||
downloadResults_.begin(), eoi = downloadResults_.end(); i != eoi; ++i) {
|
downloadResults_.begin(), eoi = downloadResults_.end(); i != eoi; ++i) {
|
||||||
|
@ -746,7 +746,7 @@ RequestGroupMan::findDownloadResult(gid_t gid) const
|
||||||
return SharedHandle<DownloadResult>();
|
return SharedHandle<DownloadResult>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RequestGroupMan::removeDownloadResult(gid_t gid)
|
bool RequestGroupMan::removeDownloadResult(a2_gid_t gid)
|
||||||
{
|
{
|
||||||
for(std::deque<SharedHandle<DownloadResult> >::iterator i =
|
for(std::deque<SharedHandle<DownloadResult> >::iterator i =
|
||||||
downloadResults_.begin(), eoi = downloadResults_.end(); i != eoi; ++i) {
|
downloadResults_.begin(), eoi = downloadResults_.end(); i != eoi; ++i) {
|
||||||
|
|
|
@ -132,14 +132,14 @@ public:
|
||||||
return requestGroups_;
|
return requestGroups_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<RequestGroup> findRequestGroup(gid_t gid) const;
|
SharedHandle<RequestGroup> findRequestGroup(a2_gid_t gid) const;
|
||||||
|
|
||||||
const std::deque<SharedHandle<RequestGroup> >& getReservedGroups() const
|
const std::deque<SharedHandle<RequestGroup> >& getReservedGroups() const
|
||||||
{
|
{
|
||||||
return reservedGroups_;
|
return reservedGroups_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<RequestGroup> findReservedGroup(gid_t gid) const;
|
SharedHandle<RequestGroup> findReservedGroup(a2_gid_t gid) const;
|
||||||
|
|
||||||
enum HOW {
|
enum HOW {
|
||||||
POS_SET,
|
POS_SET,
|
||||||
|
@ -156,9 +156,9 @@ public:
|
||||||
// beyond the end of the queue, it moves the download to the
|
// beyond the end of the queue, it moves the download to the
|
||||||
// beginning or the end of the queue respectively. Returns the
|
// beginning or the end of the queue respectively. Returns the
|
||||||
// destination position.
|
// destination position.
|
||||||
size_t changeReservedGroupPosition(gid_t gid, int pos, HOW how);
|
size_t changeReservedGroupPosition(a2_gid_t gid, int pos, HOW how);
|
||||||
|
|
||||||
bool removeReservedGroup(gid_t gid);
|
bool removeReservedGroup(a2_gid_t gid);
|
||||||
|
|
||||||
void showDownloadResults(std::ostream& o) const;
|
void showDownloadResults(std::ostream& o) const;
|
||||||
|
|
||||||
|
@ -209,14 +209,14 @@ public:
|
||||||
return downloadResults_;
|
return downloadResults_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<DownloadResult> findDownloadResult(gid_t gid) const;
|
SharedHandle<DownloadResult> findDownloadResult(a2_gid_t gid) const;
|
||||||
|
|
||||||
// Removes all download results.
|
// Removes all download results.
|
||||||
void purgeDownloadResult();
|
void purgeDownloadResult();
|
||||||
|
|
||||||
// Removes download result of given gid. Returns true if download
|
// Removes download result of given gid. Returns true if download
|
||||||
// result was removed. Otherwise returns false.
|
// result was removed. Otherwise returns false.
|
||||||
bool removeDownloadResult(gid_t gid);
|
bool removeDownloadResult(a2_gid_t gid);
|
||||||
|
|
||||||
void addDownloadResult(const SharedHandle<DownloadResult>& downloadResult);
|
void addDownloadResult(const SharedHandle<DownloadResult>& downloadResult);
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ const std::string KEY_SERVERS = "servers";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
SharedHandle<ValueBase> createGIDResponse(gid_t gid)
|
SharedHandle<ValueBase> createGIDResponse(a2_gid_t gid)
|
||||||
{
|
{
|
||||||
return String::g(util::itos(gid));
|
return String::g(util::itos(gid));
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ addRequestGroup(const SharedHandle<RequestGroup>& group,
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
SharedHandle<RequestGroup>
|
SharedHandle<RequestGroup>
|
||||||
findRequestGroup(const SharedHandle<RequestGroupMan>& rgman, gid_t gid)
|
findRequestGroup(const SharedHandle<RequestGroupMan>& rgman, a2_gid_t gid)
|
||||||
{
|
{
|
||||||
SharedHandle<RequestGroup> group = rgman->findRequestGroup(gid);
|
SharedHandle<RequestGroup> group = rgman->findRequestGroup(gid);
|
||||||
if(!group) {
|
if(!group) {
|
||||||
|
@ -191,7 +191,7 @@ void getPosParam(const RpcRequest& req, size_t posParamIndex,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
gid_t getRequiredGidParam
|
a2_gid_t getRequiredGidParam
|
||||||
(const RpcRequest& req, size_t posParamIndex)
|
(const RpcRequest& req, size_t posParamIndex)
|
||||||
{
|
{
|
||||||
const String* gidParam = req.getStringParam(posParamIndex);
|
const String* gidParam = req.getStringParam(posParamIndex);
|
||||||
|
@ -365,7 +365,7 @@ namespace {
|
||||||
SharedHandle<ValueBase> removeDownload
|
SharedHandle<ValueBase> removeDownload
|
||||||
(const RpcRequest& req, DownloadEngine* e, bool forceRemove)
|
(const RpcRequest& req, DownloadEngine* e, bool forceRemove)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
e->getRequestGroupMan()->findRequestGroup(gid);
|
e->getRequestGroupMan()->findRequestGroup(gid);
|
||||||
|
@ -436,7 +436,7 @@ namespace {
|
||||||
SharedHandle<ValueBase> pauseDownload
|
SharedHandle<ValueBase> pauseDownload
|
||||||
(const RpcRequest& req, DownloadEngine* e, bool forcePause)
|
(const RpcRequest& req, DownloadEngine* e, bool forcePause)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
bool reserved = false;
|
bool reserved = false;
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
|
@ -508,7 +508,7 @@ SharedHandle<ValueBase> ForcePauseAllRpcMethod::process
|
||||||
SharedHandle<ValueBase> UnpauseRpcMethod::process
|
SharedHandle<ValueBase> UnpauseRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
e->getRequestGroupMan()->findReservedGroup(gid);
|
e->getRequestGroupMan()->findReservedGroup(gid);
|
||||||
if(!group || !group->isPauseRequested()) {
|
if(!group || !group->isPauseRequested()) {
|
||||||
|
@ -645,7 +645,7 @@ void gatherProgressCommon
|
||||||
if(!group->followedBy().empty()) {
|
if(!group->followedBy().empty()) {
|
||||||
SharedHandle<List> list = List::g();
|
SharedHandle<List> list = List::g();
|
||||||
// The element is GID.
|
// The element is GID.
|
||||||
for(std::vector<gid_t>::const_iterator i = group->followedBy().begin(),
|
for(std::vector<a2_gid_t>::const_iterator i = group->followedBy().begin(),
|
||||||
eoi = group->followedBy().end(); i != eoi; ++i) {
|
eoi = group->followedBy().end(); i != eoi; ++i) {
|
||||||
list->append(util::itos(*i));
|
list->append(util::itos(*i));
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ void gatherStoppedDownload
|
||||||
if(!ds->followedBy.empty()) {
|
if(!ds->followedBy.empty()) {
|
||||||
SharedHandle<List> list = List::g();
|
SharedHandle<List> list = List::g();
|
||||||
// The element is GID.
|
// The element is GID.
|
||||||
for(std::vector<gid_t>::const_iterator i = ds->followedBy.begin(),
|
for(std::vector<a2_gid_t>::const_iterator i = ds->followedBy.begin(),
|
||||||
eoi = ds->followedBy.end(); i != eoi; ++i) {
|
eoi = ds->followedBy.end(); i != eoi; ++i) {
|
||||||
list->append(util::itos(*i));
|
list->append(util::itos(*i));
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ void gatherStoppedDownload
|
||||||
SharedHandle<ValueBase> GetFilesRpcMethod::process
|
SharedHandle<ValueBase> GetFilesRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
SharedHandle<List> files = List::g();
|
SharedHandle<List> files = List::g();
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
findRequestGroup(e->getRequestGroupMan(), gid);
|
findRequestGroup(e->getRequestGroupMan(), gid);
|
||||||
|
@ -891,7 +891,7 @@ SharedHandle<ValueBase> GetFilesRpcMethod::process
|
||||||
SharedHandle<ValueBase> GetUrisRpcMethod::process
|
SharedHandle<ValueBase> GetUrisRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
findRequestGroup(e->getRequestGroupMan(), gid);
|
findRequestGroup(e->getRequestGroupMan(), gid);
|
||||||
if(!group) {
|
if(!group) {
|
||||||
|
@ -911,7 +911,7 @@ SharedHandle<ValueBase> GetUrisRpcMethod::process
|
||||||
SharedHandle<ValueBase> GetPeersRpcMethod::process
|
SharedHandle<ValueBase> GetPeersRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
findRequestGroup(e->getRequestGroupMan(), gid);
|
findRequestGroup(e->getRequestGroupMan(), gid);
|
||||||
|
@ -933,7 +933,7 @@ SharedHandle<ValueBase> GetPeersRpcMethod::process
|
||||||
SharedHandle<ValueBase> TellStatusRpcMethod::process
|
SharedHandle<ValueBase> TellStatusRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
const List* keysParam = req.getListParam(1);
|
const List* keysParam = req.getListParam(1);
|
||||||
std::vector<std::string> keys;
|
std::vector<std::string> keys;
|
||||||
|
@ -1041,7 +1041,7 @@ SharedHandle<ValueBase> PurgeDownloadResultRpcMethod::process
|
||||||
SharedHandle<ValueBase> RemoveDownloadResultRpcMethod::process
|
SharedHandle<ValueBase> RemoveDownloadResultRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
if(!e->getRequestGroupMan()->removeDownloadResult(gid)) {
|
if(!e->getRequestGroupMan()->removeDownloadResult(gid)) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(fmt("Could not remove download result of GID#%s",
|
(fmt("Could not remove download result of GID#%s",
|
||||||
|
@ -1053,7 +1053,7 @@ SharedHandle<ValueBase> RemoveDownloadResultRpcMethod::process
|
||||||
SharedHandle<ValueBase> ChangeOptionRpcMethod::process
|
SharedHandle<ValueBase> ChangeOptionRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
findRequestGroup(e->getRequestGroupMan(), gid);
|
findRequestGroup(e->getRequestGroupMan(), gid);
|
||||||
|
@ -1160,7 +1160,7 @@ void pushRequestOption
|
||||||
SharedHandle<ValueBase> GetOptionRpcMethod::process
|
SharedHandle<ValueBase> GetOptionRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
|
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
findRequestGroup(e->getRequestGroupMan(), gid);
|
findRequestGroup(e->getRequestGroupMan(), gid);
|
||||||
|
@ -1192,7 +1192,7 @@ SharedHandle<ValueBase> GetGlobalOptionRpcMethod::process
|
||||||
SharedHandle<ValueBase> ChangePositionRpcMethod::process
|
SharedHandle<ValueBase> ChangePositionRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
const Integer* posParam = req.getIntegerParam(1);
|
const Integer* posParam = req.getIntegerParam(1);
|
||||||
const String* howParam = req.getStringParam(2);
|
const String* howParam = req.getStringParam(2);
|
||||||
|
|
||||||
|
@ -1228,7 +1228,7 @@ SharedHandle<ValueBase> GetSessionInfoRpcMethod::process
|
||||||
SharedHandle<ValueBase> GetServersRpcMethod::process
|
SharedHandle<ValueBase> GetServersRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
SharedHandle<RequestGroup> group =
|
SharedHandle<RequestGroup> group =
|
||||||
e->getRequestGroupMan()->findRequestGroup(gid);
|
e->getRequestGroupMan()->findRequestGroup(gid);
|
||||||
if(!group) {
|
if(!group) {
|
||||||
|
@ -1267,7 +1267,7 @@ SharedHandle<ValueBase> GetServersRpcMethod::process
|
||||||
SharedHandle<ValueBase> ChangeUriRpcMethod::process
|
SharedHandle<ValueBase> ChangeUriRpcMethod::process
|
||||||
(const RpcRequest& req, DownloadEngine* e)
|
(const RpcRequest& req, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
gid_t gid = getRequiredGidParam(req, 0);
|
a2_gid_t gid = getRequiredGidParam(req, 0);
|
||||||
const Integer* indexParam = req.getIntegerParam(1);
|
const Integer* indexParam = req.getIntegerParam(1);
|
||||||
const List* delUrisParam = req.getListParam(2);
|
const List* delUrisParam = req.getListParam(2);
|
||||||
const List* addUrisParam = req.getListParam(3);
|
const List* addUrisParam = req.getListParam(3);
|
||||||
|
|
|
@ -282,7 +282,7 @@ bool isUtf8(const std::string& str)
|
||||||
firstChar == 0x09u || firstChar == 0x0au ||firstChar == 0x0du) {
|
firstChar == 0x09u || firstChar == 0x0au ||firstChar == 0x0du) {
|
||||||
// UTF8-1 (without ctrl chars)
|
// UTF8-1 (without ctrl chars)
|
||||||
} else if(in(firstChar, 0xc2u, 0xdfu)) {
|
} else if(in(firstChar, 0xc2u, 0xdfu)) {
|
||||||
// UTF8-2
|
// UTF8-2
|
||||||
if(++s == eos || !isUtf8Tail(*s)) {
|
if(++s == eos || !isUtf8Tail(*s)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1472,7 +1472,7 @@ namespace {
|
||||||
|
|
||||||
void executeHook
|
void executeHook
|
||||||
(const std::string& command,
|
(const std::string& command,
|
||||||
gid_t gid,
|
a2_gid_t gid,
|
||||||
size_t numFiles,
|
size_t numFiles,
|
||||||
const std::string& firstFilename)
|
const std::string& firstFilename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -713,7 +713,7 @@ void RpcMethodTest::testGetVersion()
|
||||||
void RpcMethodTest::testGatherStoppedDownload()
|
void RpcMethodTest::testGatherStoppedDownload()
|
||||||
{
|
{
|
||||||
std::vector<SharedHandle<FileEntry> > fileEntries;
|
std::vector<SharedHandle<FileEntry> > fileEntries;
|
||||||
std::vector<gid_t> followedBy;
|
std::vector<a2_gid_t> followedBy;
|
||||||
followedBy.push_back(3);
|
followedBy.push_back(3);
|
||||||
followedBy.push_back(4);
|
followedBy.push_back(4);
|
||||||
SharedHandle<DownloadResult> d(new DownloadResult());
|
SharedHandle<DownloadResult> d(new DownloadResult());
|
||||||
|
@ -853,7 +853,7 @@ void RpcMethodTest::testChangePosition()
|
||||||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||||
CPPUNIT_ASSERT_EQUAL((int64_t)1, asInteger(res.param)->i());
|
CPPUNIT_ASSERT_EQUAL((int64_t)1, asInteger(res.param)->i());
|
||||||
CPPUNIT_ASSERT_EQUAL
|
CPPUNIT_ASSERT_EQUAL
|
||||||
((gid_t)1, e_->getRequestGroupMan()->getReservedGroups()[1]->getGID());
|
((a2_gid_t)1, e_->getRequestGroupMan()->getReservedGroups()[1]->getGID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RpcMethodTest::testChangePosition_fail()
|
void RpcMethodTest::testChangePosition_fail()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue