[Libreoffice-commits] core.git: xmloff/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 16 09:15:10 UTC 2020
xmloff/source/draw/ximpshap.cxx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 6ddec950dc642dcf07956cce42c450a0b775963f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Mar 11 16:06:05 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Mar 16 10:14:35 2020 +0100
Avoid -Werror=maybe-uninitialized
...as seen at least with GCC 10 trunk and --enable-optimized, when bMirroredX/Y
were used without checking that reading them with >>= had succeeded.
Assuming that in this code (added with b4a6977e05d87fe0a79b266ec30e4f403404f1b4
"tdf#129532 tdf#98839 fixes for mirror of custom shapes") it cannot be
guaranteed that rItem.Value is of the right type (so o3tl::forceAccess, which
uses assert to verify the right type, would not be appropriate), but that it is
an exception-worthy error if rItem.Value is not of the right type (so
o3tl::doAccess, which throws a css::uno::RuntimeException upon a wrong type, is
appropriate).
Change-Id: Ibe6991d69a1d6a0c2c41c839c240050a6355e98b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 99a5d313f1b5..fdfbbc2562a8 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -87,6 +87,7 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/vector/b2dvector.hxx>
+#include <o3tl/any.hxx>
#include <o3tl/safeint.hxx>
using namespace ::com::sun::star;
@@ -3774,8 +3775,7 @@ void SdXMLCustomShapeContext::EndElement()
if (aI != maCustomShapeGeometry.end())
{
beans::PropertyValue& rItem = *aI;
- bool bMirroredX;
- rItem.Value >>= bMirroredX;
+ bool bMirroredX = *o3tl::doAccess<bool>(rItem.Value);
rItem.Value <<= !bMirroredX;
rItem.Handle = -1;
rItem.State = beans::PropertyState_DIRECT_VALUE;
@@ -3801,8 +3801,7 @@ void SdXMLCustomShapeContext::EndElement()
if (aI != maCustomShapeGeometry.end())
{
beans::PropertyValue& rItem = *aI;
- bool bMirroredY;
- rItem.Value >>= bMirroredY;
+ bool bMirroredY = *o3tl::doAccess<bool>(rItem.Value);
rItem.Value <<= !bMirroredY;
rItem.Handle = -1;
rItem.State = beans::PropertyState_DIRECT_VALUE;
More information about the Libreoffice-commits
mailing list