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

Matteo Casalin matteo.casalin at yahoo.com
Sun Oct 13 12:47:23 PDT 2013


 sw/source/filter/ww8/writerwordglue.cxx |   40 ++++++--------------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

New commits:
commit dfbef666bb8ab76f0a062ef44dc5d166dece49cf
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Oct 13 21:45:17 2013 +0200

    Prefer OUString primitives to handwritten code
    
    Change-Id: I5be917b92eab92be32d8f1cf672ecf4a67b35383

diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index a65175d..a4d995c 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -966,42 +966,18 @@ namespace sw
             return nKey;
         }
 
-        sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos){
-            sal_uInt16 nPos1 = nPos - 1;
-            sal_uInt16 nPos2 = nPos - 2;
-
-            if(nPos1 > nPos || nPos2 > nPos){
-                return sal_False;
-            }else{
-                return (
-                    ( rParams[nPos1] == 'M' || rParams[nPos1] == 'm' ) &&
-                    ( rParams[nPos2] == 'A' || rParams[nPos2] == 'a' )
-                    );
-            }
+        sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos)
+        {
+            return nPos>=2 && rParams.matchIgnoreAsciiCase("am", nPos-2);
         }
-        sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos){
-            sal_Int32 nPos1 = nPos + 1;
-            sal_Int32 nPos2 = nPos + 2;
-
-            if(nPos1 >= rParams.getLength() - 1 || nPos2 > rParams.getLength() - 1){
-                return sal_False;
-            }else{
-                return (
-                    ( rParams[nPos1] == 'P' || rParams[nPos1] == 'p' ) &&
-                    ( rParams[nPos2] == 'M' || rParams[nPos2] == 'm' )
-                    );
-            }
-
+        sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos)
+        {
+            return nPos+2<rParams.getLength() && rParams.matchIgnoreAsciiCase("pm", nPos+1);
         }
         bool IsNotAM(OUString& rParams, sal_Int32 nPos)
         {
-            return (
-                    (nPos == rParams.getLength() - 1) ||
-                    (
-                    (rParams[nPos+1] != 'M') &&
-                    (rParams[nPos+1] != 'm')
-                    )
-                );
+            ++nPos;
+            return nPos>=rParams.getLength() || (rParams[nPos]!='M' && rParams[nPos]!='m');
         }
 
         void SwapQuotesInField(OUString &rFmt)


More information about the Libreoffice-commits mailing list