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

New commits:
commit 26e945d22e597d84666225c8d0e9590412e404d7
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Mar 6 08:18:41 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Mar 7 07:12:40 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/+/148294
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 957c64a25bb3..c1a6f9b5bffa 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3996,7 +3996,7 @@ void XMLTextParagraphExport::ExportContentControl(
             GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_ID, 
OUString::number(nId));
         }
 
-        sal_uInt32 nTabIndex;
+        sal_uInt32 nTabIndex = 0;
         xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex;
         if (nTabIndex)
         {

Reply via email to