[Libreoffice-commits] core.git: 3 commits - avmedia/source fpicker/source include/rtl sc/source setup_native/source shell/source sw/source vcl/win xmloff/source

Michael Stahl mstahl at redhat.com
Fri Jan 23 05:09:55 PST 2015


 avmedia/source/win/player.cxx                                             |    3 +
 fpicker/source/win32/misc/WinImplHelper.cxx                               |    3 +
 include/rtl/strbuf.hxx                                                    |   17 ++++++++++
 include/rtl/ustrbuf.hxx                                                   |   17 ++++++++++
 sc/source/core/data/documen4.cxx                                          |    3 +
 sc/source/core/data/documentimport.cxx                                    |    3 +
 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx |    3 +
 shell/source/win32/shlxthandler/propsheets/propsheets.cxx                 |    3 +
 shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx               |    3 +
 shell/source/win32/shlxthandler/util/utilities.cxx                        |    3 +
 sw/source/core/txtnode/ndhints.cxx                                        |    6 ---
 vcl/win/source/app/salinst.cxx                                            |    4 ++
 xmloff/source/text/txtparai.cxx                                           |    2 -
 13 files changed, 62 insertions(+), 8 deletions(-)

New commits:
commit 853c2fc71a96755a9dee629fd5d0e1cff9a48034
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 22 14:33:23 2015 +0100

    sal: try to avoid abuse of OUStringBuffer(int) ctor
    
    ... to avoid bugs like commit f0d6e0e1e21afd0adf5bd01d771b2d83d8f13a48.
    
    Change-Id: I1e41d421609e09bf62a7a04ba34f3a8e8d118fd3

diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 9352d54..5450472 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -96,6 +96,23 @@ public:
     {
         rtl_string_new_WithLength( &pData, length );
     }
+#if __cplusplus >= 201103L
+    explicit OStringBuffer(unsigned int length)
+        : OStringBuffer(static_cast<int>(length))
+    {
+    }
+    explicit OStringBuffer(long length)
+        : OStringBuffer(static_cast<int>(length))
+    {
+    }
+    explicit OStringBuffer(unsigned long length)
+        : OStringBuffer(static_cast<int>(length))
+    {
+    }
+    // avoid obvious bugs
+    explicit OStringBuffer(char) = delete;
+    explicit OStringBuffer(sal_Unicode) = delete;
+#endif
 
     /**
         Constructs a string buffer so that it represents the same
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index a9252b8..0240557 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -91,6 +91,23 @@ public:
     {
         rtl_uString_new_WithLength( &pData, length );
     }
+#if __cplusplus >= 201103L
+    explicit OUStringBuffer(unsigned int length)
+        : OUStringBuffer(static_cast<int>(length))
+    {
+    }
+    explicit OUStringBuffer(long length)
+        : OUStringBuffer(static_cast<int>(length))
+    {
+    }
+    explicit OUStringBuffer(unsigned long length)
+        : OUStringBuffer(static_cast<int>(length))
+    {
+    }
+    // avoid obvious bugs
+    explicit OUStringBuffer(char) = delete;
+    explicit OUStringBuffer(sal_Unicode) = delete;
+#endif
 
     /**
         Constructs a string buffer so that it represents the same
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index e593351..27f8a20 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -374,7 +374,8 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam,  // multiple (repeate
     }
 
     ScRefAddress aRef;
-    OUStringBuffer aForString('=');
+    OUStringBuffer aForString;
+    aForString.append('=');
     aForString.append(ScCompiler::GetNativeSymbol(ocTableOp));
     aForString.append(ScCompiler::GetNativeSymbol( ocOpen));
 
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 48878f5..4191642 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -375,7 +375,8 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
 
     ScDocument* pDoc = &mpImpl->mrDoc;
     ScRefAddress aRef;
-    OUStringBuffer aFormulaBuf('=');
+    OUStringBuffer aFormulaBuf;
+    aFormulaBuf.append('=');
     aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocTableOp));
     aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocOpen));
 
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 7676d74..b65135f 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -133,7 +133,7 @@ void XMLCharContext::EndElement()
         }
         else
         {
-            OUStringBuffer sBuff( m_nCount );
+            OUStringBuffer sBuff(static_cast<int>(m_nCount));
             while( m_nCount-- )
                 sBuff.append( &m_c, 1 );
 
commit ba68436e3fea34b4ae696f96f8048502865cdc79
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 22 22:16:34 2015 +0100

    Win SDK 8.1: apparently VersionHelpers.h needs to be included explicitly
    
    http://ci.libreoffice.org/job/lo_gerrit_master/495/Gerrit=Gerrit,Platform=Windows/console
    
    Change-Id: I0104d448906bd17857b3716856c544e632c1662c

diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 1d7040b..a1f7e44 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -26,6 +26,9 @@
 #include <control.h>
 #include <uuids.h>
 #include <evcode.h>
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 #if defined _MSC_VER
 #pragma warning(pop)
 #endif
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index 8f470a2..6e4dcd2 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -24,6 +24,9 @@
 #include <rtl/ustrbuf.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 
 // namespace directives
 
diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
index 5f8b15e..3a71770 100644
--- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
@@ -23,6 +23,9 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <msiquery.h>
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 824b7fd..bd136d1 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -29,6 +29,9 @@
 #pragma warning(push, 1)
 #endif
 #include <shellapi.h>
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 #if defined _MSC_VER
 #pragma warning(pop)
 #endif
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 5d57a4f..c3f883d 100644
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -40,6 +40,9 @@
 #pragma warning(push, 1)
 #endif
 #include <shellapi.h>
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 #if defined _MSC_VER
 #pragma warning(pop)
 #endif
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index f97013ef..8712aa2 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -25,6 +25,9 @@
 #include "internal/config.hxx"
 #include "internal/utilities.hxx"
 
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
 
 // constants
 
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index fe24ffa..1070c05 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -70,6 +70,10 @@
 #include <gdipluscolor.h>
 #include <shlobj.h>
 
+#ifdef _WIN32_WINNT_WINBLUE
+#include <VersionHelpers.h>
+#endif
+
 #ifdef __MINGW32__
 #ifdef GetObject
 #undef GetObject
commit 2830d21964f655c3bbc8cda1f63ce6a3840f6742
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jan 23 14:02:56 2015 +0100

    sw: SwpHintsArray::Contains() cannot call CHECK
    
    ... as the comment implies, so revert this part of
    4fcde4fe8ea5d4521a59e19291e393835144d7d9.
    
    Change-Id: I36505379832739607646d808e2528b47d512826f

diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 9c2b752..6cd9ec9 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -132,11 +132,7 @@ void SwpHintsArray::DeleteAtPos( const size_t nPos )
 
 bool SwpHintsArray::Contains( const SwTxtAttr *pHt ) const
 {
-#ifdef DBG_UTIL
-    Check(true);
-#endif
-
-    // DO NOT use find() here!
+    // DO NOT use find() or CHECK here!
     // if called from SwTxtNode::InsertItem, pHt has already been deleted,
     // so it cannot be dereferenced
     for (size_t i = 0; i < m_HintStarts.size(); ++i)


More information about the Libreoffice-commits mailing list