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

Stephan Bergmann sbergman at redhat.com
Thu Mar 23 14:28:39 UTC 2017


 shell/source/win32/shlxthandler/util/fileextensions.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 6d7ed03dd3c7472a481728b132e4fb8b86957f84
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 23 15:28:11 2017 +0100

    Use rtl::toAsciiLowerCase
    
    Change-Id: I44e9f9382de2a7235b02ad94ff51b7f21295f2ae

diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx
index 607421cc51f3..cb73b1af9796 100644
--- a/shell/source/win32/shlxthandler/util/fileextensions.cxx
+++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx
@@ -19,6 +19,7 @@
 
 #include "algorithm"
 #include "fileextensions.hxx"
+#include <rtl/character.hxx>
 #include <sal/macros.h>
 
 
@@ -76,17 +77,13 @@ std::string get_file_name_extension(const std::string& file_name)
 /** Return the type of a file
 */
 
-char easytolower( char in )
-{
-    if( in<='Z' && in>='A' )
-        return in-('Z'-'z');
-    return in;
-}
-
 File_Type_t get_file_type(const std::string& file_name)
 {
     std::string fext = get_file_name_extension(file_name);
-    std::transform(fext.begin(), fext.end(), fext.begin(), easytolower);
+    std::transform(
+        fext.begin(), fext.end(), fext.begin(),
+        [](char c) {
+            return rtl::toAsciiLowerCase(static_cast<unsigned char>(c)); });
 
     if (std::string::npos != WRITER_FILE_EXTENSIONS.find(fext))
         return WRITER;


More information about the Libreoffice-commits mailing list