From af8081d93f958e888fbb359371f34285e7c6057b Mon Sep 17 00:00:00 2001 From: mario4tier Date: Wed, 18 Dec 2024 05:03:03 -0500 Subject: [PATCH] Normalize text to UTF-8 when calculating digest --- include/ta_common.h | 2 +- scripts/utilities/versions.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ta_common.h b/include/ta_common.h index d694bf42..913d69e8 100644 --- a/include/ta_common.h +++ b/include/ta_common.h @@ -151,7 +151,7 @@ TA_RetCode TA_Shutdown( void ); * This value is updated whenever a make, cmake or any source files * modification should trig a repackaging of TA-Lib. */ -#define TA_LIB_SOURCES_DIGEST 187bc60f9b0a5ab37373c6ba6112ca82 +#define TA_LIB_SOURCES_DIGEST fd326e4f34771d306ffc8d8188b95337 #ifdef __cplusplus } diff --git a/scripts/utilities/versions.py b/scripts/utilities/versions.py index 905f276b..cdc74f48 100644 --- a/scripts/utilities/versions.py +++ b/scripts/utilities/versions.py @@ -364,7 +364,7 @@ def sync_sources_digest(root_dir: str) -> Tuple[bool,str]: file_patterns = [ "CMakeLists.txt", "configure.ac", - "*.in", + "ta-lib.*.in", "cmake/*", "src/**/*.c", "src/**/*.h", @@ -395,12 +395,12 @@ def sync_sources_digest(root_dir: str) -> Tuple[bool,str]: for file_path in sorted_files: try: n_files += 1 - with open(file_path, 'rb') as f: + with open(file_path, 'r', encoding='utf-8') as f: n_opens += 1 for line in f: # Normalize line endings to Unix-style LF - normalized_line = line.replace(b'\r\n', b'\n').replace(b'\r', b'\n') - running_hash.update(normalized_line) + #normalized_line = line.replace('\r\n', '\n').replace('\r', '\n') + running_hash.update(line.encode('utf-8')) n_lines += 1 except Exception as e: print(f"Error reading file while updating SOURCES-HASH [{file_path}]: {e}")