diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-03-06 08:18:41 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-03-10 11:50:17 +0000 |
commit | 656850deda2bd478b828a761d2231c65b1fa771e (patch) | |
tree | 31a7f0729c166dfdd0c5fc41a52cdc2eee252201 /xmloff | |
parent | a20591e08d8996db02f3811b62b06f12a9f033e1 (diff) |
xmloff: fix -Wmaybe-uninitialized
In case operator >>=() of uno::Any fails, it leaves nTabIndex
uninitialized and it seems gcc notices this sometimes:
In file included from include/com/sun/star/uno/Any.h:30,
from include/com/sun/star/uno/Any.hxx:35,
from include/o3tl/any.hxx:21,
from xmloff/source/text/txtparae.cxx:22:
include/rtl/ustring.hxx: In member function ‘void XMLTextParagraphExport::ExportContentControl(const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>&, bool, bool, bool&)’:
include/rtl/ustring.hxx:3044:22: warning: ‘nTabIndex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
3044 | return number( static_cast< unsigned long long >( i ), radix );
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xmloff/source/text/txtparae.cxx:3999:20: note: ‘nTabIndex’ was declared here
3999 | sal_uInt32 nTabIndex;
| ^~~~~~~~~
Change-Id: Ia39e85575bde4011247583265497ddf4d0d4c52b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148598
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index f9928e402295..a06e027c7190 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -4085,7 +4085,7 @@ void XMLTextParagraphExport::ExportContentControl( GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_ID, OUString::number(nId)); } - sal_uInt32 nTabIndex; + sal_uInt32 nTabIndex = 0; if ((xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex) && nTabIndex) { GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_TAB_INDEX, |