Browse Source

Code optimization

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
79e595c195
  1. 12
      src/misc.h
  2. 2
      src/qtlibtorrent/qbtsession.cpp

12
src/misc.h

@ -55,29 +55,29 @@ private: @@ -55,29 +55,29 @@ private:
misc(); // Forbidden
public:
static inline QString toQString(std::string str) {
static inline QString toQString(const std::string &str) {
return QString::fromLocal8Bit(str.c_str());
}
static inline QString toQString(char* str) {
static inline QString toQString(const char* 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());
}
static inline QString toQStringU(char* str) {
static inline QString toQStringU(const char* 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;
o << hash;
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));
}

2
src/qtlibtorrent/qbtsession.cpp

@ -2375,7 +2375,7 @@ QHash<QString, TrackerInfos> QBtSession::getTrackersInfo(QString hash) const{ @@ -2375,7 +2375,7 @@ QHash<QString, TrackerInfos> QBtSession::getTrackersInfo(QString hash) const{
}
int QBtSession::getListenPort() const{
qDebug() << getListenPort() << s->listen_port();
qDebug() << Q_FUNC_INFO << s->listen_port();
return s->listen_port();
}

Loading…
Cancel
Save