mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Code optimization
This commit is contained in:
parent
d198451bb0
commit
79e595c195
12
src/misc.h
12
src/misc.h
@ -55,29 +55,29 @@ private:
|
|||||||
misc(); // Forbidden
|
misc(); // Forbidden
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline QString toQString(std::string str) {
|
static inline QString toQString(const std::string &str) {
|
||||||
return QString::fromLocal8Bit(str.c_str());
|
return QString::fromLocal8Bit(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString toQString(char* str) {
|
static inline QString toQString(const char* str) {
|
||||||
return QString::fromLocal8Bit(str);
|
return QString::fromLocal8Bit(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString toQStringU(std::string str) {
|
static inline QString toQStringU(const std::string &str) {
|
||||||
return QString::fromUtf8(str.c_str());
|
return QString::fromUtf8(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString toQStringU(char* str) {
|
static inline QString toQStringU(const char* str) {
|
||||||
return QString::fromUtf8(str);
|
return QString::fromUtf8(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString toQString(libtorrent::sha1_hash hash) {
|
static inline QString toQString(const libtorrent::sha1_hash &hash) {
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << hash;
|
o << hash;
|
||||||
return QString(o.str().c_str());
|
return QString(o.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline libtorrent::sha1_hash toSha1Hash(QString hash) {
|
static inline libtorrent::sha1_hash toSha1Hash(const QString &hash) {
|
||||||
return libtorrent::sha1_hash(qPrintable(hash));
|
return libtorrent::sha1_hash(qPrintable(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2375,7 +2375,7 @@ QHash<QString, TrackerInfos> QBtSession::getTrackersInfo(QString hash) const{
|
|||||||
}
|
}
|
||||||
|
|
||||||
int QBtSession::getListenPort() const{
|
int QBtSession::getListenPort() const{
|
||||||
qDebug() << getListenPort() << s->listen_port();
|
qDebug() << Q_FUNC_INFO << s->listen_port();
|
||||||
return s->listen_port();
|
return s->listen_port();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user