From 6e6d81e9cfc593d865e409ad22b2307f87a37859 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 29 May 2012 17:23:51 +0100 Subject: targetted SAL_N_ELEMENTS reversion. Change-Id: I30be93ccaeb1f9fd17cbe9e3ed3165e094810b2e --- xmloff/source/core/xmltoken.cxx | 2 +- xmloff/source/forms/elementexport.cxx | 55 ++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 28 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 90e46e3c49a5..6240b0c2d232 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3186,7 +3186,7 @@ namespace xmloff { namespace token { #endif DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" ); DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" ); - DBG_ASSERT(sal_uInt16(eToken) < SAL_N_ELEMENTS(aTokenList),"Illegal position!"); + DBG_ASSERT(sal_uInt16(eToken) < sizeof(aTokenList)/sizeof(aTokenList[0]),"Illegal position!"); XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken]; if (!pToken->pOUString) diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index de85ccfe1e42..06ad07bb9189 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -587,10 +587,11 @@ namespace xmloff { PROPERTY_LABEL, PROPERTY_TITLE }; - OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds), + OSL_ENSURE( sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) == + sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!"); - for (i=0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i) + for (i=0; i 0 - sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); - sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags); + sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); + sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!"); #endif - for (i=0; i < SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i) + for (i=0; i 0 - sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); - sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults); + sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]); + sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]); + sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount), "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!"); #endif - for (i=0; i < SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i) + for (i=0; i 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); OSL_ENSURE((nIdCount == nNameCount), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!"); #endif @@ -1060,12 +1061,12 @@ namespace xmloff 10 }; - sal_Int32 nIdCount = SAL_N_ELEMENTS( nIntegerPropertyAttributeIds ); + sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] ); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS( pIntegerPropertyNames ); + sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] ); OSL_ENSURE( ( nIdCount == nNameCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" ); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS( nIntegerPropertyAttrDefaults ); + sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] ); OSL_ENSURE( ( nIdCount == nDefaultCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" ); #endif @@ -1211,9 +1212,9 @@ namespace xmloff PROPERTY_GROUP_NAME }; - sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds ); + sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] ); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS( pStringPropertyNames ); + sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] ); OSL_ENSURE( ( nIdCount == nNameCount ), "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" ); #endif @@ -2175,9 +2176,9 @@ namespace xmloff { PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds); + sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames); + sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]); OSL_ENSURE((nIdCount == nNameCount), "OFormExport::exportAttributes: somebody tampered with the maps (1)!"); #endif @@ -2224,10 +2225,10 @@ namespace xmloff { BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds); + sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames); - sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags); + sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]); + sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount), "OFormExport::exportAttributes: somebody tampered with the maps (2)!"); #endif @@ -2263,12 +2264,12 @@ namespace xmloff { sal_False, sal_False, sal_False, sal_False, sal_True }; - sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds); + sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]); #if OSL_DEBUG_LEVEL > 0 - sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames); - sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults); - sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags); - sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps); + sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]); + sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]); + sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]); + sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]); OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount), "OFormExport::exportAttributes: somebody tampered with the maps (3)!"); #endif -- cgit