diff --git a/btpd/cli_if.c b/btpd/cli_if.c index 81c89d2..dd24858 100644 --- a/btpd/cli_if.c +++ b/btpd/cli_if.c @@ -13,10 +13,6 @@ #include "btpd.h" -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - #define buf_swrite(iob, s) buf_write(iob, s, sizeof(s) - 1) static struct event m_cli_incoming; @@ -44,7 +40,7 @@ cmd_stat(int argc, const char *args, FILE *fp) for (uint32_t i = 0; i < tp->meta.npieces; i++) if (tp->piece_count[i] > 0) seen_npieces++; - errdie(buf_print(&iob, "d4:downi%" PRIu64 "e", tp->downloaded)); + errdie(buf_print(&iob, "d4:downi%jue", (intmax_t)tp->downloaded)); errdie(buf_swrite(&iob, "4:hash20:")); errdie(buf_write(&iob, tp->meta.info_hash, 20)); errdie(buf_print(&iob, "12:have npiecesi%ue", tp->have_npieces)); @@ -53,7 +49,7 @@ cmd_stat(int argc, const char *args, FILE *fp) errdie(buf_print(&iob, "4:path%d:%s", (int)strlen(tp->relpath), tp->relpath)); errdie(buf_print(&iob, "12:seen npiecesi%ue", seen_npieces)); - errdie(buf_print(&iob, "2:upi%" PRIu64 "ee", tp->uploaded)); + errdie(buf_print(&iob, "2:upi%juee", (intmax_t)tp->uploaded)); } errdie(buf_swrite(&iob, "ee")); diff --git a/btpd/tracker_req.c b/btpd/tracker_req.c index e059b04..1a55f5f 100644 --- a/btpd/tracker_req.c +++ b/btpd/tracker_req.c @@ -17,10 +17,6 @@ #include "btpd.h" #include "tracker_req.h" -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - #define REQ_SIZE (getpagesize() * 2) struct tracker_req { @@ -175,18 +171,13 @@ create_url(struct tracker_req *req, struct torrent *tp, char **url) left = cm_bytes_left(tp); - i = asprintf(url, "%s%cinfo_hash=%s" - "&peer_id=%s" - "&port=%d" - "&uploaded=%" PRIu64 - "&downloaded=%" PRIu64 - "&left=%" PRIu64 - "&compact=1" - "%s%s", - tp->meta.announce, qc, e_hash, e_id, net_port, - tp->uploaded, tp->downloaded, left, - req->tr_event == TR_EMPTY ? "" : "&event=", - event); + i = + asprintf(url, "%s%cinfo_hash=%s&peer_id=%s&port=%d&uploaded=%ju" + "&downloaded=%ju&left=%ju&compact=1%s%s", + tp->meta.announce, qc, e_hash, e_id, net_port, + (intmax_t)tp->uploaded, (intmax_t)tp->downloaded, (intmax_t)left, + req->tr_event == TR_EMPTY ? "" : "&event=", + event); if (i < 0) return ENOMEM; diff --git a/misc/metainfo.c b/misc/metainfo.c index 261f60a..1b90247 100644 --- a/misc/metainfo.c +++ b/misc/metainfo.c @@ -30,13 +30,6 @@ * */ -#ifndef PRId64 -#define PRId64 "lld" -#endif -#ifndef PRIu32 -#define PRIu32 "u" -#endif - void print_metainfo(struct metainfo *tp) { @@ -47,16 +40,16 @@ print_metainfo(struct metainfo *tp) printf("%.2x", tp->info_hash[i]); printf("\n"); printf("Tracker URL: %s\n", tp->announce); - printf("Piece length: %" PRId64 "\n", (int64_t)tp->piece_length); - printf("Number of pieces: %" PRIu32 "\n", tp->npieces); + printf("Piece length: %jd\n", (intmax_t)tp->piece_length); + printf("Number of pieces: %u\n", tp->npieces); printf("Number of files: %u\n", tp->nfiles); printf("Advisory name: %s\n", tp->name); printf("Files:\n"); for (i = 0; i < tp->nfiles; i++) { - printf("%s (%" PRId64 ")\n", - tp->files[i].path, (int64_t)tp->files[i].length); + printf("%s (%jd)\n", + tp->files[i].path, (intmax_t)tp->files[i].length); } - printf("Total length: %" PRId64 "\n\n", (int64_t)tp->total_length); + printf("Total length: %jd\n\n", (intmax_t)tp->total_length); } static int