diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 2a99db3ebc4c211e436f95fde24b5ac6826d0267 (patch) | |
tree | ce2e122a017c12f803ea428a299c7e3cec52c8fe /libktorrent/torrent | |
parent | 100dcb6968ca22bfa52836ad55eb4f01225791db (diff) | |
download | ktorrent-2a99db3ebc4c211e436f95fde24b5ac6826d0267.tar.gz ktorrent-2a99db3ebc4c211e436f95fde24b5ac6826d0267.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libktorrent/torrent')
-rw-r--r-- | libktorrent/torrent/advancedchokealgorithm.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/announcelist.cpp | 4 | ||||
-rw-r--r-- | libktorrent/torrent/cachefile.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/chunkdownload.cpp | 20 | ||||
-rw-r--r-- | libktorrent/torrent/chunkdownload.h | 2 | ||||
-rw-r--r-- | libktorrent/torrent/downloader.cpp | 8 | ||||
-rw-r--r-- | libktorrent/torrent/httptracker.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/ipblocklist.cpp | 6 | ||||
-rw-r--r-- | libktorrent/torrent/multifilecache.cpp | 24 | ||||
-rw-r--r-- | libktorrent/torrent/peerdownloader.cpp | 10 | ||||
-rw-r--r-- | libktorrent/torrent/peerid.cpp | 4 | ||||
-rw-r--r-- | libktorrent/torrent/peermanager.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/peersourcemanager.cpp | 10 | ||||
-rw-r--r-- | libktorrent/torrent/queuemanager.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/singlefilecache.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/statsfile.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/statsfile.h | 2 | ||||
-rw-r--r-- | libktorrent/torrent/torrent.cpp | 2 | ||||
-rw-r--r-- | libktorrent/torrent/torrentcontrol.cpp | 8 | ||||
-rw-r--r-- | libktorrent/torrent/udptrackersocket.cpp | 8 |
20 files changed, 61 insertions, 61 deletions
diff --git a/libktorrent/torrent/advancedchokealgorithm.cpp b/libktorrent/torrent/advancedchokealgorithm.cpp index f6c807f..7ca0578 100644 --- a/libktorrent/torrent/advancedchokealgorithm.cpp +++ b/libktorrent/torrent/advancedchokealgorithm.cpp @@ -234,7 +234,7 @@ namespace bt while (i != start) { Peer* p = pman.getPeer(i); - if (p && p->isChoked() && p->isInterested() && !p->isSeeder() && ppl.tqcontains(p)) + if (p && p->isChoked() && p->isInterested() && !p->isSeeder() && ppl.contains(p)) return p->getID(); i = (i + 1) % num_peers; } diff --git a/libktorrent/torrent/announcelist.cpp b/libktorrent/torrent/announcelist.cpp index 7eebf19..4d3d4fa 100644 --- a/libktorrent/torrent/announcelist.cpp +++ b/libktorrent/torrent/announcelist.cpp @@ -87,7 +87,7 @@ namespace bt bool AnnounceList::removeTracker(KURL url) { - KURL::List::iterator i = custom_trackers.tqfind(url); + KURL::List::iterator i = custom_trackers.find(url); if(i != custom_trackers.end()) { custom_trackers.remove(i); @@ -187,7 +187,7 @@ namespace bt for (Uint32 i = 0;i < al->getNumTrackerURLs();i++) { KURL url = *al->trackers.at(i); - if (!trackers.tqcontains(url) && !custom_trackers.tqcontains(url)) + if (!trackers.contains(url) && !custom_trackers.contains(url)) custom_trackers.append(url); } } diff --git a/libktorrent/torrent/cachefile.cpp b/libktorrent/torrent/cachefile.cpp index 4196016..da5ecae 100644 --- a/libktorrent/torrent/cachefile.cpp +++ b/libktorrent/torrent/cachefile.cpp @@ -262,7 +262,7 @@ namespace bt int ret = 0; TQMutexLocker lock(&mutex); // see if it wasn't an offsetted mapping - if (mappings.tqcontains(ptr)) + if (mappings.contains(ptr)) { CacheFile::Entry & e = mappings[ptr]; #if HAVE_MUNMAP64 diff --git a/libktorrent/torrent/chunkdownload.cpp b/libktorrent/torrent/chunkdownload.cpp index fe095a7..04eb87f 100644 --- a/libktorrent/torrent/chunkdownload.cpp +++ b/libktorrent/torrent/chunkdownload.cpp @@ -59,7 +59,7 @@ namespace bt erase(p); } - bool tqcontains(Uint32 p) + bool contains(Uint32 p) { return count(p) > 0; } @@ -111,7 +111,7 @@ namespace bt return false; - DownloadtqStatus* ds = dstatus.tqfind(p.getPeer()); + DownloadtqStatus* ds = dstatus.find(p.getPeer()); if (ds) ds->remove(pp); @@ -164,7 +164,7 @@ namespace bt bool ChunkDownload::assignPeer(PeerDownloader* pd) { - if (!pd || pdown.tqcontains(pd)) + if (!pd || pdown.contains(pd)) return false; pd->grab(); @@ -179,7 +179,7 @@ namespace bt void ChunkDownload::notDownloaded(const Request & r,bool reject) { // find the peer - DownloadtqStatus* ds = dstatus.tqfind(r.getPeer()); + DownloadtqStatus* ds = dstatus.find(r.getPeer()); if (ds) { // Out() << "ds != 0" << endl; @@ -216,7 +216,7 @@ namespace bt void ChunkDownload::sendRequests(PeerDownloader* pd) { timer.update(); - DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.find(pd->getPeer()->getID()); if (!ds) return; @@ -229,7 +229,7 @@ namespace bt { // get the first one in the queue Uint32 i = piece_queue.first(); - if (!ds->tqcontains(i)) + if (!ds->contains(i)) { // send request pd->download( @@ -262,7 +262,7 @@ namespace bt void ChunkDownload::sendCancels(PeerDownloader* pd) { - DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.find(pd->getPeer()->getID()); if (!ds) return; @@ -287,9 +287,9 @@ namespace bt while (i != pdown.end()) { PeerDownloader* pd = *i; - DownloadtqStatus* ds = dstatus.tqfind(pd->getPeer()->getID()); + DownloadtqStatus* ds = dstatus.find(pd->getPeer()->getID()); Uint32 pp = p.getOffset() / MAX_PIECE_LEN; - if (ds && ds->tqcontains(pp)) + if (ds && ds->contains(pp)) { pd->cancel(Request(p)); ds->remove(pp); @@ -300,7 +300,7 @@ namespace bt void ChunkDownload::peerKilled(PeerDownloader* pd) { - if (!pdown.tqcontains(pd)) + if (!pdown.contains(pd)) return; dstatus.erase(pd->getPeer()->getID()); diff --git a/libktorrent/torrent/chunkdownload.h b/libktorrent/torrent/chunkdownload.h index c1960f0..c8bd2ae 100644 --- a/libktorrent/torrent/chunkdownload.h +++ b/libktorrent/torrent/chunkdownload.h @@ -153,7 +153,7 @@ namespace bt bool getOnlyDownloader(Uint32 & pid); /// See if a PeerDownloader is assigned to this chunk - bool containsPeer(PeerDownloader *pd) {return pdown.tqcontains(pd);} + bool containsPeer(PeerDownloader *pd) {return pdown.contains(pd);} /// See if the download is choked (i.e. all downloaders are choked) bool isChoked() const; diff --git a/libktorrent/torrent/downloader.cpp b/libktorrent/torrent/downloader.cpp index b566ad7..a63163e 100644 --- a/libktorrent/torrent/downloader.cpp +++ b/libktorrent/torrent/downloader.cpp @@ -354,7 +354,7 @@ namespace bt bool Downloader::areWeDownloading(Uint32 chunk) const { - return current_chunks.tqfind(chunk) != 0; + return current_chunks.find(chunk) != 0; } void Downloader::onNewPeer(Peer* peer) @@ -531,7 +531,7 @@ namespace bt return; } - if (!cman.getChunk(hdr.index) || current_chunks.tqcontains(hdr.index)) + if (!cman.getChunk(hdr.index) || current_chunks.contains(hdr.index)) { Out() << "Illegal chunk " << hdr.index << endl; return; @@ -628,7 +628,7 @@ namespace bt { for (Uint32 i = from;i <= to;i++) { - ChunkDownload* cd = current_chunks.tqfind(i); + ChunkDownload* cd = current_chunks.find(i); // let only seed chunks finish if (!cd || cman.getChunk(i)->getPriority() == ONLY_SEED_PRIORITY) continue; @@ -664,7 +664,7 @@ namespace bt { for (Uint32 i = 0;i < ok_chunks.getNumBits();i++) { - ChunkDownload* cd = current_chunks.tqfind(i); + ChunkDownload* cd = current_chunks.find(i); if (ok_chunks.get(i) && cd) { // we have a chunk and we are downloading it so kill it diff --git a/libktorrent/torrent/httptracker.cpp b/libktorrent/torrent/httptracker.cpp index ad4bd79..e64f8ce 100644 --- a/libktorrent/torrent/httptracker.cpp +++ b/libktorrent/torrent/httptracker.cpp @@ -105,7 +105,7 @@ namespace bt } KURL scrape_url = url; - scrape_url.setFileName(url.fileName(false).tqreplace("announce","scrape")); + scrape_url.setFileName(url.fileName(false).replace("announce","scrape")); TQString epq = scrape_url.encodedPathAndQuery(); const SHA1Hash & info_hash = tor->getInfoHash(); diff --git a/libktorrent/torrent/ipblocklist.cpp b/libktorrent/torrent/ipblocklist.cpp index 04afe26..632f42c 100644 --- a/libktorrent/torrent/ipblocklist.cpp +++ b/libktorrent/torrent/ipblocklist.cpp @@ -147,7 +147,7 @@ namespace bt { // Out() << "Blocked range: " << key.m_ip << " - " << key.m_tqmask << endl; TQMap<IPKey, int>::iterator it; - if ((it = m_peers.tqfind(key)) != m_peers.end()) + if ((it = m_peers.find(key)) != m_peers.end()) { if(it.key().m_tqmask != key.m_tqmask) @@ -224,7 +224,7 @@ namespace bt IPKey key(addr, tqmask); - TQMap<IPKey, int>::iterator it = m_peers.tqfind(key); + TQMap<IPKey, int>::iterator it = m_peers.find(key); if (it == m_peers.end()) return; @@ -264,7 +264,7 @@ namespace bt IPKey key(ipi); TQMap<IPKey, int>::iterator it; - it = m_peers.tqfind(key); + it = m_peers.find(key); if (it==m_peers.end()) return false; diff --git a/libktorrent/torrent/multifilecache.cpp b/libktorrent/torrent/multifilecache.cpp index 88f6d69..b7dae26 100644 --- a/libktorrent/torrent/multifilecache.cpp +++ b/libktorrent/torrent/multifilecache.cpp @@ -114,7 +114,7 @@ namespace bt { if (!tf.doNotDownload()) { - if (files.tqcontains(i)) + if (files.contains(i)) files.erase(i); fd = new CacheFile(); @@ -123,7 +123,7 @@ namespace bt } else { - if (dnd_files.tqcontains(i)) + if (dnd_files.contains(i)) dnd_files.erase(i); dfd = new DNDFile(dnd_dir + tf.getPath() + ".dnd"); @@ -155,13 +155,13 @@ namespace bt TorrentFile & tf = tor.getFile(i); if (tf.doNotDownload()) { - DNDFile* dfd = dnd_files.tqfind(i); + DNDFile* dfd = dnd_files.find(i); if (dfd) dfd->changePath(dnd_dir + tf.getPath() + ".dnd"); } else { - CacheFile* fd = files.tqfind(i); + CacheFile* fd = files.find(i); if (fd) fd->changePath(cache_dir + tf.getPath()); } @@ -332,7 +332,7 @@ namespace bt if (tflist.count() == 1) { const TorrentFile & f = tor.getFile(tflist.first()); - CacheFile* fd = files.tqfind(tflist.first()); + CacheFile* fd = files.find(tflist.first()); if (!fd) return; @@ -357,8 +357,8 @@ namespace bt for (Uint32 i = 0;i < tflist.count();i++) { const TorrentFile & f = tor.getFile(tflist[i]); - CacheFile* fd = files.tqfind(tflist[i]); - DNDFile* dfd = dnd_files.tqfind(tflist[i]); + CacheFile* fd = files.find(tflist[i]); + DNDFile* dfd = dnd_files.find(tflist[i]); // first calculate offset into file // only the first file can have an offset @@ -412,7 +412,7 @@ namespace bt { // in one so just mmap it Uint64 off = FileOffset(c,tor.getFile(tflist.first()),tor.getChunkSize()); - CacheFile* fd = files.tqfind(tflist.first()); + CacheFile* fd = files.find(tflist.first()); Uint8* buf = 0; if (fd && Cache::mappedModeAllowed() && mmap_failures < 3) { @@ -449,7 +449,7 @@ namespace bt if (c->gettqStatus() == Chunk::MMAPPED) { // mapped chunks are easy - CacheFile* fd = files.tqfind(tflist[0]); + CacheFile* fd = files.find(tflist[0]); if (!fd) return; @@ -464,8 +464,8 @@ namespace bt for (Uint32 i = 0;i < tflist.count();i++) { const TorrentFile & f = tor.getFile(tflist[i]); - CacheFile* fd = files.tqfind(tflist[i]); - DNDFile* dfd = dnd_files.tqfind(tflist[i]); + CacheFile* fd = files.find(tflist[i]); + DNDFile* dfd = dnd_files.find(tflist[i]); // first calculate offset into file // only the first file can have an offset @@ -828,7 +828,7 @@ namespace bt try { - CacheFile* cf = files.tqfind(i); + CacheFile* cf = files.find(i); if (cf) { sum += cf->diskUsage(); diff --git a/libktorrent/torrent/peerdownloader.cpp b/libktorrent/torrent/peerdownloader.cpp index 00e0b7a..6f0738f 100644 --- a/libktorrent/torrent/peerdownloader.cpp +++ b/libktorrent/torrent/peerdownloader.cpp @@ -126,11 +126,11 @@ namespace bt if (!peer) return; - if (wait_queue.tqcontains(req)) + if (wait_queue.contains(req)) { wait_queue.remove(req); } - else if (reqs.tqcontains(req)) + else if (reqs.contains(req)) { reqs.remove(req); peer->getPacketWriter().sendCancel(req); @@ -144,7 +144,7 @@ namespace bt // Out(SYS_CON|LOG_DEBUG) << "Rejected : " << req.getIndex() << " " // << req.getOffset() << " " << req.getLength() << endl; - if (reqs.tqcontains(req)) + if (reqs.contains(req)) { reqs.remove(req); rejected(req); @@ -171,9 +171,9 @@ namespace bt void PeerDownloader::piece(const Piece & p) { Request r(p); - if (wait_queue.tqcontains(r)) + if (wait_queue.contains(r)) wait_queue.remove(r); - else if (reqs.tqcontains(r)) + else if (reqs.contains(r)) reqs.remove(r); downloaded(p); diff --git a/libktorrent/torrent/peerid.cpp b/libktorrent/torrent/peerid.cpp index b1741d2..09b4bff 100644 --- a/libktorrent/torrent/peerid.cpp +++ b/libktorrent/torrent/peerid.cpp @@ -206,7 +206,7 @@ namespace bt peer_id.tqat(2).isLetter() ) //AZ style { TQString ID(peer_id.mid(1,2)); - if (Map.tqcontains(ID)) + if (Map.contains(ID)) name = Map[ID] + " " + peer_id.tqat(3) + "." + peer_id.tqat(4) + "." + peer_id.tqat(5) + "." + peer_id.tqat(6); } @@ -215,7 +215,7 @@ namespace bt peer_id.tqat(2).isDigit() ) //Shadow's style { TQString ID = TQString(peer_id.tqat(0)); - if (Map.tqcontains(ID)) + if (Map.contains(ID)) name = Map[ID] + " " + peer_id.tqat(1) + "." + peer_id.tqat(2) + "." + peer_id.tqat(3); } diff --git a/libktorrent/torrent/peermanager.cpp b/libktorrent/torrent/peermanager.cpp index c85ebd4..adacbae 100644 --- a/libktorrent/torrent/peermanager.cpp +++ b/libktorrent/torrent/peermanager.cpp @@ -509,7 +509,7 @@ namespace bt Peer* PeerManager::findPeer(Uint32 peer_id) { - return peer_map.tqfind(peer_id); + return peer_map.find(peer_id); } void PeerManager::onRerunChoker() diff --git a/libktorrent/torrent/peersourcemanager.cpp b/libktorrent/torrent/peersourcemanager.cpp index 80af240..44303c4 100644 --- a/libktorrent/torrent/peersourcemanager.cpp +++ b/libktorrent/torrent/peersourcemanager.cpp @@ -207,7 +207,7 @@ namespace bt void PeerSourceManager::addTracker(KURL url, bool custom,int tier) { - if (trackers.tqcontains(url)) + if (trackers.contains(url)) return; Tracker* trk = 0; @@ -227,11 +227,11 @@ namespace bt bool PeerSourceManager::removeTracker(KURL url) { - if (!custom_trackers.tqcontains(url)) + if (!custom_trackers.contains(url)) return false; custom_trackers.remove(url); - Tracker* trk = trackers.tqfind(url); + Tracker* trk = trackers.find(url); if (curr == trk) { // do a timed delete on the tracker, so the stop signal @@ -260,7 +260,7 @@ namespace bt void PeerSourceManager::setTracker(KURL url) { - Tracker* trk = trackers.tqfind(url); + Tracker* trk = trackers.find(url); if (!trk) return; @@ -279,7 +279,7 @@ namespace bt KURL::List::iterator i = custom_trackers.begin(); while (i != custom_trackers.end()) { - Tracker* t = trackers.tqfind(*i); + Tracker* t = trackers.find(*i); if (t) { if (curr == t) diff --git a/libktorrent/torrent/queuemanager.cpp b/libktorrent/torrent/queuemanager.cpp index 1199179..affedf5 100644 --- a/libktorrent/torrent/queuemanager.cpp +++ b/libktorrent/torrent/queuemanager.cpp @@ -68,7 +68,7 @@ namespace bt { paused_torrents.erase(tc); - int index = downloads.tqfindRef(tc); + int index = downloads.findRef(tc); if (index != -1) downloads.remove(index); diff --git a/libktorrent/torrent/singlefilecache.cpp b/libktorrent/torrent/singlefilecache.cpp index 7ad0fd6..4843c1f 100644 --- a/libktorrent/torrent/singlefilecache.cpp +++ b/libktorrent/torrent/singlefilecache.cpp @@ -65,7 +65,7 @@ namespace bt { bt::Delete(cache_file); output_file = outputpath; - datadir = output_file.left(output_file.tqfindRev(bt::DirSeparator())); + datadir = output_file.left(output_file.findRev(bt::DirSeparator())); bt::SymLink(output_file, cache_file); } diff --git a/libktorrent/torrent/statsfile.cpp b/libktorrent/torrent/statsfile.cpp index 54033aa..772f6be 100644 --- a/libktorrent/torrent/statsfile.cpp +++ b/libktorrent/torrent/statsfile.cpp @@ -97,7 +97,7 @@ namespace bt while (!in.atEnd()) { TQString line = in.readLine(); - TQString tmp = line.left(line.tqfind('=')); + TQString tmp = line.left(line.find('=')); m_values.insert(tmp, line.mid(tmp.length()+1)); } close(); diff --git a/libktorrent/torrent/statsfile.h b/libktorrent/torrent/statsfile.h index c37018f..3b3decb 100644 --- a/libktorrent/torrent/statsfile.h +++ b/libktorrent/torrent/statsfile.h @@ -78,7 +78,7 @@ namespace bt * @param key The key * @return true if key is in the stats file */ - bool hasKey(const TQString & key) const {return m_values.tqcontains(key);} + bool hasKey(const TQString & key) const {return m_values.contains(key);} private: TQString m_filename; diff --git a/libktorrent/torrent/torrent.cpp b/libktorrent/torrent/torrent.cpp index e02af51..c5d8459 100644 --- a/libktorrent/torrent/torrent.cpp +++ b/libktorrent/torrent/torrent.cpp @@ -444,6 +444,6 @@ namespace bt bool Torrent::checkPathForDirectoryTraversal(const TQString & p) { TQStringList sl = TQStringList::split(bt::DirSeparator(),p); - return !sl.tqcontains(".."); + return !sl.contains(".."); } } diff --git a/libktorrent/torrent/torrentcontrol.cpp b/libktorrent/torrent/torrentcontrol.cpp index ba51092..a586356 100644 --- a/libktorrent/torrent/torrentcontrol.cpp +++ b/libktorrent/torrent/torrentcontrol.cpp @@ -785,7 +785,7 @@ namespace bt bool TorrentControl::changeDataDir(const TQString & new_dir) { - int pos = datadir.tqfindRev(bt::DirSeparator(),-2); + int pos = datadir.findRev(bt::DirSeparator(),-2); if (pos == -1) { Out(SYS_GEN|LOG_DEBUG) << "Could not find torX part in " << datadir << endl; @@ -833,7 +833,7 @@ namespace bt TQString nd; if (istats.custom_output_name) { - int slash_pos = stats.output_path.tqfindRev(bt::DirSeparator(),-2); + int slash_pos = stats.output_path.findRev(bt::DirSeparator(),-2); nd = new_dir + stats.output_path.mid(slash_pos + 1); } else @@ -1255,10 +1255,10 @@ namespace bt { // in case of error copy torX dir to migrate-failed-tor TQString dd = datadir; - int pos = dd.tqfindRev("tor"); + int pos = dd.findRev("tor"); if (pos != - 1) { - dd = dd.tqreplace(pos,3,"migrate-failed-tor"); + dd = dd.replace(pos,3,"migrate-failed-tor"); Out() << "Copying " << datadir << " to " << dd << endl; bt::CopyDir(datadir,dd,true); } diff --git a/libktorrent/torrent/udptrackersocket.cpp b/libktorrent/torrent/udptrackersocket.cpp index 79e9c5c..e440e3c 100644 --- a/libktorrent/torrent/udptrackersocket.cpp +++ b/libktorrent/torrent/udptrackersocket.cpp @@ -105,7 +105,7 @@ namespace bt // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - TQMap<Int32,Action>::iterator i = transactions.tqfind(tid); + TQMap<Int32,Action>::iterator i = transactions.find(tid); // if we can't find the transaction, just return if (i == transactions.end()) { @@ -131,7 +131,7 @@ namespace bt // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - TQMap<Int32,Action>::iterator i = transactions.tqfind(tid); + TQMap<Int32,Action>::iterator i = transactions.find(tid); // if we can't find the transaction, just return if (i == transactions.end()) return; @@ -154,7 +154,7 @@ namespace bt const Uint8* buf = (const Uint8*)data.data(); // Read the transaction_id and check it Int32 tid = ReadInt32(buf,4); - TQMap<Int32,Action>::iterator it = transactions.tqfind(tid); + TQMap<Int32,Action>::iterator it = transactions.find(tid); // if we can't find the transaction, just return if (it == transactions.end()) return; @@ -203,7 +203,7 @@ namespace bt Int32 UDPTrackerSocket::newTransactionID() { Int32 transaction_id = rand() * time(0); - while (transactions.tqcontains(transaction_id)) + while (transactions.contains(transaction_id)) transaction_id++; return transaction_id; } |