Related tdf#172905: avoid magic number
Change-Id: I60c22d076f0c2435a07bfc12497499092dfb9d7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208977 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user