summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorKayo Hamid <revol.code@yahoo.com>2010-10-14 21:14:52 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-10-14 21:15:24 +0100
commit8279868bb177cdfc07f3eeed380412616e4958db (patch)
tree5f138b0608affff85602ab4dabc641651508fb72 /xmloff
parent939cd5666cb104ccaad67863258f9a67bb01434b (diff)
Switch to use SAL_N_ELEMENTS macro, everywhere
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/forms/elementexport.cxx55
2 files changed, 28 insertions, 29 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 97f63c1d20..086476f4bf 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3157,7 +3157,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) < sizeof(aTokenList)/sizeof(aTokenList[0]),"Illegal position!");
+ DBG_ASSERT(sal_uInt16(eToken) < SAL_N_ELEMENTS(aTokenList),"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 9a204ae9d4..98e75a9be5 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -500,11 +500,10 @@ namespace xmloff
{
PROPERTY_LABEL, PROPERTY_TITLE
};
- OSL_ENSURE( sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) ==
- sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
+ OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
- for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
+ for (i=0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i)
if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportStringPropertyAttribute(
@@ -535,13 +534,13 @@ namespace xmloff
BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
};
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
- sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
#endif
- for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
+ for (i=0; i < SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i)
if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportBooleanPropertyAttribute(
@@ -578,13 +577,13 @@ namespace xmloff
exportedProperty(PROPERTY_MAXTEXTLENGTH);
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
- sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
- sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames);
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
#endif
- for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
+ for (i=0; i < SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i)
if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportInt16PropertyAttribute(
@@ -933,9 +932,9 @@ namespace xmloff
&PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE,
&PROPERTY_TOGGLE, &PROPERTY_FOCUS_ON_CLICK
};
- sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
OSL_ENSURE((nIdCount == nNameCount),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
#endif
@@ -975,12 +974,12 @@ namespace xmloff
10
};
- sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] );
+ sal_Int32 nIdCount = SAL_N_ELEMENTS( nIntegerPropertyAttributeIds );
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] );
+ sal_Int32 nNameCount = SAL_N_ELEMENTS( pIntegerPropertyNames );
OSL_ENSURE( ( nIdCount == nNameCount ),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
- sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] );
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS( nIntegerPropertyAttrDefaults );
OSL_ENSURE( ( nIdCount == nDefaultCount ),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
#endif
@@ -1119,9 +1118,9 @@ namespace xmloff
&PROPERTY_GROUP_NAME
};
- sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
+ sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds );
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
+ sal_Int32 nNameCount = SAL_N_ELEMENTS( pStringPropertyNames );
OSL_ENSURE( ( nIdCount == nNameCount ),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
#endif
@@ -2058,9 +2057,9 @@ namespace xmloff
{
PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER
};
- sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds);
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames);
OSL_ENSURE((nIdCount == nNameCount),
"OFormExport::exportAttributes: somebody tampered with the maps (1)!");
#endif
@@ -2107,10 +2106,10 @@ namespace xmloff
{
BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
};
- sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds);
#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
- sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
"OFormExport::exportAttributes: somebody tampered with the maps (2)!");
#endif
@@ -2146,12 +2145,12 @@ namespace xmloff
{
sal_False, sal_False, sal_False, sal_False, sal_True
};
- sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds);
#if OSL_DEBUG_LEVEL > 0
- 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]);
+ 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);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
"OFormExport::exportAttributes: somebody tampered with the maps (3)!");
#endif