[Libreoffice-commits] core.git: 3 commits - connectivity/source fpicker/source sal/rtl sfx2/source vcl/quartz

Stephan Bergmann sbergman at redhat.com
Tue Jul 1 14:22:03 PDT 2014


 connectivity/source/drivers/macab/MacabResultSet.cxx |    2 -
 fpicker/source/aqua/CFStringUtilities.hxx            |   14 +++++-----
 sal/rtl/string.cxx                                   |    6 ++--
 sal/rtl/surrogates.hxx                               |   25 +++++++++++--------
 sal/rtl/uri.cxx                                      |   15 -----------
 sal/rtl/ustring.cxx                                  |   14 +++++-----
 sfx2/source/appl/shutdowniconaqua.mm                 |    2 -
 vcl/quartz/salgdi.cxx                                |    2 -
 vcl/quartz/salvd.cxx                                 |    2 -
 9 files changed, 36 insertions(+), 46 deletions(-)

New commits:
commit 4f90623dba6a211e7b4c9e98def91605627c5072
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jul 1 23:21:17 2014 +0200

    Clean up surrogates.hxx
    
    Change-Id: I0eae089be1bde9db822a77bea482c10650c8a137

diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index 9a651b6..2803972 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -138,7 +138,7 @@ static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
             n += 2;
         else
         {
-            if ( !SAL_RTL_IS_HIGH_SURROGATE(c) )
+            if ( !isHighSurrogate(c) )
                 n += 3;
             else
             {
@@ -147,9 +147,9 @@ static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
                 if ( pStr+1 < pEndStr )
                 {
                     c = *(pStr+1);
-                    if ( SAL_RTL_IS_LOW_SURROGATE(c) )
+                    if ( isLowSurrogate(c) )
                     {
-                        nUCS4Char = SAL_RTL_COMBINE_SURROGATES(nUCS4Char, c);
+                        nUCS4Char = combineSurrogates(nUCS4Char, c);
                         pStr++;
                     }
                 }
diff --git a/sal/rtl/surrogates.hxx b/sal/rtl/surrogates.hxx
index ac47050..b100597 100644
--- a/sal/rtl/surrogates.hxx
+++ b/sal/rtl/surrogates.hxx
@@ -20,24 +20,29 @@
 #ifndef INCLUDED_SAL_RTL_SURROGATES_HXX
 #define INCLUDED_SAL_RTL_SURROGATES_HXX
 
-#include "sal/config.h"
+#include <sal/config.h>
+
+#include <sal/types.h>
 
 #define SAL_RTL_FIRST_HIGH_SURROGATE 0xD800
 #define SAL_RTL_LAST_HIGH_SURROGATE 0xDBFF
 #define SAL_RTL_FIRST_LOW_SURROGATE 0xDC00
 #define SAL_RTL_LAST_LOW_SURROGATE 0xDFFF
 
-#define SAL_RTL_IS_HIGH_SURROGATE(utf16) \
-    ((utf16) >= SAL_RTL_FIRST_HIGH_SURROGATE && \
-     (utf16) <= SAL_RTL_LAST_HIGH_SURROGATE)
+inline bool isHighSurrogate(sal_uInt32 utf16) {
+    return utf16 >= SAL_RTL_FIRST_HIGH_SURROGATE
+        && utf16 <= SAL_RTL_LAST_HIGH_SURROGATE;
+}
 
-#define SAL_RTL_IS_LOW_SURROGATE(utf16) \
-    ((utf16) >= SAL_RTL_FIRST_LOW_SURROGATE && \
-     (utf16) <= SAL_RTL_LAST_LOW_SURROGATE)
+inline bool isLowSurrogate(sal_uInt32 utf16) {
+    return utf16 >= SAL_RTL_FIRST_LOW_SURROGATE
+        && utf16 <= SAL_RTL_LAST_LOW_SURROGATE;
+}
 
-#define SAL_RTL_COMBINE_SURROGATES(high, low) \
-    ((((high) - SAL_RTL_FIRST_HIGH_SURROGATE) << 10) + \
-     ((low) - SAL_RTL_FIRST_LOW_SURROGATE) + 0x10000)
+inline sal_uInt32 combineSurrogates(sal_uInt32 high, sal_uInt32 low) {
+    return ((high - SAL_RTL_FIRST_HIGH_SURROGATE) << 10)
+        + (low - SAL_RTL_FIRST_LOW_SURROGATE) + 0x10000;
+}
 
 #endif
 
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 20daac3..e510398 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -41,21 +41,6 @@ std::size_t const nCharClassSize = 128;
 
 sal_Unicode const cEscapePrefix = 0x25; // '%'
 
-inline bool isHighSurrogate(sal_uInt32 nUtf16)
-{
-    return SAL_RTL_IS_HIGH_SURROGATE(nUtf16);
-}
-
-inline bool isLowSurrogate(sal_uInt32 nUtf16)
-{
-    return SAL_RTL_IS_LOW_SURROGATE(nUtf16);
-}
-
-inline sal_uInt32 combineSurrogates(sal_uInt32 high, sal_uInt32 low)
-{
-    return SAL_RTL_COMBINE_SURROGATES(high, low);
-}
-
 inline int getHexWeight(sal_uInt32 nUtf32)
 {
     return nUtf32 >= 0x30 && nUtf32 <= 0x39 ? // '0'--'9'
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index a79c917..c7622bd 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -1010,8 +1010,8 @@ sal_uInt32 SAL_CALL rtl_uString_iterateCodePoints(
     while (incrementCodePoints < 0) {
         assert(n > 0);
         cu = string->buffer[--n];
-        if (SAL_RTL_IS_LOW_SURROGATE(cu) && n != 0 &&
-            SAL_RTL_IS_HIGH_SURROGATE(string->buffer[n - 1]))
+        if (isLowSurrogate(cu) && n != 0 &&
+            isHighSurrogate(string->buffer[n - 1]))
         {
             --n;
         }
@@ -1019,18 +1019,18 @@ sal_uInt32 SAL_CALL rtl_uString_iterateCodePoints(
     }
     assert(n >= 0 && n < string->length);
     cu = string->buffer[n];
-    if (SAL_RTL_IS_HIGH_SURROGATE(cu) && string->length - n >= 2 &&
-        SAL_RTL_IS_LOW_SURROGATE(string->buffer[n + 1]))
+    if (isHighSurrogate(cu) && string->length - n >= 2 &&
+        isLowSurrogate(string->buffer[n + 1]))
     {
-        cp = SAL_RTL_COMBINE_SURROGATES(cu, string->buffer[n + 1]);
+        cp = combineSurrogates(cu, string->buffer[n + 1]);
     } else {
         cp = cu;
     }
     while (incrementCodePoints > 0) {
         assert(n < string->length);
         cu = string->buffer[n++];
-        if (SAL_RTL_IS_HIGH_SURROGATE(cu) && n != string->length &&
-            SAL_RTL_IS_LOW_SURROGATE(string->buffer[n]))
+        if (isHighSurrogate(cu) && n != string->length &&
+            isLowSurrogate(string->buffer[n]))
         {
             ++n;
         }
commit a402fd0d520108ec62b170415b6bc7b04716e3b4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jul 1 23:19:52 2014 +0200

    loplugin:stringconcat
    
    Change-Id: Ibf410eb1b8be81505b8e778aadf916a26ba39468

diff --git a/fpicker/source/aqua/CFStringUtilities.hxx b/fpicker/source/aqua/CFStringUtilities.hxx
index c844c51..58d0951 100644
--- a/fpicker/source/aqua/CFStringUtilities.hxx
+++ b/fpicker/source/aqua/CFStringUtilities.hxx
@@ -141,41 +141,41 @@ inline void DBG_PRINT_EXIT(const char * classname, const char * methodname) {
 }
 
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const char* retVal) {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = " << retVal);
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = " << retVal);
 }
 
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, int retVal) {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = " << retVal);
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = " << retVal);
 }
 
 #if OSL_DEBUG_LEVEL > 1
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const CFStringRef retVal)
 {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = ");
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = ");
     CFShow(retVal);
 }
 #else
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const CFStringRef /* retVal */)
 {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = ");
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = ");
 }
 #endif
 
 #if OSL_DEBUG_LEVEL > 1
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* retVal)
 {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = ");
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = ");
     NSLog(const_cast<NSString*>(retVal));
 }
 #else
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* /* retVal */ )
 {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = ");
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = ");
 }
 #endif
 
 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const OUString& retVal) {
-    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER << "returnValue = " << OUStringToOString(retVal, RTL_TEXTENCODING_UTF8).getStr());
+    SAL_INFO("fpicker.aqua","<<< " << classname << "::" << methodname << PARAMFILLER "returnValue = " << OUStringToOString(retVal, RTL_TEXTENCODING_UTF8).getStr());
 }
 
 #endif // INCLUDED_FPICKER_SOURCE_AQUA_CFSTRINGUTILITIES_HXX
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 1021090..3a0f937 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -469,7 +469,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac
 
     SAL_INFO("vcl.ct",
             "SetFont"
-            << " to "     << mpFontData->GetFamilyName()
+               " to "     << mpFontData->GetFamilyName()
             << ", "       << mpFontData->GetStyleName()
             << " fontid=" << mpFontData->GetFontId()
             << " for "    << pReqFont->GetFamilyName()
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 549bd9f..f430908 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -158,7 +158,7 @@ void AquaSalVirtualDevice::ReleaseGraphics( SalGraphics* )
 
 bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
 {
-    SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::SetSize() this=" << this << " (" << nDX << "x" << nDY << ")" << " mbForeignContext=" << mbForeignContext );
+    SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::SetSize() this=" << this << " (" << nDX << "x" << nDY << ") mbForeignContext=" << mbForeignContext );
 
     if( mbForeignContext )
     {
commit 6a20b62711be3ed14008a9680ce461de34907fbe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jul 1 23:19:17 2014 +0200

    salplug:literaltoboolconversion
    
    Change-Id: I94b3bea97b6b4710bd4bf4c0fe88a1518a151de5

diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx
index be90b12..cc1bd46 100644
--- a/connectivity/source/drivers/macab/MacabResultSet.cxx
+++ b/connectivity/source/drivers/macab/MacabResultSet.cxx
@@ -1057,7 +1057,7 @@ void MacabResultSet::getFastPropertyValue(
     switch (nHandle)
     {
         case PROPERTY_ID_ISBOOKMARKABLE:
-            _rValue <<= (sal_Bool)sal_False;
+            _rValue <<= false;
             break;
         case PROPERTY_ID_CURSORNAME:
         case PROPERTY_ID_RESULTSETCONCURRENCY:
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index 24458ad..da34fcd 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -267,7 +267,7 @@ class RecentFilesStringLength : public ::cppu::WeakImplHelper1< ::com::sun::star
 
         // documents in the picklist will never be opened as templates
         aArgsList[1].Name = "AsTemplate";
-        aArgsList[1].Value = makeAny( (sal_Bool) sal_False );
+        aArgsList[1].Value = makeAny( false );
 
         ::rtl::OUString  aFilter( rRecentFile.aFilter );
         sal_Int32 nPos = aFilter.indexOf( '|' );


More information about the Libreoffice-commits mailing list