From b92586b36ee623e77154f737d04a8eb9633d2d25 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Wed, 13 Oct 2021 17:56:32 +0200 Subject: [PATCH] Code clean-up --- src/hasp/hasp_parser.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/hasp/hasp_parser.cpp b/src/hasp/hasp_parser.cpp index 733ee638..fc14e005 100644 --- a/src/hasp/hasp_parser.cpp +++ b/src/hasp/hasp_parser.cpp @@ -144,13 +144,7 @@ void Parser::get_event_name(uint8_t eventid, char* buffer, size_t size) uint16_t Parser::get_sdbm(const char* str) { uint16_t hash = 0; - char c; - - // while(c = *str++) hash = c + (hash << 6) + (hash << 16) - hash; - while((c = *str++)) { - hash = tolower(c) + (hash << 6) - hash; - } - + while(char c = *str++) hash = tolower(c) + (hash << 6) - hash; // case insensitive return hash; } @@ -184,7 +178,8 @@ int Parser::format_bytes(size_t filesize, char* buf, size_t len) return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_MEGABYTES), filesize / 100, filesize % 100); - return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_GIGABYTES), filesize / 100, filesize % 100); + return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_GIGABYTES), filesize / 100, + filesize % 100); } uint8_t Parser::get_action_id(const char* action)