From 4bfc01bba3b704fb394cadc26ba191c1e4e35a95 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 26 Dec 2021 08:58:38 +0100 Subject: [PATCH] Fix calculation of number of samples in .c2 files Fixes output message from: Number of samples: 44977 to: Number of samples: 45000 --- rtlsdr_wsprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtlsdr_wsprd.c b/rtlsdr_wsprd.c index 0a90197..791b26e 100644 --- a/rtlsdr_wsprd.c +++ b/rtlsdr_wsprd.c @@ -606,7 +606,7 @@ int32_t readC2file(float *iSamples, float *qSamples, char *filename) { /* Get the size of the file */ fseek(fd, 0L, SEEK_END); - int32_t recsize = ftell(fd) / (2 * sizeof(float)) - 26; + int32_t recsize = (ftell(fd) - 26) / (2 * sizeof(float)); fseek(fd, 0L, SEEK_SET); /* Limit the file/buffer to the max samples */