[Libreoffice-commits] core.git: rsc/inc rsc/source

Michael Meeks michael.meeks at collabora.com
Sat Apr 30 17:24:24 UTC 2016


 rsc/inc/rsctools.hxx          |    1 -
 rsc/source/prj/start.cxx      |   15 +++++++--------
 rsc/source/tools/rsctools.cxx |   36 +++++-------------------------------
 3 files changed, 12 insertions(+), 40 deletions(-)

New commits:
commit 81d2967bc7be11e7efa40a296fee40210843e5e7
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Apr 30 14:09:13 2016 +0100

    tdf#99587 - make rsc work in tr_TR.UTF-8 locale.
    
    toupper / tolower problematic with exciting Turkish 'i's, bug introduced:
    |*    Ersterstellung    MM 13.02.91
    
    Change-Id: Ifa5cfa7cf28cc3948b9206cda426eb1409dd7cc7
    Reviewed-on: https://gerrit.libreoffice.org/24519
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index ca5d3fe..8cfb5b9 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.hxx
@@ -48,7 +48,6 @@ char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
 
 void RscExit( sal_uInt32 nExit );
 
-// Ansi-Function Forwards
 int rsc_strnicmp( const char *string1, const char *string2, size_t count );
 int rsc_stricmp( const char *string1, const char *string2 );
 char* rsc_strdup( const char* );
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index bf49647..1fd4ead 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -45,8 +45,8 @@ static bool CallPrePro( const OString& rInput,
                         const OString& rOutput, RscPtrPtr * pCmdLine,
                         bool bResponse )
 {
-    RscPtrPtr       aNewCmdL;   // Kommandozeile
-    RscPtrPtr       aRespCmdL;   // Kommandozeile
+    RscPtrPtr       aNewCmdL;
+    RscPtrPtr       aRespCmdL;
     RscPtrPtr *     pCmdL = &aNewCmdL;
     int             i, nRet;
     FILE*           fRspFile = nullptr;
@@ -261,11 +261,11 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         {
             if( !rsc_stricmp( (*ppStr) + 1, "p" )
               || !rsc_stricmp( (*ppStr) + 1, "l" ) )
-            { // kein Preprozessor
+            { // no pre-processor
                 bPrePro = false;
             }
             else if( !rsc_stricmp( (*ppStr) + 1, "h" ) )
-            { // Hilfe anzeigen
+            { // print help
                 bHelp = true;
             }
             else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) )
@@ -273,18 +273,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                 bResponse = true;
             }
             else if( !rsc_strnicmp( (*ppStr) + 1, "fo=", 3 ) )
-            { // anderer Name fuer .res-file
+            { // another Name for .res-file
                 aResName = (*ppStr) + 4;
             }
             else if( !rsc_strnicmp( (*ppStr) + 1, "fp=", 3 ) )
-            { // anderer Name fuer .srs-file
+            { // another Name for .srs-file
                 bSetSrs  = true;
                 aSrsName = (*ppStr);
             }
         }
         else
         {
-            // Eingabedatei
             aInputList.push_back( new OString(*ppStr) );
         }
         ppStr++;
@@ -293,7 +292,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
     if( !aInputList.empty() )
     {
-        /* build the output file names          */
+        // build the output file names
         if (!aResName.getLength())
             aResName = OutputFile( *aInputList[ 0 ], "res" );
         if( ! bSetSrs )
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
index 9c206f5..e043f45 100644
--- a/rsc/source/tools/rsctools.cxx
+++ b/rsc/source/tools/rsctools.cxx
@@ -36,40 +36,14 @@
 /* case insensitive compare of two strings up to a given length */
 int rsc_strnicmp( const char *string1, const char *string2, size_t count )
 {
-    size_t i;
-
-    for( i = 0; ( i < count ) && string1[ i ] && string2[ i ] ; i++ )
-    {
-        if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
-            return -1;
-        else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
-            return 1;
-    }
-    if( i == count )
-        return 0;
-    else if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
-        return -1;
-    else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
-        return 1;
-    return 0;
+    return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
+                string1, strlen (string1), string2, strlen (string2), count);
 }
 
 /* case insensitive compare of two strings */
-int rsc_stricmp( const char *string1, const char *string2 ){
-    int i;
-
-    for( i = 0; string1[ i ] && string2[ i ]; i++ )
-    {
-        if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
-            return -1;
-        else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
-            return 1;
-    }
-    if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
-        return -1;
-    else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
-        return 1;
-    return 0;
+int rsc_stricmp( const char *string1, const char *string2 )
+{
+    return rtl_str_compareIgnoreAsciiCase( string1, string2 );
 }
 
 char* rsc_strdup( const char* pStr )


More information about the Libreoffice-commits mailing list