/* step 2: add any new webseeds */
for (i=0; i<n; ++i) {
- int j;
+ unsigned int j;
const tr_torrent * tor = torrents[i];
const tr_info * inf = tr_torrentInfo (tor);
total += inf->webseedCount;
/* step 3: update the webseeds */
for (i=0; i<n; ++i) {
- int j;
+ unsigned int j;
tr_torrent * tor = torrents[i];
const tr_info * inf = tr_torrentInfo (tor);
double * speeds_KBps = tr_torrentWebSpeeds_KBps (tor);
static void
get_editable_tracker_list (GString * gstr, const tr_torrent * tor)
{
- int i;
+ unsigned int i;
int tier = 0;
const tr_info * inf = tr_torrentInfo (tor);
for (i=0; i<inf->trackerCount; ++i) {
return tr_torrentGetPriority (tor) == TR_PRI_LOW;
case CAT_FILTER_TYPE_HOST: {
- int i;
+ unsigned int i;
char tmp[1024];
for (i=0; i<inf->trackerCount; ++i) {
gtr_get_host_from_url (tmp, sizeof (tmp), inf->trackers[i].announce);
static unsigned int
build_torrent_trackers_hash (tr_torrent * tor)
{
- int i;
+ unsigned int i;
const char * pch;
uint64_t hash = 0;
const tr_info * const inf = tr_torrentInfo (tor);
void
tr_metainfoFree (tr_info * inf)
{
- int i;
+ unsigned int i;
tr_file_index_t ff;
for (i=0; i<inf->webseedCount; i++)
static void
rebuildWebseedArray (Torrent * t, tr_torrent * tor)
{
- int i;
+ unsigned int i;
const tr_info * inf = &tor->info;
/* clear the array */
double*
tr_peerMgrWebSpeeds_KBps (const tr_torrent * tor)
{
- int i;
- int webseedCount;
+ unsigned int i;
+ unsigned int webseedCount;
const Torrent * t;
const tr_webseed ** webseeds;
double * ret = NULL;
}
static void
-addWebseeds (const tr_info * info,
- tr_variant * webseeds)
+addWebseeds (const tr_info * info,
+ tr_variant * webseeds)
{
- int i;
+ unsigned int i;
- for (i = 0; i < info->webseedCount; ++i)
- tr_variantListAddStr (webseeds, info->webseeds[i]);
+ for (i=0; i< info->webseedCount; ++i)
+ tr_variantListAddStr (webseeds, info->webseeds[i]);
}
static void
-addTrackers (const tr_info * info,
- tr_variant * trackers)
+addTrackers (const tr_info * info,
+ tr_variant * trackers)
{
- int i;
+ unsigned int i;
- for (i = 0; i < info->trackerCount; ++i)
+ for (i=0; i<info->trackerCount; ++i)
{
- const tr_tracker_info * t = &info->trackers[i];
- tr_variant * d = tr_variantListAddDict (trackers, 4);
- tr_variantDictAddStr (d, TR_KEY_announce, t->announce);
- tr_variantDictAddInt (d, TR_KEY_id, t->id);
- tr_variantDictAddStr (d, TR_KEY_scrape, t->scrape);
- tr_variantDictAddInt (d, TR_KEY_tier, t->tier);
+ const tr_tracker_info * t = &info->trackers[i];
+ tr_variant * d = tr_variantListAddDict (trackers, 4);
+ tr_variantDictAddStr (d, TR_KEY_announce, t->announce);
+ tr_variantDictAddInt (d, TR_KEY_id, t->id);
+ tr_variantDictAddStr (d, TR_KEY_scrape, t->scrape);
+ tr_variantDictAddInt (d, TR_KEY_tier, t->tier);
}
}
char*
tr_torrentInfoGetMagnetLink (const tr_info * inf)
{
- int i;
+ unsigned int i;
const char * name;
struct evbuffer * s = evbuffer_new ();
tor->etaDLSpeedCalculatedAt = now;
}
- if ((s->leftUntilDone > s->desiredAvailable) && (tor->info.webseedCount < 0))
+ if ((s->leftUntilDone > s->desiredAvailable) && (tor->info.webseedCount < 1))
s->eta = TR_ETA_NOT_AVAIL;
else if (tor->etaDLSpeed_KBps < 1)
s->eta = TR_ETA_UNKNOWN;
/* Torrent info */
time_t dateCreated;
- int trackerCount;
- int webseedCount;
+ unsigned int trackerCount;
+ unsigned int webseedCount;
tr_file_index_t fileCount;
uint32_t pieceSize;
tr_piece_index_t pieceCount;
int
main( int argc, char * argv[] )
{
+std::cerr << "sizeof double " << sizeof(double) << std::endl;
+std::cerr << "sizeof Speed " << sizeof(Speed) << std::endl;
+std::cerr << "sizeof int " << sizeof(int) << std::endl;
+std::cerr << "sizeof bool " << sizeof(bool) << std::endl;
+std::cerr << "sizeof uint64_t " << sizeof(uint64_t) << std::endl;
+std::cerr << "sizeof QString is " << sizeof(QString) << std::endl;
+std::cerr << "sizeof TrFile is " << sizeof(struct TrFile) << std::endl;
+std::cerr << "sizeof Peer is " << sizeof(Peer) << std::endl;
+std::cerr << "sizeof TrackerStat is " << sizeof(TrackerStat) << std::endl;
+
// find .torrents, URLs, magnet links, etc in the command-line args
int c;
QStringList addme;
#/bin/sh
-valgrind --tool=cachegrind ./transmission-qt 2>&1 | tee runlog
+#valgrind --tool=cachegrind ./transmission-qt 2>&1 | tee runlog
+valgrind --tool=massif --threshold=0.2 ./transmission-qt 2>&1 | tee runlog
#valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=48 --log-file=x-valgrind --show-reachable=no ./transmission-qt 2>&1 | tee runlog
tr_variant * child;
myFiles.clear ();
+ myFiles.reserve (tr_variantListSize (files));
while ((child = tr_variantListChild (files, i)))
{
static void
showInfo (const tr_info * inf)
{
- int i;
+ unsigned int i;
char buf[128];
tr_file ** files;
int prevTier = -1;
printf ("\nFILES\n\n");
files = tr_new (tr_file*, inf->fileCount);
- for (i=0; i< (int)inf->fileCount; ++i)
+ for (i=0; i<inf->fileCount; ++i)
files[i] = &inf->files[i];
qsort (files, inf->fileCount, sizeof (tr_file*), compare_files_by_name);
- for (i=0; i< (int)inf->fileCount; ++i)
+ for (i=0; i<inf->fileCount; ++i)
printf (" %s (%s)\n", files[i]->name, tr_formatter_size_B (buf, files[i]->length, sizeof (buf)));
tr_free (files);
}
static void
doScrape (const tr_info * inf)
{
- int i;
+ unsigned int i;
for (i=0; i<inf->trackerCount; ++i)
{