clarify that nNum is reused for two different things

so the first use of nNum is dead after scope

no logic change intended

Change-Id: I81a51531418b32a09f5b9dba1131bc65ac71df3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177483
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-11-28 13:09:41 +00:00
parent 6b85f012ff
commit cb5c088c00

View file

@ -676,7 +676,6 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
const OUString& aName( rType.GetTypeName() );
const sal_Int32 nNmLen = aName.getLength();
SwSectionFormats::size_type nNum = 0;
const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) +2;
std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
memset( pSetFlags.get(), 0, nFlagSize );
@ -694,7 +693,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
if ( rNm.startsWith(aName) )
{
// Calculate number and set the Flag
nNum = o3tl::toInt32(rNm.subView( nNmLen ));
SwSectionFormats::size_type nNum = o3tl::toInt32(rNm.subView(nNmLen));
if( nNum-- && nNum < mpSectionFormatTable->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
@ -707,7 +706,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
return sChkStr;
// All Numbers have been flagged accordingly, so get the right Number
nNum = mpSectionFormatTable->size();
SwSectionFormats::size_type nNum = mpSectionFormatTable->size();
for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
{
sal_uInt8 nTmp = pSetFlags[ n ];