From 39fe6b5b66de5a2d78368ad8e54c8e132da5b090 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 3 Aug 2022 15:13:16 +0200 Subject: [PATCH] Rename buffer_util.h to binary.h It will allow to expose more binary util functions not related to buffers. PR #3369 --- app/meson.build | 4 +-- app/src/control_msg.c | 2 +- app/src/demuxer.c | 2 +- app/src/device_msg.c | 2 +- app/src/util/{buffer_util.h => binary.h} | 4 +-- .../{test_buffer_util.c => test_binary.c} | 26 +++++++++---------- 6 files changed, 20 insertions(+), 20 deletions(-) rename app/src/util/{buffer_util.h => binary.h} (94%) rename app/tests/{test_buffer_util.c => test_binary.c} (72%) diff --git a/app/meson.build b/app/meson.build index f5d76c61dd..e41b02ba7e 100644 --- a/app/meson.build +++ b/app/meson.build @@ -245,8 +245,8 @@ if get_option('buildtype') == 'debug' 'src/util/str.c', 'src/util/strbuf.c', ]], - ['test_buffer_util', [ - 'tests/test_buffer_util.c', + ['test_binary', [ + 'tests/test_binary.c', ]], ['test_cbuf', [ 'tests/test_cbuf.c', diff --git a/app/src/control_msg.c b/app/src/control_msg.c index 3c3980160e..0d68c45c65 100644 --- a/app/src/control_msg.c +++ b/app/src/control_msg.c @@ -5,7 +5,7 @@ #include #include -#include "util/buffer_util.h" +#include "util/binary.h" #include "util/log.h" #include "util/str.h" diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 9412eda70a..2c0c64a847 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -7,7 +7,7 @@ #include "decoder.h" #include "events.h" #include "recorder.h" -#include "util/buffer_util.h" +#include "util/binary.h" #include "util/log.h" #define SC_PACKET_HEADER_SIZE 12 diff --git a/app/src/device_msg.c b/app/src/device_msg.c index 4b4a497405..265c750574 100644 --- a/app/src/device_msg.c +++ b/app/src/device_msg.c @@ -4,7 +4,7 @@ #include #include -#include "util/buffer_util.h" +#include "util/binary.h" #include "util/log.h" ssize_t diff --git a/app/src/util/buffer_util.h b/app/src/util/binary.h similarity index 94% rename from app/src/util/buffer_util.h rename to app/src/util/binary.h index a5456abf83..e77f5e8218 100644 --- a/app/src/util/buffer_util.h +++ b/app/src/util/binary.h @@ -1,5 +1,5 @@ -#ifndef SC_BUFFER_UTIL_H -#define SC_BUFFER_UTIL_H +#ifndef SC_BINARY_H +#define SC_BINARY_H #include "common.h" diff --git a/app/tests/test_buffer_util.c b/app/tests/test_binary.c similarity index 72% rename from app/tests/test_buffer_util.c rename to app/tests/test_binary.c index a9fec89601..93aeccc8d8 100644 --- a/app/tests/test_buffer_util.c +++ b/app/tests/test_binary.c @@ -2,9 +2,9 @@ #include -#include "util/buffer_util.h" +#include "util/binary.h" -static void test_buffer_write16be(void) { +static void test_write16be(void) { uint16_t val = 0xABCD; uint8_t buf[2]; @@ -14,7 +14,7 @@ static void test_buffer_write16be(void) { assert(buf[1] == 0xCD); } -static void test_buffer_write32be(void) { +static void test_write32be(void) { uint32_t val = 0xABCD1234; uint8_t buf[4]; @@ -26,7 +26,7 @@ static void test_buffer_write32be(void) { assert(buf[3] == 0x34); } -static void test_buffer_write64be(void) { +static void test_write64be(void) { uint64_t val = 0xABCD1234567890EF; uint8_t buf[8]; @@ -42,7 +42,7 @@ static void test_buffer_write64be(void) { assert(buf[7] == 0xEF); } -static void test_buffer_read16be(void) { +static void test_read16be(void) { uint8_t buf[2] = {0xAB, 0xCD}; uint16_t val = sc_read16be(buf); @@ -50,7 +50,7 @@ static void test_buffer_read16be(void) { assert(val == 0xABCD); } -static void test_buffer_read32be(void) { +static void test_read32be(void) { uint8_t buf[4] = {0xAB, 0xCD, 0x12, 0x34}; uint32_t val = sc_read32be(buf); @@ -58,7 +58,7 @@ static void test_buffer_read32be(void) { assert(val == 0xABCD1234); } -static void test_buffer_read64be(void) { +static void test_read64be(void) { uint8_t buf[8] = {0xAB, 0xCD, 0x12, 0x34, 0x56, 0x78, 0x90, 0xEF}; @@ -71,11 +71,11 @@ int main(int argc, char *argv[]) { (void) argc; (void) argv; - test_buffer_write16be(); - test_buffer_write32be(); - test_buffer_write64be(); - test_buffer_read16be(); - test_buffer_read32be(); - test_buffer_read64be(); + test_write16be(); + test_write32be(); + test_write64be(); + test_read16be(); + test_read32be(); + test_read64be(); return 0; }