xmloff/source/text/txtparae.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 656850deda2bd478b828a761d2231c65b1fa771e
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Mar 6 08:18:41 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Mar 10 11:50:17 2023 +0000

    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 <vmik...@collabora.com>
    Tested-by: Jenkins

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,

Reply via email to