summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-03-11 16:06:05 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-03-16 10:14:35 +0100
commit6ddec950dc642dcf07956cce42c450a0b775963f (patch)
treef7d2831bf2429b3301ab2a0e59c115440c0faba4 /xmloff
parentcc17485472ca4217013cebaa32f7b574c020a394 (diff)
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@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/ximpshap.cxx7
1 files changed, 3 insertions, 4 deletions
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;