From 1f9494979268b62ed4b4588fb7d9e790c0e12100 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 26 Oct 2026 22:32:52 +0100 Subject: replace all calls to sprintf with a format helper that advances a cursor. Also convert the meta-formatter (i.e. results printer) to this scheme --- ot_sync.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'ot_sync.c') diff --git a/ot_sync.c b/ot_sync.c index f958a20..f656bef 100644 --- a/ot_sync.c +++ b/ot_sync.c @@ -11,6 +11,7 @@ #include /* Opentracker */ +#include "ot_fmt.h" #include "ot_iovec.h" #include "ot_mutex.h" #include "ot_scan.h" @@ -109,14 +110,10 @@ static void sync_make(size_t *iovec_entries, struct iovec **iovector) { re = r + OT_SYNC_CHUNK_SIZE; } - *r++ = '2'; - *r++ = '0'; - *r++ = ':'; - memmove(r, hash, sizeof(ot_hash)); - r += sizeof(ot_hash); - r += sprintf(r, "%zd:", byte_count); - memmove(r, peer_list->changeset.data, byte_count); - r += byte_count; + fmt_append(&r, re, "20:"); + fmt_bytes(&r, re, hash, sizeof(ot_hash)); + fmt_append(&r, re, "%zd:", byte_count); + fmt_bytes(&r, re, peer_list->changeset.data, byte_count); } /* All torrents done: release lock on currenct bucket */ -- cgit v1.3