[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 22 06:46:48 UTC 2019


 sc/source/ui/unoobj/docuno.cxx |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 193d4c3741753ae19481c849864f55267889e47e
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Thu Feb 21 18:31:35 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Fri Feb 22 07:46:21 2019 +0100

    Revert "getToken+comparison ==> startsWith, reuse available information"
    
    Not equivalent to original code, may cause problems in the future.
    
    This reverts commit 0ae876595e9d9af44fc4d4bc948f8a42d8a27e8d.
    
    Change-Id: Ifbec90620168903d8d3e807f2ca6751b3a82b85f
    Reviewed-on: https://gerrit.libreoffice.org/68176
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ae8bd965f0b2..baf72864eff4 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -833,13 +833,20 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
 
     // Take care of UTF-8 text here.
     OString aMimeType(pMimeType);
-    bool bConvert{ aMimeType.startsWith("text/plain;charset=utf-8") };
-    if (bConvert)
-        aMimeType = "text/plain;charset=utf-16";
+    bool bConvert = false;
+    sal_Int32 nIndex = 0;
+    if (aMimeType.getToken(0, ';', nIndex) == "text/plain")
+    {
+        if (aMimeType.getToken(0, ';', nIndex) == "charset=utf-8")
+        {
+            aMimeType = "text/plain;charset=utf-16";
+            bConvert = true;
+        }
+    }
 
     datatransfer::DataFlavor aFlavor;
     aFlavor.MimeType = OUString::fromUtf8(aMimeType.getStr());
-    if (bConvert || aMimeType == "text/plain;charset=utf-16")
+    if (aMimeType == "text/plain;charset=utf-16")
         aFlavor.DataType = cppu::UnoType<OUString>::get();
     else
         aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get();


More information about the Libreoffice-commits mailing list