From: Antonio Ospite Date: Wed, 14 Sep 2016 11:24:52 +0000 (+0200) Subject: visomat-data-downloader: don't use a magic value for the datetime packet size X-Git-Url: https://git.ao2.it/visomat-utils.git/commitdiff_plain/b11c925b57646ed4376c7966de1e3ede0f6a8365?ds=inline visomat-data-downloader: don't use a magic value for the datetime packet size --- diff --git a/src/visomat-data-downloader.c b/src/visomat-data-downloader.c index bc9ec90..a3282ba 100644 --- a/src/visomat-data-downloader.c +++ b/src/visomat-data-downloader.c @@ -63,6 +63,7 @@ static void debug_dump_buffer(const char *filename, uint8_t *buffer, unsigned in #define STX 0x02 #define ETX 0x03 +#define DATETIME_PACKET_SIZE 15 #define BASE_YEAR 2000 typedef enum { @@ -237,7 +238,7 @@ static int decode_datetime(uint8_t *buffer, unsigned int len) struct datetime d; uint8_t *pbuffer = buffer; - if (len != 15) + if (len != DATETIME_PACKET_SIZE) return -EINVAL; code[0] = buffer[1];