chore: remove unused methods (#1207)

* chore: remove unused methods in qt client

* chore: remove unused libtransmission methods

* chore: remove unused gtk methods

* chore: remove more unused libtransmission methods

* chore: remove more unused code found by @reardonia
This commit is contained in:
Charles Kerr 2020-05-11 17:20:46 -05:00 committed by GitHub
parent 79d3133ebc
commit fa6df52d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 0 additions and 177 deletions

View File

@ -583,19 +583,6 @@ void gtr_dialog_set_content(GtkDialog* dialog, GtkWidget* content)
****
***/
void gtr_http_failure_dialog(GtkWidget* parent, char const* url, long response_code)
{
GtkWindow* window = getWindow(parent);
GtkWidget* w = gtk_message_dialog_new(window, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error opening \"%s\""), url);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), _("Server returned \"%1$ld %2$s\""), response_code,
tr_webGetResponseStr(response_code));
g_signal_connect_swapped(w, "response", G_CALLBACK(gtk_widget_destroy), w);
gtk_widget_show(w);
}
void gtr_unrecognized_url_dialog(GtkWidget* parent, char const* url)
{
char const* xt = "xt=urn:btih";

View File

@ -133,8 +133,6 @@ void gtr_freespace_label_set_dir(GtkWidget* label, char const* dir);
void gtr_unrecognized_url_dialog(GtkWidget* parent, char const* url);
void gtr_http_failure_dialog(GtkWidget* parent, char const* url, long response_code);
void gtr_add_torrent_error_dialog(GtkWidget* window_or_child, int err, tr_torrent* duplicate_torrent, char const* filename);
/* pop up the context menu if a user right-clicks.

View File

@ -204,11 +204,6 @@ static struct tr_scrape_info* tr_announcerGetScrapeInfo(struct tr_announcer* ann
return info;
}
bool tr_announcerHasBacklog(struct tr_announcer const* announcer)
{
return announcer->slotsAvailable < 1;
}
static void onUpkeepTimer(evutil_socket_t foo UNUSED, short bar UNUSED, void* vannouncer);
void tr_announcerInit(tr_session* session)

View File

@ -67,8 +67,6 @@ void tr_announcerClose(tr_session*);
struct tr_torrent_tiers* tr_announcerAddTorrent(tr_torrent* torrent, tr_tracker_callback cb, void* cbdata);
bool tr_announcerHasBacklog(struct tr_announcer const*);
void tr_announcerResetTorrent(struct tr_announcer*, tr_torrent*);
void tr_announcerRemoveTorrent(struct tr_announcer*, tr_torrent*);

View File

@ -11,20 +11,6 @@
#include "tr-assert.h"
#include "utils.h"
tr_error* tr_error_new(int code, char const* message_format, ...)
{
TR_ASSERT(message_format != NULL);
tr_error* error;
va_list args;
va_start(args, message_format);
error = tr_error_new_valist(code, message_format, args);
va_end(args);
return error;
}
tr_error* tr_error_new_literal(int code, char const* message)
{
TR_ASSERT(message != NULL);

View File

@ -32,17 +32,6 @@ typedef struct tr_error
}
tr_error;
/**
* @brief Create new error object using `printf`-style formatting.
*
* @param[in] code Error code (platform-specific).
* @param[in] message_format Error message format string.
* @param[in] ... Format arguments.
*
* @return Newly allocated error object on success, `NULL` otherwise.
*/
tr_error* tr_error_new(int code, char const* message_format, ...) TR_GNUC_PRINTF(2, 3);
/**
* @brief Create new error object using literal error message.
*

View File

@ -81,12 +81,6 @@ enum
#define HANDSHAKE_SET_DHT(bits) ((void)0)
#endif
/* http://www.azureuswiki.com/index.php/Extension_negotiation_protocol
these macros are to be used if both extended messaging and the
azureus protocol is supported, they indicate which protocol is preferred */
#define HANDSHAKE_GET_EXTPREF(reserved) ((reserved)[5] & 0x03)
#define HANDSHAKE_SET_EXTPREF(reserved, val) ((reserved)[5] |= 0x03 & (val))
/**
***
**/
@ -1252,14 +1246,6 @@ tr_handshake* tr_handshakeNew(tr_peerIo* io, tr_encryption_mode encryptionMode,
return handshake;
}
struct tr_peerIo* tr_handshakeGetIO(tr_handshake* handshake)
{
TR_ASSERT(handshake != NULL);
TR_ASSERT(handshake->io != NULL);
return handshake->io;
}
struct tr_peerIo* tr_handshakeStealIO(tr_handshake* handshake)
{
TR_ASSERT(handshake != NULL);

View File

@ -36,8 +36,6 @@ tr_address const* tr_handshakeGetAddr(struct tr_handshake const* handshake, tr_p
void tr_handshakeAbort(tr_handshake* handshake);
struct tr_peerIo* tr_handshakeGetIO(tr_handshake* handshake);
struct tr_peerIo* tr_handshakeStealIO(tr_handshake* handshake);
/** @} */

View File

@ -2204,19 +2204,6 @@ void tr_peerMgrAddPex(tr_torrent* tor, uint8_t from, tr_pex const* pex, int8_t s
}
}
void tr_peerMgrMarkAllAsSeeds(tr_torrent* tor)
{
tr_swarm* s = tor->swarm;
int const n = tr_ptrArraySize(&s->pool);
struct peer_atom** it = (struct peer_atom**)tr_ptrArrayBase(&s->pool);
struct peer_atom** end = it + n;
while (it != end)
{
atomSetSeed(s, *it++);
}
}
tr_pex* tr_peerMgrCompactToPex(void const* compact, size_t compactLen, uint8_t const* added_f, size_t added_f_len,
size_t* pexCount)
{
@ -2267,24 +2254,6 @@ tr_pex* tr_peerMgrCompact6ToPex(void const* compact, size_t compactLen, uint8_t
return pex;
}
tr_pex* tr_peerMgrArrayToPex(void const* array, size_t arrayLen, size_t* pexCount)
{
size_t n = arrayLen / (sizeof(tr_address) + 2);
uint8_t const* walk = array;
tr_pex* pex = tr_new0(tr_pex, n);
for (size_t i = 0; i < n; ++i)
{
memcpy(&pex[i].addr, walk, sizeof(tr_address));
memcpy(&pex[i].port, walk + sizeof(tr_address), 2);
pex[i].flags = 0x00;
walk += sizeof(tr_address) + 2;
}
*pexCount = n;
return pex;
}
/**
***
**/

View File

@ -95,15 +95,11 @@ tr_pex* tr_peerMgrCompactToPex(void const* compact, size_t compactLen, uint8_t c
tr_pex* tr_peerMgrCompact6ToPex(void const* compact, size_t compactLen, uint8_t const* added_f, size_t added_f_len,
size_t* pexCount);
tr_pex* tr_peerMgrArrayToPex(void const* array, size_t arrayLen, size_t* setme_pex_count);
/**
* @param seedProbability [0..100] for likelihood that the peer is a seed; -1 for unknown
*/
void tr_peerMgrAddPex(tr_torrent* tor, uint8_t from, tr_pex const* pex, int8_t seedProbability);
void tr_peerMgrMarkAllAsSeeds(tr_torrent* tor);
enum
{
TR_PEERS_CONNECTED,

View File

@ -1782,11 +1782,6 @@ void tr_sessionSetAltSpeedFunc(tr_session* session, tr_altSpeedFunc func, void*
session->turtle.callbackUserData = userData;
}
void tr_sessionClearAltSpeedFunc(tr_session* session)
{
tr_sessionSetAltSpeedFunc(session, NULL, NULL);
}
/***
****
***/

View File

@ -566,7 +566,6 @@ tr_sched_day tr_sessionGetAltSpeedDay(tr_session const*);
typedef void (* tr_altSpeedFunc)(tr_session*, bool active, bool userDriven, void*);
void tr_sessionClearAltSpeedFunc(tr_session*);
void tr_sessionSetAltSpeedFunc(tr_session*, tr_altSpeedFunc, void*);
bool tr_sessionGetActiveSpeedLimit_KBps(tr_session const* session, tr_direction dir, double* setme);

View File

@ -79,11 +79,6 @@ void FaviconCache::ensureCacheDirHasBeenScanned()
****
***/
QString FaviconCache::getDisplayName(QUrl const& url)
{
return getDisplayName(getKey(url));
}
QString FaviconCache::getDisplayName(QString const& key)
{
auto name = key;

View File

@ -36,7 +36,6 @@ public:
// Returns the key.
QString add(QUrl const& url);
static QString getDisplayName(QUrl const& url);
static QString getDisplayName(QString const& key);
static QString getKey(QUrl const& url);
static QString getKey(QString const& displayName);

View File

@ -30,20 +30,6 @@ FilterBarComboBox::FilterBarComboBox(QWidget* parent) :
setSizeAdjustPolicy(QComboBox::AdjustToContents);
}
int FilterBarComboBox::currentCount() const
{
int count = 0;
QModelIndex const modelIndex = model()->index(currentIndex(), 0, rootModelIndex());
if (modelIndex.isValid())
{
count = modelIndex.data(CountRole).toInt();
}
return count;
}
QSize FilterBarComboBox::minimumSizeHint() const
{
QFontMetrics fm(fontMetrics());

View File

@ -25,8 +25,6 @@ public:
public:
FilterBarComboBox(QWidget* parent = nullptr);
int currentCount() const;
// QWidget
QSize minimumSizeHint() const override;
QSize sizeHint() const override;

View File

@ -17,11 +17,6 @@ RpcQueue::RpcQueue(QObject* parent) :
connect(&myFutureWatcher, SIGNAL(finished()), SLOT(stepFinished()));
}
RpcResponseFuture RpcQueue::future()
{
return myPromise.future();
}
void RpcQueue::stepFinished()
{
RpcResponse result;

View File

@ -43,8 +43,6 @@ public:
myQueue.enqueue(qMakePair(normalizeFunc(func), normalizeErrorHandler(errorHandler)));
}
RpcResponseFuture future();
// The first function in queue is ran synchronously
// (hence it may be e. g. a lambda capturing local variables by reference).
void run();

View File

@ -407,19 +407,6 @@ bool Torrent::getSeedRatio(double& ratio) const
return isLimited;
}
bool Torrent::hasFileSubstring(QString const& substr) const
{
for (TorrentFile const& file : myFiles)
{
if (file.filename.contains(substr, Qt::CaseInsensitive))
{
return true;
}
}
return false;
}
bool Torrent::hasTrackerSubstring(QString const& substr) const
{
for (auto const& s : trackers())
@ -519,14 +506,6 @@ int Torrent::compareETA(Torrent const& that) const
return 0;
}
int Torrent::compareTracker(Torrent const& that) const
{
Q_UNUSED(that)
// FIXME
return 0;
}
/***
****
***/

View File

@ -342,7 +342,6 @@ public:
return getSize(FAILED_EVER);
}
int compareTracker(Torrent const&) const;
int compareSeedRatio(Torrent const&) const;
int compareRatio(Torrent const&) const;
int compareETA(Torrent const&) const;
@ -432,7 +431,6 @@ public:
return getDouble(PERCENT_VERIFIED);
}
bool hasFileSubstring(QString const& substr) const;
bool hasTrackerSubstring(QString const& substr) const;
Speed uploadLimit() const

View File

@ -313,11 +313,6 @@ bool TorrentFilter::filterAcceptsRow(int sourceRow, QModelIndex const& sourcePar
return accepts;
}
int TorrentFilter::hiddenRowCount() const
{
return sourceModel()->rowCount() - rowCount();
}
void TorrentFilter::countTorrentsPerMode(int* setmeCounts) const
{
std::fill_n(setmeCounts, static_cast<std::size_t>(FilterMode::NUM_MODES), 0);

View File

@ -33,8 +33,6 @@ public:
TorrentFilter(Prefs const& prefs);
virtual ~TorrentFilter();
int hiddenRowCount() const;
void countTorrentsPerMode(int* setmeCounts) const;
protected:

View File

@ -349,11 +349,6 @@ std::optional<int> TorrentModel::getRow(int id) const
return row;
}
std::optional<int> TorrentModel::getRow(Torrent const* tor) const
{
return getRow(tor->id());
}
Torrent* TorrentModel::getTorrentFromId(int id)
{
auto const row = getRow(id);

View File

@ -68,7 +68,6 @@ private:
void rowsEmitChanged(torrent_ids_t const& ids);
std::optional<int> getRow(int id) const;
std::optional<int> getRow(Torrent const* tor) const;
using span_t = std::pair<int, int>;
std::vector<span_t> getSpans(torrent_ids_t const& ids) const;

View File

@ -86,13 +86,6 @@ ItemLayout::ItemLayout(QString const& text, bool suppressColors, Qt::LayoutDirec
} // namespace
QSize TrackerDelegate::margin(QStyle const& style) const
{
Q_UNUSED(style)
return myMargin;
}
/***
****
***/

View File

@ -34,7 +34,6 @@ public:
protected:
QString getText(TrackerInfo const&) const;
QSize margin(QStyle const& style) const;
QSize sizeHint(QStyleOptionViewItem const&, TrackerInfo const&) const;
void drawTracker(QPainter*, QStyleOptionViewItem const&, TrackerInfo const&) const;