summaryrefslogtreecommitdiff
path: root/trackerlogic.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-04-03 01:40:39 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-04-03 01:40:39 +0200
commite4eb716d2688f5c2d4615d79ad5f4f1eb50a9343 (patch)
tree5612056173478fecaad0a030195b6ed2f399df4d /trackerlogic.c
parentb20b0b89264e9d28ab873b8b1cc9ba73cdb58aeb (diff)
turn all int offsets into size_t
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/trackerlogic.c b/trackerlogic.c
index 04df544..1e25ec8 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -195,7 +195,7 @@ size_t add_peer_to_torrent_and_return_peers(PROTO_FLAG proto, struct ot_workstru
195} 195}
196 196
197static size_t return_peers_all(ot_peerlist *peer_list, size_t peer_size, char *reply) { 197static size_t return_peers_all(ot_peerlist *peer_list, size_t peer_size, char *reply) {
198 unsigned int bucket, num_buckets = 1; 198 size_t bucket, num_buckets = 1;
199 ot_vector *bucket_list = &peer_list->peers; 199 ot_vector *bucket_list = &peer_list->peers;
200 size_t compare_size = OT_PEER_COMPARE_SIZE_FROM_PEER_SIZE(peer_size); 200 size_t compare_size = OT_PEER_COMPARE_SIZE_FROM_PEER_SIZE(peer_size);
201 size_t result = compare_size * peer_list->peer_count; 201 size_t result = compare_size * peer_list->peer_count;
@@ -224,7 +224,7 @@ static size_t return_peers_all(ot_peerlist *peer_list, size_t peer_size, char *r
224} 224}
225 225
226static size_t return_peers_selection(struct ot_workstruct *ws, ot_peerlist *peer_list, size_t peer_size, size_t amount, char *reply) { 226static size_t return_peers_selection(struct ot_workstruct *ws, ot_peerlist *peer_list, size_t peer_size, size_t amount, char *reply) {
227 unsigned int bucket_offset, bucket_index = 0, num_buckets = 1; 227 size_t bucket_offset, bucket_index = 0, num_buckets = 1;
228 ot_vector *bucket_list = &peer_list->peers; 228 ot_vector *bucket_list = &peer_list->peers;
229 unsigned int shifted_pc = peer_list->peer_count; 229 unsigned int shifted_pc = peer_list->peer_count;
230 unsigned int shifted_step = 0; 230 unsigned int shifted_step = 0;
@@ -403,9 +403,10 @@ size_t return_udp_scrape_for_torrent(ot_hash const hash, char *reply) {
403} 403}
404 404
405/* Fetches scrape info for a specific torrent */ 405/* Fetches scrape info for a specific torrent */
406size_t return_tcp_scrape_for_torrent(ot_hash const *hash_list, int amount, char *reply) { 406size_t return_tcp_scrape_for_torrent(ot_hash const *hash_list, size_t amount, char *reply) {
407 char *r = reply; 407 char *r = reply;
408 int exactmatch, i; 408 int exactmatch;
409 size_t i;
409 410
410 r += sprintf(r, "d5:filesd"); 411 r += sprintf(r, "d5:filesd");
411 412
@@ -489,8 +490,7 @@ size_t remove_peer_from_torrent(PROTO_FLAG proto, struct ot_workstruct *ws) {
489} 490}
490 491
491void iterate_all_torrents(int (*for_each)(ot_torrent *torrent, uintptr_t data), uintptr_t data) { 492void iterate_all_torrents(int (*for_each)(ot_torrent *torrent, uintptr_t data), uintptr_t data) {
492 int bucket; 493 size_t bucket, j;
493 size_t j;
494 494
495 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) { 495 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) {
496 ot_vector *torrents_list = mutex_bucket_lock(bucket); 496 ot_vector *torrents_list = mutex_bucket_lock(bucket);
@@ -569,8 +569,8 @@ void trackerlogic_init() {
569} 569}
570 570
571void trackerlogic_deinit(void) { 571void trackerlogic_deinit(void) {
572 int bucket, delta_torrentcount = 0; 572 int delta_torrentcount = 0;
573 size_t j; 573 size_t bucket, j;
574 574
575 /* Free all torrents... */ 575 /* Free all torrents... */
576 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) { 576 for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) {