From 06a0c2b189ada3fd017a14e3fae685c422068285 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Sun, 7 Aug 2022 17:51:25 +0100 Subject: [PATCH] One more early return to simplify TX callback. --- host/hackrf-tools/src/hackrf_transfer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/host/hackrf-tools/src/hackrf_transfer.c b/host/hackrf-tools/src/hackrf_transfer.c index 254a731d..7e7e8215 100644 --- a/host/hackrf-tools/src/hackrf_transfer.c +++ b/host/hackrf-tools/src/hackrf_transfer.c @@ -533,15 +533,15 @@ int tx_callback(hackrf_transfer* transfer) return 0; } - if (repeat) { - fprintf(stderr, "Input file end reached. Rewind to beginning.\n"); - rewind(file); - fread(transfer->buffer + bytes_read, 1, bytes_to_read - bytes_read, file); - return 0; - } else { + if (!repeat) { stop_main_loop(); return -1; /* not repeat mode, end of file */ } + + fprintf(stderr, "Input file end reached. Rewind to beginning.\n"); + rewind(file); + fread(transfer->buffer + bytes_read, 1, bytes_to_read - bytes_read, file); + return 0; } static int update_stats(hackrf_device* device, hackrf_m0_state* state, stats_t* stats)