visomat-data-downloader: don't use a magic value for the datetime packet size
authorAntonio Ospite <ao2@ao2.it>
Wed, 14 Sep 2016 11:24:52 +0000 (13:24 +0200)
committerAntonio Ospite <ao2@ao2.it>
Wed, 14 Sep 2016 11:24:52 +0000 (13:24 +0200)
src/visomat-data-downloader.c

index bc9ec90..a3282ba 100644 (file)
@@ -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];