diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-23 13:47:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-28 09:43:40 +0200 |
commit | 68e797402692c5c8abf1b2c4374e12a8d2707d07 (patch) | |
tree | d10643f2ce00efe809de0e9548a2c38943e2d11f /oox/source | |
parent | 5733cdba90b099637805648b193510268def74be (diff) |
new loplugin:optionalbool
which warns against using the 'operator bool' conversion of
std::optional<bool> which can lead to interesting bugs
The bugs that this plugin have been submitted independantly,
so this change is just using has_value() in relevant places.
Change-Id: I259b837feeecddcb8cd1d7e5db1e85bf505907cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155978
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/misccontexts.cxx | 2 | ||||
-rw-r--r-- | oox/source/vml/vmltextboxcontext.cxx | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/oox/source/drawingml/misccontexts.cxx b/oox/source/drawingml/misccontexts.cxx index 417b4f35e8a6..2eef9ab6133a 100644 --- a/oox/source/drawingml/misccontexts.cxx +++ b/oox/source/drawingml/misccontexts.cxx @@ -57,7 +57,7 @@ GradientFillContext::GradientFillContext(ContextHandler2Helper const & rParent, auto oRotateWithShape = rAttribs.getBool(XML_rotWithShape); mrGradientProps.moShadeFlip = rAttribs.getToken( XML_flip ); mrGradientProps.moRotateWithShape = oRotateWithShape; - if (mpGradientFill && oRotateWithShape) + if (mpGradientFill && oRotateWithShape.has_value()) mpGradientFill->mbRotateWithShape = *oRotateWithShape; } diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index b7b41cfc06f0..0a3f255d766d 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -60,15 +60,15 @@ TextPortionContext::TextPortionContext( ContextHandler2Helper const & rParent, maFont.monEscapement = nElement; break; case XML_b: - OSL_ENSURE( !maFont.mobBold, "TextPortionContext::TextPortionContext - nested <b> elements" ); + OSL_ENSURE( !maFont.mobBold.has_value(), "TextPortionContext::TextPortionContext - nested <b> elements" ); maFont.mobBold = true; break; case XML_i: - OSL_ENSURE( !maFont.mobItalic, "TextPortionContext::TextPortionContext - nested <i> elements" ); + OSL_ENSURE( !maFont.mobItalic.has_value(), "TextPortionContext::TextPortionContext - nested <i> elements" ); maFont.mobItalic = true; break; case XML_s: - OSL_ENSURE( !maFont.mobStrikeout, "TextPortionContext::TextPortionContext - nested <s> elements" ); + OSL_ENSURE( !maFont.mobStrikeout.has_value(), "TextPortionContext::TextPortionContext - nested <s> elements" ); maFont.mobStrikeout = true; break; case OOX_TOKEN(dml, blip): |