diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 09:35:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 14:17:14 +0200 |
commit | b70fa47aec65fe95da94fc17640dda27650e9677 (patch) | |
tree | 7e54f37342fd57c324f43d54659335554a9c8e72 /sw/source | |
parent | 6db84250d1c4e7ec5a54ff75e124ea9a84ff89d9 (diff) |
use more SAL_N_ELEMENTS part 1
- teach comphelper::containerToSequence to handle sized arrays
- also use range based for-loop where appropriate.
Change-Id: I73ba9b6295e7b29c872ee53de7a9340969e07f99
Reviewed-on: https://gerrit.libreoffice.org/38769
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/SwStyleNameMapper.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 36 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/config/dbconfig.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/config/fontcfg.cxx | 78 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 95 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/fontcfg.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 8 |
11 files changed, 111 insertions, 176 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index b04106f0bee4..85add0f5807a 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -178,7 +178,7 @@ CalcOp* FindOperator( const OUString& rSrch ) return static_cast<CalcOp*>(bsearch( static_cast<void*>(&aSrch), static_cast<void const *>(aOpTable), - sizeof( aOpTable ) / sizeof( CalcOp ), + SAL_N_ELEMENTS( aOpTable ), sizeof( CalcOp ), OperatorCompare )); } diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index eab9bb0e781d..6d3ae176c6fc 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -877,7 +877,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetTextProgNameArray() { if (!s_pTextProgNameArray) s_pTextProgNameArray = lcl_NewProgNameArray(TextProgNameTable, - sizeof ( TextProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( TextProgNameTable ) ); return *s_pTextProgNameArray; } @@ -885,7 +885,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetListsProgNameArray() { if (!s_pListsProgNameArray) s_pListsProgNameArray = lcl_NewProgNameArray( ListsProgNameTable, - sizeof ( ListsProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( ListsProgNameTable ) ); return *s_pListsProgNameArray; } @@ -893,7 +893,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetExtraProgNameArray() { if (!s_pExtraProgNameArray) s_pExtraProgNameArray = lcl_NewProgNameArray( ExtraProgNameTable, - sizeof ( ExtraProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( ExtraProgNameTable ) ); return *s_pExtraProgNameArray; } @@ -901,7 +901,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetRegisterProgNameArray() { if (!s_pRegisterProgNameArray) s_pRegisterProgNameArray = lcl_NewProgNameArray( RegisterProgNameTable, - sizeof ( RegisterProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( RegisterProgNameTable ) ); return *s_pRegisterProgNameArray; } @@ -909,7 +909,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetDocProgNameArray() { if (!s_pDocProgNameArray) s_pDocProgNameArray = lcl_NewProgNameArray( DocProgNameTable, - sizeof ( DocProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( DocProgNameTable ) ); return *s_pDocProgNameArray; } @@ -917,7 +917,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetHTMLProgNameArray() { if (!s_pHTMLProgNameArray) s_pHTMLProgNameArray = lcl_NewProgNameArray( HTMLProgNameTable, - sizeof ( HTMLProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( HTMLProgNameTable ) ); return *s_pHTMLProgNameArray; } @@ -925,7 +925,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatProgNameArray() { if (!s_pFrameFormatProgNameArray) s_pFrameFormatProgNameArray = lcl_NewProgNameArray( FrameFormatProgNameTable, - sizeof ( FrameFormatProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( FrameFormatProgNameTable ) ); return *s_pFrameFormatProgNameArray; } @@ -933,7 +933,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetChrFormatProgNameArray() { if (!s_pChrFormatProgNameArray) s_pChrFormatProgNameArray = lcl_NewProgNameArray( ChrFormatProgNameTable, - sizeof ( ChrFormatProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( ChrFormatProgNameTable ) ); return *s_pChrFormatProgNameArray; } @@ -941,7 +941,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetHTMLChrFormatProgNameArray() { if (!s_pHTMLChrFormatProgNameArray) s_pHTMLChrFormatProgNameArray = lcl_NewProgNameArray( HTMLChrFormatProgNameTable, - sizeof ( HTMLChrFormatProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( HTMLChrFormatProgNameTable ) ); return *s_pHTMLChrFormatProgNameArray; } @@ -949,7 +949,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetPageDescProgNameArray() { if (!s_pPageDescProgNameArray) s_pPageDescProgNameArray = lcl_NewProgNameArray( PageDescProgNameTable, - sizeof ( PageDescProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( PageDescProgNameTable ) ); return *s_pPageDescProgNameArray; } @@ -957,7 +957,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetNumRuleProgNameArray() { if (!s_pNumRuleProgNameArray) s_pNumRuleProgNameArray = lcl_NewProgNameArray( NumRuleProgNameTable, - sizeof ( NumRuleProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( NumRuleProgNameTable ) ); return *s_pNumRuleProgNameArray; } @@ -965,7 +965,7 @@ const std::vector<OUString>& SwStyleNameMapper::GetTableStyleProgNameArray() { if (!s_pTableStyleProgNameArray) s_pTableStyleProgNameArray = lcl_NewProgNameArray( TableStyleProgNameTable, - sizeof ( TableStyleProgNameTable ) / sizeof ( SwTableEntry ) ); + SAL_N_ELEMENTS ( TableStyleProgNameTable ) ); return *s_pTableStyleProgNameArray; } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f96a1e7465bc..46691f5fec8b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -43,6 +43,7 @@ #include <comphelper/random.hxx> #include <comphelper/string.hxx> #include <comphelper/flagguard.hxx> +#include <comphelper/sequence.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> #include <oox/export/utils.hxx> @@ -882,12 +883,7 @@ void DocxAttributeOutput::InitCollectedParagraphProperties() // postpone the output so that we can later [in EndParagraphProperties()] // prepend the properties before the run - sal_Int32 len = sizeof ( aOrder ) / sizeof( sal_Int32 ); - uno::Sequence< sal_Int32 > aSeqOrder( len ); - for ( sal_Int32 i = 0; i < len; i++ ) - aSeqOrder[i] = aOrder[i]; - - m_pSerializer->mark(Tag_InitCollectedParagraphProperties, aSeqOrder); + m_pSerializer->mark(Tag_InitCollectedParagraphProperties, comphelper::containerToSequence(aOrder)); } void DocxAttributeOutput::WriteCollectedParagraphProperties() @@ -1810,12 +1806,7 @@ void DocxAttributeOutput::InitCollectedRunProperties() // postpone the output so that we can later [in EndParagraphProperties()] // prepend the properties before the run - sal_Int32 len = sizeof ( aOrder ) / sizeof( sal_Int32 ); - uno::Sequence< sal_Int32 > aSeqOrder( len ); - for ( sal_Int32 i = 0; i < len; i++ ) - aSeqOrder[i] = aOrder[i]; - - m_pSerializer->mark(Tag_InitCollectedRunProperties, aSeqOrder); + m_pSerializer->mark(Tag_InitCollectedRunProperties, comphelper::containerToSequence(aOrder)); } namespace @@ -1917,12 +1908,11 @@ const NameToId constNameToIdMapping[] = boost::optional<sal_Int32> lclGetElementIdForName(const OUString& rName) { - sal_Int32 aLength = sizeof (constNameToIdMapping) / sizeof(NameToId); - for (sal_Int32 i=0; i < aLength; ++i) + for (auto const & i : constNameToIdMapping) { - if (rName == constNameToIdMapping[i].maName) + if (rName == i.maName) { - return constNameToIdMapping[i].maId; + return i.maId; } } return boost::optional<sal_Int32>(); @@ -3272,12 +3262,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t // postpone the output so that we can later [] // prepend the properties before the run - sal_Int32 len = sizeof ( aOrder ) / sizeof( sal_Int32 ); - uno::Sequence< sal_Int32 > aSeqOrder( len ); - for ( sal_Int32 i = 0; i < len; i++ ) - aSeqOrder[i] = aOrder[i]; - - m_pSerializer->mark(Tag_TableDefinition, aSeqOrder); + m_pSerializer->mark(Tag_TableDefinition, comphelper::containerToSequence(aOrder)); long nPageSize = 0; const char* widthType = "dxa"; @@ -5611,12 +5596,7 @@ void DocxAttributeOutput::StartSection() // postpone the output so that we can later [in EndParagraphProperties()] // prepend the properties before the run - sal_Int32 len = sizeof ( aOrder ) / sizeof( sal_Int32 ); - uno::Sequence< sal_Int32 > aSeqOrder( len ); - for ( sal_Int32 i = 0; i < len; i++ ) - aSeqOrder[i] = aOrder[i]; - - m_pSerializer->mark(Tag_StartSection, aSeqOrder); + m_pSerializer->mark(Tag_StartSection, comphelper::containerToSequence(aOrder)); m_bHadSectPr = true; } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 530a199cee5b..f80ce894dad6 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -147,17 +147,6 @@ using namespace nsHdFtFlags; #include <comphelper/storagehelper.hxx> #include <sfx2/DocumentMetadataAccess.hxx> -//#define VT_EMPTY 0 -//#define VT_I4 3 -//#define VT_LPSTR 30 -//#define VT_LPWSTR 31 -//#define VT_BLOB 65 -//#define VT_TYPEMASK 0xFFF -/** Expands to a pointer after the last element of a STATIC data array (like STL end()). */ -//#define STATIC_TABLE_END( array ) ((array)+STATIC_TABLE_SIZE(array)) -/** Expands to the size of a STATIC data array. */ -//#define STATIC_TABLE_SIZE( array ) (sizeof(array)/sizeof(*(array))) - SwMacroInfo* GetMacroInfo( SdrObject* pObj, bool bCreate ) // static { if ( pObj ) diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 3a8fe2915114..669b0522b685 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -837,8 +837,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) &SwWW8ImplReader::Read_F_Shape, // 95 nullptr // eMax - Dummy empty method }; - OSL_ENSURE( ( sizeof( aWW8FieldTab ) / sizeof( *aWW8FieldTab ) == eMax+1 ), - "FeldFunc-Tabelle stimmt nicht" ); + OSL_ENSURE( SAL_N_ELEMENTS( aWW8FieldTab ) == eMax+1, "FeldFunc-Tabelle stimmt nicht" ); WW8PLCFx_FLD* pF = m_pPlcxMan->GetField(); OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer nicht da"); diff --git a/sw/source/uibase/config/dbconfig.cxx b/sw/source/uibase/config/dbconfig.cxx index ea9e7d56e901..91b24488bf36 100644 --- a/sw/source/uibase/config/dbconfig.cxx +++ b/sw/source/uibase/config/dbconfig.cxx @@ -29,24 +29,14 @@ using namespace com::sun::star::uno; const Sequence<OUString>& SwDBConfig::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) - { - static const char* aPropNames[] = - { - "AddressBook/DataSourceName", // 0 - "AddressBook/Command", // 1 - "AddressBook/CommandType", // 2 - "Bibliography/CurrentDataSource/DataSourceName", // 4 - "Bibliography/CurrentDataSource/Command", // 5 - "Bibliography/CurrentDataSource/CommandType" // 6 - }; - const int nCount = sizeof(aPropNames)/sizeof(const char*); - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } + static Sequence<OUString> aNames { + "AddressBook/DataSourceName", // 0 + "AddressBook/Command", // 1 + "AddressBook/CommandType", // 2 + "Bibliography/CurrentDataSource/DataSourceName", // 4 + "Bibliography/CurrentDataSource/Command", // 5 + "Bibliography/CurrentDataSource/CommandType" // 6 + }; return aNames; } diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx index 31a02531bf3c..807762a80db1 100644 --- a/sw/source/uibase/config/fontcfg.cxx +++ b/sw/source/uibase/config/fontcfg.cxx @@ -38,52 +38,40 @@ static inline LanguageType lcl_LanguageOfType(sal_Int16 nType, LanguageType eWes : nType >= FONT_STANDARD_CTL ? eCTL : eCJK; } -Sequence<OUString> SwStdFontConfig::GetPropertyNames() +Sequence<OUString> const & SwStdFontConfig::GetPropertyNames() { - Sequence<OUString> aNames; - if(!aNames.getLength()) - { - static const char* aPropNames[] = - { - "DefaultFont/Standard", // 0 - "DefaultFont/Heading", // 1 - "DefaultFont/List", // 2 - "DefaultFont/Caption", // 3 - "DefaultFont/Index", // 4 - "DefaultFontCJK/Standard", // 5 - "DefaultFontCJK/Heading", // 6 - "DefaultFontCJK/List", // 7 - "DefaultFontCJK/Caption", // 8 - "DefaultFontCJK/Index", // 9 - "DefaultFontCTL/Standard", // 10 - "DefaultFontCTL/Heading", // 11 - "DefaultFontCTL/List", // 12 - "DefaultFontCTL/Caption", // 13 - "DefaultFontCTL/Index", // 14 - "DefaultFont/StandardHeight", // 15 - "DefaultFont/HeadingHeight", // 16 - "DefaultFont/ListHeight", // 17 - "DefaultFont/CaptionHeight", // 18 - "DefaultFont/IndexHeight", // 19 - "DefaultFontCJK/StandardHeight", // 20 - "DefaultFontCJK/HeadingHeight", // 21 - "DefaultFontCJK/ListHeight", // 22 - "DefaultFontCJK/CaptionHeight", // 23 - "DefaultFontCJK/IndexHeight", // 24 - "DefaultFontCTL/StandardHeight", // 25 - "DefaultFontCTL/HeadingHeight", // 26 - "DefaultFontCTL/ListHeight", // 27 - "DefaultFontCTL/CaptionHeight", // 28 - "DefaultFontCTL/IndexHeight" // 29 - }; - const int nCount = sizeof(aPropNames)/sizeof(const char*); - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - { - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } - } + static Sequence<OUString> aNames { + "DefaultFont/Standard", // 0 + "DefaultFont/Heading", // 1 + "DefaultFont/List", // 2 + "DefaultFont/Caption", // 3 + "DefaultFont/Index", // 4 + "DefaultFontCJK/Standard", // 5 + "DefaultFontCJK/Heading", // 6 + "DefaultFontCJK/List", // 7 + "DefaultFontCJK/Caption", // 8 + "DefaultFontCJK/Index", // 9 + "DefaultFontCTL/Standard", // 10 + "DefaultFontCTL/Heading", // 11 + "DefaultFontCTL/List", // 12 + "DefaultFontCTL/Caption", // 13 + "DefaultFontCTL/Index", // 14 + "DefaultFont/StandardHeight", // 15 + "DefaultFont/HeadingHeight", // 16 + "DefaultFont/ListHeight", // 17 + "DefaultFont/CaptionHeight", // 18 + "DefaultFont/IndexHeight", // 19 + "DefaultFontCJK/StandardHeight", // 20 + "DefaultFontCJK/HeadingHeight", // 21 + "DefaultFontCJK/ListHeight", // 22 + "DefaultFontCJK/CaptionHeight", // 23 + "DefaultFontCJK/IndexHeight", // 24 + "DefaultFontCTL/StandardHeight", // 25 + "DefaultFontCTL/HeadingHeight", // 26 + "DefaultFontCTL/ListHeight", // 27 + "DefaultFontCTL/CaptionHeight", // 28 + "DefaultFontCTL/IndexHeight" // 29 + }; return aNames; } diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index cabe4be6bbb0..86e9567f756e 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -426,59 +426,48 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const ResStringArray& rHead const Sequence<OUString>& SwMailMergeConfigItem_Impl::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) - { - static const char* aPropNames[] = - { - "OutputToLetter", // 0 - "IncludeCountry", // 1 - "ExcludeCountry", // 2 - "AddressBlockSettings", // 3 - "IsAddressBlock", // 4 - "IsGreetingLine", // 5 - "IsIndividualGreetingLine", // 6 - "FemaleGreetingLines", // 7 - "MaleGreetingLines", // 8 - "NeutralGreetingLines", // 9 - "CurrentFemaleGreeting", // 10 - "CurrentMaleGreeting", // 11 - "CurrentNeutralGreeting", // 12 - "FemaleGenderValue", // 13 - "MailDisplayName", // 14 - "MailAddress", // 15 - "IsMailReplyTo", // 16 - "MailReplyTo", // 17 - "MailServer", // 18 - "MailPort", // 19 - "IsSecureConnection", // 20 - "IsAuthentication", // 21 - "MailUserName", // 22 - "MailPassword", // 23 - "DataSource/DataSourceName",// 24 - "DataSource/DataTableName", // 25 - "DataSource/DataCommandType",// 26 - "Filter", // 27 - "SavedDocuments", // 28 - "EMailSupported", // 29 - "IsEMailGreetingLine", //30 - "IsEMailIndividualGreetingLine", //31 - "IsSMPTAfterPOP", //32 - "InServerName", //33 - "InServerPort", //34 - "InServerIsPOP", //35 - "InServerUserName", //36 - "InServerPassword", //37 - "IsHideEmptyParagraphs", //38 - "CurrentAddressBlock" //39 - - }; - const int nCount = sizeof(aPropNames)/sizeof(const char*); - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } + static Sequence<OUString> aNames { + "OutputToLetter", // 0 + "IncludeCountry", // 1 + "ExcludeCountry", // 2 + "AddressBlockSettings", // 3 + "IsAddressBlock", // 4 + "IsGreetingLine", // 5 + "IsIndividualGreetingLine", // 6 + "FemaleGreetingLines", // 7 + "MaleGreetingLines", // 8 + "NeutralGreetingLines", // 9 + "CurrentFemaleGreeting", // 10 + "CurrentMaleGreeting", // 11 + "CurrentNeutralGreeting", // 12 + "FemaleGenderValue", // 13 + "MailDisplayName", // 14 + "MailAddress", // 15 + "IsMailReplyTo", // 16 + "MailReplyTo", // 17 + "MailServer", // 18 + "MailPort", // 19 + "IsSecureConnection", // 20 + "IsAuthentication", // 21 + "MailUserName", // 22 + "MailPassword", // 23 + "DataSource/DataSourceName", // 24 + "DataSource/DataTableName", // 25 + "DataSource/DataCommandType",// 26 + "Filter", // 27 + "SavedDocuments", // 28 + "EMailSupported", // 29 + "IsEMailGreetingLine", //30 + "IsEMailIndividualGreetingLine", //31 + "IsSMPTAfterPOP", //32 + "InServerName", //33 + "InServerPort", //34 + "InServerIsPOP", //35 + "InServerUserName", //36 + "InServerPassword", //37 + "IsHideEmptyParagraphs", //38 + "CurrentAddressBlock" //39 + }; return aNames; } diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 49ed1f7a7395..2d275b3e5f29 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -212,7 +212,7 @@ static SwWrtShell* lcl_GetShell() return nullptr; } -inline sal_uInt16 GetPackCount() { return sizeof(aSwFields) / sizeof(SwFieldPack); } +inline sal_uInt16 GetPackCount() { return SAL_N_ELEMENTS(aSwFields); } // FieldManager controls inserting and updating of fields SwFieldMgr::SwFieldMgr(SwWrtShell* pSh ) : diff --git a/sw/source/uibase/inc/fontcfg.hxx b/sw/source/uibase/inc/fontcfg.hxx index 72e113baab33..111846b6066c 100644 --- a/sw/source/uibase/inc/fontcfg.hxx +++ b/sw/source/uibase/inc/fontcfg.hxx @@ -58,7 +58,7 @@ class SW_DLLPUBLIC SwStdFontConfig : public utl::ConfigItem OUString sDefaultFonts[DEF_FONT_COUNT]; sal_Int32 nDefaultFontHeight[DEF_FONT_COUNT]; - SAL_DLLPRIVATE static css::uno::Sequence<OUString> GetPropertyNames(); + SAL_DLLPRIVATE static css::uno::Sequence<OUString> const & GetPropertyNames(); void ChangeString(sal_uInt16 nFontType, const OUString& rSet) { diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 3f4758540ab6..08f69fe9c533 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -583,12 +583,12 @@ void SwView::CheckReadonlyState() static bool bFirst = true; if ( bFirst ) { - qsort( static_cast<void*>(aROIds), sizeof(aROIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds ); + qsort( static_cast<void*>(aROIds), SAL_N_ELEMENTS(aROIds), sizeof(sal_uInt16), lcl_CmpIds ); bFirst = false; } if ( SfxItemState::DISABLED == eStateRO ) { - rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, sizeof(aROIds)/sizeof(sal_uInt16), aROIds ); + rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, SAL_N_ELEMENTS(aROIds), aROIds ); bChgd = true; } } @@ -600,11 +600,11 @@ void SwView::CheckReadonlyState() static bool bAllProtFirst = true; if ( bAllProtFirst ) { - qsort( static_cast<void*>(aAllProtIds), sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds ); + qsort( static_cast<void*>(aAllProtIds), SAL_N_ELEMENTS(aAllProtIds), sizeof(sal_uInt16), lcl_CmpIds ); bAllProtFirst = false; } rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, - sizeof(aAllProtIds)/sizeof(sal_uInt16), + SAL_N_ELEMENTS(aAllProtIds), aAllProtIds ); bChgd = true; } |