From b11c925b57646ed4376c7966de1e3ede0f6a8365 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Wed, 14 Sep 2016 13:24:52 +0200
Subject: [PATCH] visomat-data-downloader: don't use a magic value for the
 datetime packet size

---
 src/visomat-data-downloader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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];
-- 
2.1.4