From 7e2ade27a742ea3f8b4989f47c8e147f4bd261ae Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Jun 2023 13:49:47 +0200 Subject: Make sure window id hex starts with 0x (makes monitor recording more reliable), allow CC and CXX to set compiler for build --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f24a3f0..9515d8d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -732,20 +732,26 @@ static bool is_hex_num(char c) { } static bool contains_non_hex_number(const char *str) { + bool hex_start = false; size_t len = strlen(str); if(len >= 2 && memcmp(str, "0x", 2) == 0) { str += 2; len -= 2; + hex_start = true; } + bool is_hex = false; for(size_t i = 0; i < len; ++i) { char c = str[i]; if(c == '\0') return false; if(!is_hex_num(c)) return true; + if((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + is_hex = true; } - return false; + + return is_hex && !hex_start; } static std::string get_date_str() { -- cgit v1.2.3