Pass A2Gid by value, since it is uint64_t

pull/98/head
Tatsuhiro Tsujikawa 2013-06-12 00:09:42 +09:00
parent f4085b310f
commit 81e6b68443
2 changed files with 17 additions and 18 deletions

View File

@ -174,7 +174,7 @@ int shutdown(Session* session, bool force)
return 0; return 0;
} }
std::string gidToHex(const A2Gid& gid) std::string gidToHex(A2Gid gid)
{ {
return GroupId::toHex(gid); return GroupId::toHex(gid);
} }
@ -189,7 +189,7 @@ A2Gid hexToGid(const std::string& hex)
} }
} }
bool isNull(const A2Gid& gid) bool isNull(A2Gid gid)
{ {
return gid == 0; return gid == 0;
} }
@ -382,7 +382,7 @@ int addTorrent(Session* session,
options, position); options, position);
} }
int removeDownload(Session* session, const A2Gid& gid, bool force) int removeDownload(Session* session, A2Gid gid, bool force)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();
@ -408,7 +408,7 @@ int removeDownload(Session* session, const A2Gid& gid, bool force)
return 0; return 0;
} }
int pauseDownload(Session* session, const A2Gid& gid, bool force) int pauseDownload(Session* session, A2Gid gid, bool force)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();
@ -423,7 +423,7 @@ int pauseDownload(Session* session, const A2Gid& gid, bool force)
return -1; return -1;
} }
int unpauseDownload(Session* session, const A2Gid& gid) int unpauseDownload(Session* session, A2Gid gid)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();
@ -439,7 +439,7 @@ int unpauseDownload(Session* session, const A2Gid& gid)
return 0; return 0;
} }
int changePosition(Session* session, const A2Gid& gid, int pos, OffsetMode how) int changePosition(Session* session, A2Gid gid, int pos, OffsetMode how)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();
@ -451,7 +451,7 @@ int changePosition(Session* session, const A2Gid& gid, int pos, OffsetMode how)
} }
} }
int changeOption(Session* session, const A2Gid& gid, const KeyVals& options) int changeOption(Session* session, A2Gid gid, const KeyVals& options)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();
@ -942,7 +942,7 @@ struct DownloadResultDH : public DownloadHandle {
}; };
} // namespace } // namespace
DownloadHandle* getDownloadHandle(Session* session, const A2Gid& gid) DownloadHandle* getDownloadHandle(Session* session, A2Gid gid)
{ {
const SharedHandle<DownloadEngine>& e = const SharedHandle<DownloadEngine>& e =
session->context->reqinfo->getDownloadEngine(); session->context->reqinfo->getDownloadEngine();

View File

@ -143,7 +143,7 @@ enum DownloadEvent {
* of this callback should return 0 for compatibility. * of this callback should return 0 for compatibility.
*/ */
typedef int (*DownloadEventCallback)(Session* session, DownloadEvent event, typedef int (*DownloadEventCallback)(Session* session, DownloadEvent event,
const A2Gid& gid, void* userData); A2Gid gid, void* userData);
/** /**
* @struct * @struct
@ -257,7 +257,7 @@ int run(Session* session, RUN_MODE mode);
* *
* Returns textual representation of the |gid|. * Returns textual representation of the |gid|.
*/ */
std::string gidToHex(const A2Gid& gid); std::string gidToHex(A2Gid gid);
/** /**
* @function * @function
@ -271,7 +271,7 @@ A2Gid hexToGid(const std::string& hex);
* *
* Returns true if the |gid| is invalid. * Returns true if the |gid| is invalid.
*/ */
bool isNull(const A2Gid& gid); bool isNull(A2Gid gid);
/** /**
* @function * @function
@ -375,7 +375,7 @@ std::vector<A2Gid> getActiveDownload(Session* session);
* takes time such as contacting BitTorrent tracker. This function * takes time such as contacting BitTorrent tracker. This function
* returns 0 if it succeeds, or negative error code. * returns 0 if it succeeds, or negative error code.
*/ */
int removeDownload(Session* session, const A2Gid& gid, bool force = false); int removeDownload(Session* session, A2Gid gid, bool force = false);
/** /**
* @function * @function
@ -395,7 +395,7 @@ int removeDownload(Session* session, const A2Gid& gid, bool force = false);
* :member:`SessionConfig::keepRunning` to true. Otherwise, the * :member:`SessionConfig::keepRunning` to true. Otherwise, the
* behavior is undefined. * behavior is undefined.
*/ */
int pauseDownload(Session* session, const A2Gid& gid, bool force = false); int pauseDownload(Session* session, A2Gid gid, bool force = false);
/** /**
* @function * @function
@ -405,7 +405,7 @@ int pauseDownload(Session* session, const A2Gid& gid, bool force = false);
* makes the download eligible to restart. This function returns 0 if * makes the download eligible to restart. This function returns 0 if
* it succeeds, or negative error code. * it succeeds, or negative error code.
*/ */
int unpauseDownload(Session* session, const A2Gid& gid); int unpauseDownload(Session* session, A2Gid gid);
/** /**
* @function * @function
@ -437,7 +437,7 @@ int unpauseDownload(Session* session, const A2Gid& gid);
* *
* This function returns 0 if it succeeds, or negative error code. * This function returns 0 if it succeeds, or negative error code.
*/ */
int changeOption(Session* session, const A2Gid& gid, const KeyVals& options); int changeOption(Session* session, A2Gid gid, const KeyVals& options);
/** /**
* @function * @function
@ -571,8 +571,7 @@ enum OffsetMode {
* This function returns the final destination position of this * This function returns the final destination position of this
* download, or negative error code. * download, or negative error code.
*/ */
int changePosition(Session* session, const A2Gid& gid, int pos, int changePosition(Session* session, A2Gid gid, int pos, OffsetMode how);
OffsetMode how);
/** /**
* @function * @function
@ -884,7 +883,7 @@ public:
* responsibility of the caller to call :func:`deleteDownloadHandle()` * responsibility of the caller to call :func:`deleteDownloadHandle()`
* to delete handle object. * to delete handle object.
*/ */
DownloadHandle* getDownloadHandle(Session* session, const A2Gid& gid); DownloadHandle* getDownloadHandle(Session* session, A2Gid gid);
/** /**
* @function * @function