gnucash stable: [gnc-unicode] Use unicode_compare_internal for gnc_unicode_compare_identical
John Ralls
jralls at code.gnucash.org
Sat Jun 14 18:30:08 EDT 2025
Updated via https://github.com/Gnucash/gnucash/commit/5ca4c8c5 (commit)
from https://github.com/Gnucash/gnucash/commit/a3eaac65 (commit)
commit 5ca4c8c528193f27092d70c60985461f6d91e6fb
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Jun 14 15:24:28 2025 -0700
[gnc-unicode] Use unicode_compare_internal for gnc_unicode_compare_identical
instead of strcmp. strcmp does a byte-by-byte numerical
comparison, not an alphabetical one (e.g. A > e).
Also fix the transposed args in the strstr call in
gnc_unicode_has_substring_identical.
diff --git a/libgnucash/core-utils/gnc-unicode.cpp b/libgnucash/core-utils/gnc-unicode.cpp
index 55ed179506..6a44df33da 100644
--- a/libgnucash/core-utils/gnc-unicode.cpp
+++ b/libgnucash/core-utils/gnc-unicode.cpp
@@ -151,7 +151,7 @@ gnc_unicode_has_substring_identical(const char* needle,
int* position,
int* length)
{
- auto location = strstr(needle, haystack);
+ auto location = strstr(haystack, needle);
if (location && location != haystack)
{
*position = static_cast<int>(location - haystack);
@@ -218,5 +218,6 @@ gnc_unicode_compare_accented_case_sensitive(const char* one, const char* two)
int
gnc_unicode_compare_identical(const char* one, const char* two)
{
- return strcmp(one, two);
+ return unicode_compare_internal(one, two, CompareStrength::IDENTICAL);
+
}
Summary of changes:
libgnucash/core-utils/gnc-unicode.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list