From fb4626933e137e2bc86380428ebafa6664375f74 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 1 Aug 2026 23:26:08 +0200 Subject: [PATCH] Related tdf#172905: avoid magic number Change-Id: I60c22d076f0c2435a07bfc12497499092dfb9d7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208977 Reviewed-by: Julien Nabet Tested-by: Jenkins --- tools/source/stream/stream.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 8a08a7b366c5..bce41a48f18e 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -838,6 +838,7 @@ void SvStream::DetectEncoding(size_t maxBytes) // by default, let's use the first character set detected const UCharsetMatch* match = matches[0]; + constexpr int CONFIDENCE_MIN_SKIP_CHARSETS = 10; for (int i=0; i < matchCount; i++) { const char* pName = ucsdet_getName(matches[i], &uerr); @@ -845,7 +846,7 @@ void SvStream::DetectEncoding(size_t maxBytes) SAL_INFO("tools.stream", "\tcharacter set name=" << pName << " has a confidence of " << confidence); - if (confidence == 10 && + if (confidence == CONFIDENCE_MIN_SKIP_CHARSETS && std::find(aSkipCharsets.begin(), aSkipCharsets.end(), pName) != aSkipCharsets.end()) { continue;