sw/source/filter/basflt/iodetect.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dde027cbe68dccf123187f7abb27d439a99bbed5
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Feb 22 19:04:29 2026 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Feb 22 20:39:27 2026 +0100

    Improve SwIoSystem::GetTextEncoding
    
    Use correct type (IsDetectableText takes reference to sal_uLong).
    Initialize eCharSet (IsDetectableText may return without setting
    out charset variable).
    
    Change-Id: I6f1dd2e8c9e58b8f1074267a2f69320a07b3052d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199993
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/filter/basflt/iodetect.cxx 
b/sw/source/filter/basflt/iodetect.cxx
index 3977d6740599..5e2acab50033 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -242,11 +242,11 @@ std::shared_ptr<const SfxFilter> 
SwIoSystem::GetFileFilter(const OUString& rFile
 
 rtl_TextEncoding SwIoSystem::GetTextEncoding(SvStream& rStrm)
 {
-    sal_Size nLen, nOrig;
+    sal_uLong nLen, nOrig;
     char aBuf[4096];
     nOrig = nLen = rStrm.ReadBytes(aBuf, sizeof(aBuf));
 
-    rtl_TextEncoding eCharSet;
+    rtl_TextEncoding eCharSet = RTL_TEXTENCODING_DONTKNOW;
     const bool bRet = SwIoSystem::IsDetectableText(aBuf, nLen, &eCharSet, 
nullptr, nullptr, nullptr);
     if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW)
         rStrm.SeekRel(-(tools::Long(nLen)));

Reply via email to