Switch to use SAL_N_ELEMENTS macro, everywhere

This commit is contained in:
Kayo Hamid 2010-10-14 21:14:52 +01:00 committed by Michael Meeks
parent 1b0c6da1c3
commit b7c82daa28
64 changed files with 142 additions and 148 deletions

View file

@ -85,7 +85,7 @@ friend class VBABlackListQuery;
VBABlacklist()
{
const char* list[] = { "Red" };
sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
sal_Int32 nSize = SAL_N_ELEMENTS( list );
for ( sal_Int32 index = 0; index < nSize; ++index )
{
mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;

View file

@ -430,7 +430,7 @@ XmlReader::Namespace XmlReader::scanNamespaceIri(
XmlReader::NAMESPACE_XSI },
{ RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/XML/1998/namespace"),
XmlReader::NAMESPACE_XML } };
for (std::size_t i = 0; i < sizeof iris / sizeof iris[0]; ++i) {
for (std::size_t i = 0; i < SAL_N_ELEMENTS( iris ); ++i) {
if (rtl_str_compare_WithLength(
iri.begin, iri.length, iris[i].begin, iris[i].length) ==
0)
@ -550,7 +550,7 @@ char const * XmlReader::handleReference(char const * position, char const * end)
RTL_CONSTASCII_STRINGPARAM("'") },
{ RTL_CONSTASCII_STRINGPARAM("quot;"),
RTL_CONSTASCII_STRINGPARAM("\"") } };
for (std::size_t i = 0; i < sizeof refs / sizeof refs[0]; ++i) {
for (std::size_t i = 0; i < SAL_N_ELEMENTS( refs ); ++i) {
if (rtl_str_shortenedCompare_WithLength(
position, end - position, refs[i].inBegin, refs[i].inLength,
refs[i].inLength) ==

View file

@ -149,7 +149,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQ
::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
sal_Int32* pType = pTypes;
for (sal_Int32 i = 1; i <= sal_Int32(sizeof(pTypes)/sizeof(pTypes[0])); ++i,++pType)
for (sal_Int32 i = 1; i <= sal_Int32(SAL_N_ELEMENTS(pTypes)); ++i,++pType)
{
ORowSetValue aValue;
aValue.fill(i,*pType,xRow);

View file

@ -354,7 +354,7 @@ namespace dbtools
{
const ::rtl::OUString url = m_pImpl->xConnectionMetaData->getURL();
char pMySQL[] = "sdbc:mysql";
bSupport = url.matchAsciiL(pMySQL,(sizeof(pMySQL)/sizeof(pMySQL[0]))-1);
bSupport = url.matchAsciiL(pMySQL,(SAL_N_ELEMENTS(pMySQL))-1);
}
}
catch( const Exception& )

View file

@ -1299,7 +1299,7 @@ void ODriver::fillEnvironmentVariables()
{ "DBROOT", &m_sDbRoot, &m_sDbRootURL }
};
for ( size_t i = 0; i < sizeof( EnvData ) / sizeof( EnvData[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( EnvData ); ++i )
{
::rtl::OUString sVarName = ::rtl::OUString::createFromAscii( EnvData[i].pAsciiEnvName );
::rtl::OUString sEnvValue;

View file

@ -163,7 +163,7 @@ void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int3
{ "SEL", Privilege::SELECT },
{ "REF", Privilege::REFERENCE }
};
for ( size_t i = 0; i < sizeof( privileges ) / sizeof( privileges[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( privileges ); ++i )
{
sal_Int32 nIndex = sPrivs.indexOf( ::rtl::OUString::createFromAscii( privileges[i].pAsciiName ) );
if ( nIndex == -1 )

View file

@ -1641,7 +1641,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1682,7 +1682,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1725,7 +1725,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any&
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1766,7 +1766,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1809,7 +1809,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1856,7 +1856,7 @@ ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::A
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1906,7 +1906,7 @@ ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any&
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -1948,7 +1948,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno:
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -2020,7 +2020,7 @@ ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& cata
varCriteria[nPos].setString(sTypeNames);
// Create SafeArray Bounds and initialize the array
const sal_Int32 nCrit = sizeof varCriteria / sizeof varCriteria[0];
const sal_Int32 nCrit = SAL_N_ELEMENTS( varCriteria );
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nCrit;
@ -2058,7 +2058,7 @@ ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& cat
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -2103,7 +2103,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno:
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@ -2138,7 +2138,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
{
// Create elements used in the array
OLEVariant varCriteria[2];
const int nCrit = sizeof varCriteria / sizeof varCriteria[0];
const int nCrit = SAL_N_ELEMENTS( varCriteria );
// Create SafeArray Bounds and initialize the array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;

View file

@ -462,7 +462,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
for (sal_Int32 i = 1 ; i <= nCount ; ++i)
{
sColumnName = xMeta->getColumnName(i);
for (sal_uInt32 j = 0 ; j < sizeof(sPrivs)/sizeof(sPrivs[0]); ++j)
for (sal_uInt32 j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j)
{
if ( sPrivs[j] == sColumnName )
{

View file

@ -91,7 +91,7 @@ OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::
"Notes",
};
for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i )
m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
initialize( _rxORB );

View file

@ -259,7 +259,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url )
{ LDAP, "ldap" }
};
for ( size_t i=0; i < sizeof( aSchemeMap ) / sizeof( aSchemeMap[0] ); ++i )
for ( size_t i=0; i < SAL_N_ELEMENTS( aSchemeMap ); ++i )
{
if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 )
return aSchemeMap[i].eType;

View file

@ -1428,7 +1428,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
{ OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" },
{ OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }
};
size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] );
size_t nRuleMapCount = SAL_N_ELEMENTS( aRuleDescriptions );
OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" );
for ( size_t mapEntry = 0; mapEntry < nRuleMapCount; ++mapEntry )

View file

@ -148,7 +148,7 @@ LanguageType lcl_CheckLanguage(
lang::Locale a3( SvxCreateLocale( aLangList[3] ) );
#endif
INT32 nCount = sizeof(aLangList) / sizeof(aLangList[0]);
INT32 nCount = SAL_N_ELEMENTS(aLangList);
for (INT32 i = 0; i < nCount; i++)
{
INT16 nTmpLang = aLangList[i];

View file

@ -346,7 +346,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
{ FormulaMapGroupSpecialOffset::MACRO , ocMacro } ,
{ FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName }
};
const size_t nCount = sizeof(aMap)/sizeof(aMap[0]);
const size_t nCount = SAL_N_ELEMENTS(aMap);
// Preallocate vector elements.
if (aVec.size() < nCount)
{
@ -386,7 +386,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
SC_OPCODE_CLOSE,
SC_OPCODE_SEP,
};
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
}
if ((nGroups & FormulaMapGroup::ARRAY_SEPARATORS) != 0)
{
@ -396,7 +396,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
SC_OPCODE_ARRAY_ROW_SEP,
SC_OPCODE_ARRAY_COL_SEP
};
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
}
if ((nGroups & FormulaMapGroup::UNARY_OPERATORS) != 0)
{
@ -452,7 +452,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
SC_OPCODE_NOT,
SC_OPCODE_NEG
};
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, sizeof(aOpCodes)/sizeof(aOpCodes[0]) );
lclPushOpCodeMapEntries( aVec, mpTable, aOpCodes, SAL_N_ELEMENTS(aOpCodes) );
// functions with 2 or more parameters.
for (USHORT nOp = SC_OPCODE_START_2_PAR; nOp < SC_OPCODE_STOP_2_PAR && nOp < mnSymbols; ++nOp)
{

View file

@ -116,7 +116,7 @@ namespace svt
};
// ................................................................
static const sal_Int32 s_nControlCount = sizeof( aDescriptions ) / sizeof( aDescriptions[0] );
static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions );
static ControlDescIterator s_pControls = aDescriptions;
static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount;
@ -166,7 +166,7 @@ namespace svt
};
// ................................................................
static const int s_nPropertyCount = sizeof( aProperties ) / sizeof( aProperties[0] );
static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties );
static ControlPropertyIterator s_pProperties = aProperties;
static ControlPropertyIterator s_pPropertiesEnd = aProperties + s_nPropertyCount;

View file

@ -2571,7 +2571,7 @@ void SvtFileDialog::implArrangeControls()
// loop through all these controls and adjust the z-order
Window* pPreviousWin = NULL;
Control** pCurrent = pControls;
for ( sal_Int32 i = 0; i < sal_Int32(sizeof( pControls ) / sizeof( pControls[ 0 ] )); ++i, ++pCurrent )
for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pControls )); ++i, ++pCurrent )
{
if ( !*pCurrent )
// this control is not available in the current operation mode -> skip
@ -2751,7 +2751,7 @@ void SvtFileDialog::Resize()
_pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection
};
Control** ppMoveControls = aMoveControlsVert;
Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsVert ) / sizeof( aMoveControlsVert[0] );
Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsVert );
for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
lcl_MoveControl( *ppMoveControls, 0, nDeltaY );
}
@ -2763,7 +2763,7 @@ void SvtFileDialog::Resize()
_pImp->_pBtnFileOpen, _pImp->_pBtnCancel, _pImp->_pBtnHelp
};
Control** ppMoveControls = aMoveControlsBoth;
Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsBoth ) / sizeof( aMoveControlsBoth[0] );
Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsBoth );
for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
lcl_MoveControl( *ppMoveControls, nDeltaX, nDeltaY );
}
@ -2775,7 +2775,7 @@ void SvtFileDialog::Resize()
_pImp->_pBtnUp, _pImp->_pBtnNewFolder, _pImp->_pBtnStandard
};
Control** ppMoveControls = aMoveControlsHor;
Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsHor ) / sizeof( aMoveControlsHor[0] );
Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsHor );
for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls )
lcl_MoveControl( *ppMoveControls, nDeltaX, 0 );
}
@ -2788,7 +2788,7 @@ void SvtFileDialog::Resize()
_pImp->_pEdFileName, _pImp->_pLbFileVersion, _pImp->_pLbTemplates, _pImp->_pLbImageTemplates,
_pImp->GetFilterListControl(), _pImp->_pFtCurrentPath,
};
sal_Int32 nSizeControls = sizeof( aSizeControls ) / sizeof( aSizeControls[0] );
sal_Int32 nSizeControls = SAL_N_ELEMENTS( aSizeControls );
Control** ppSizeControls = aSizeControls;
for ( sal_Int32 j=0; j<nSizeControls; ++j, ++ppSizeControls )
{

View file

@ -184,8 +184,7 @@ namespace // private
stc2, // LISTBOX_FILTER_LABEL
stc3 // LISTBOX_FILE_NAME_LABEL
};
const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS =
sizeof(WindowsFileOpenCtrlIds)/sizeof(WindowsFileOpenCtrlIds[0]);
const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = SAL_N_ELEMENTS(WindowsFileOpenCtrlIds);
}; // end namespace

View file

@ -684,7 +684,7 @@ void BackingWindow::layoutButton(
long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() );
nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on the safe side
if( nColumn >= 0 && nColumn < static_cast<int>(sizeof(mnColumnWidth)/sizeof(mnColumnWidth[0])) )
if( nColumn >= 0 && nColumn < static_cast<int>(SAL_N_ELEMENTS(mnColumnWidth)) )
{
if( nTextWidth > mnColumnWidth[nColumn] )
mnColumnWidth[nColumn] = nTextWidth;

View file

@ -240,7 +240,7 @@ void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu )
if ( pResMgr->IsAvailable( aResId ))
{
ImageList aImageList( aResId );
for ( sal_uInt32 i=0; i < sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i )
for ( sal_uInt32 i=0; i < SAL_N_ELEMENTS(nConvertSlots); ++i )
{
// das entsprechende Image dran
if ( m_bShowMenuImages )
@ -291,7 +291,7 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve
osl::ResettableMutexGuard aLock( m_aMutex );
USHORT nMenuId = 0;
for (sal_uInt32 i=0; i < sizeof(aCommands)/sizeof(aCommands[0]); ++i)
for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
{
if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] ))
{
@ -417,7 +417,7 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::
fillPopupMenu( m_xPopupMenu );
m_aURLToDispatchMap.free();
for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i)
for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
{
aTargetURL.Complete = rtl::OUString::createFromAscii( aCommands[i] );
m_xURLTransformer->parseStrict( aTargetURL );

View file

@ -140,7 +140,7 @@ MenuStyleItem MenuItemStyles[ ] = {
};
sal_Int32 nMenuStyleItemEntries = sizeof( MenuItemStyles ) / sizeof( MenuItemStyles[ 0 ] );
sal_Int32 nMenuStyleItemEntries = SAL_N_ELEMENTS( MenuItemStyles );
static void ExtractMenuParameters( const Sequence< PropertyValue > rProp,
::rtl::OUString& rCommandURL,

View file

@ -135,7 +135,7 @@ ToolboxStyleItem Styles[ ] = {
{ ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
};
sal_Int32 nStyleItemEntries = sizeof( Styles ) / sizeof( Styles[ 0 ] );
sal_Int32 nStyleItemEntries = SAL_N_ELEMENTS( Styles );
struct ToolBarEntryProperty
{

View file

@ -138,7 +138,7 @@ static sal_Unicode aWhiteSpaces[] =
0xfffb /* INTERLINEAR ANNOTATION TERMINATOR */
};
static int nWhiteSpaces = sizeof( aWhiteSpaces ) / sizeof( aWhiteSpaces[0] );
static int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
static bool lcl_IsWhiteSpace( sal_Unicode cChar )
{

View file

@ -298,7 +298,7 @@ OUString LinguOptions::GetName( INT32 nWID )
OUString aRes;
INT32 nLen = sizeof( aWID_Name ) / sizeof( aWID_Name[0] );
INT32 nLen = SAL_N_ELEMENTS( aWID_Name );
if (0 <= nWID && nWID < nLen
&& aWID_Name[ nWID ].nWID == nWID)
{

View file

@ -64,7 +64,7 @@ static const char *aCH[] =
UPN_IS_USE_DICTIONARY_LIST,
};
static int nCHCount = sizeof(aCH) / sizeof(aCH[0]);
static int nCHCount = SAL_N_ELEMENTS(aCH);
PropertyChgHelper::PropertyChgHelper(
@ -389,7 +389,7 @@ PropertyHelper_Spell::PropertyHelper_Spell(
Reference< XPropertySet > &rxPropSet ) :
PropertyChgHelper ( rxSource, rxPropSet, AE_SPELLCHECKER )
{
AddPropNames( aSP, sizeof(aSP) / sizeof(aSP[0]) );
AddPropNames( aSP, SAL_N_ELEMENTS(aSP));
SetDefaultValues();
GetCurrentValues();
@ -577,7 +577,7 @@ PropertyHelper_Hyphen::PropertyHelper_Hyphen(
Reference< XPropertySet > &rxPropSet ) :
PropertyChgHelper ( rxSource, rxPropSet, AE_HYPHENATOR )
{
AddPropNames( aHP, sizeof(aHP) / sizeof(aHP[0]) );
AddPropNames( aHP, SAL_N_ELEMENTS(aHP));
SetDefaultValues();
GetCurrentValues();
}

View file

@ -836,7 +836,7 @@ static const sal_uInt32 the_aDigitZeroes [] =
BOOL HasDigits( const OUString &rText )
{
static const int nNumDigitZeroes = sizeof(the_aDigitZeroes) / sizeof(the_aDigitZeroes[0]);
static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes);
const sal_Int32 nLen = rText.getLength();
sal_Int32 i = 0;

View file

@ -193,7 +193,7 @@ static const char *aSP[] =
PropertyHelper_Spell::PropertyHelper_Spell(
const Reference< XInterface > & rxSource,
Reference< XPropertySet > &rxPropSet ) :
PropertyChgHelper ( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) )
PropertyChgHelper ( rxSource, rxPropSet, aSP, SAL_N_ELEMENTS(aSP))
{
SetDefault();
INT32 nLen = GetPropNames().getLength();

View file

@ -416,7 +416,7 @@ EventInfoHash& getEventTransInfo()
{
rtl::OUString sEventInfo = MAP_CHAR_LEN("");
TranslatePropMap* pTransProp = aTranslatePropMap_Impl;
int nCount = sizeof(aTranslatePropMap_Impl) / sizeof(aTranslatePropMap_Impl[0]);
int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl);
int i = 0;
while (i < nCount)

View file

@ -251,7 +251,7 @@ static HMENU createSystrayMenu( )
OUString aEmpty;
// insert the menu entries for launching the applications
for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i )
{
if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) )
// the complete application is not even installed

View file

@ -144,7 +144,7 @@ void SfxAlienWarningDialog::InitSize()
&m_aSaveODFBtn, &m_aKeepCurrentBtn, &m_aMoreInfoBtn, &m_aOptionLine, &m_aWarningOnBox
};
Window** pCurrent = pWins;
for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
Point aNewPos = (*pCurrent)->GetPosPixel();
aNewPos.Y() -= nDelta;

View file

@ -44,8 +44,6 @@
static USHORT aDPIArray[] = { 72, 96, 150, 200, 300, 600 };
static BOOL bOutputForPrinter = TRUE;
#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ]))
SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) :
SfxTabPage( pParent, SfxResId( TP_COMMONPRINTOPTIONS ), rSet ),
@ -233,7 +231,7 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
aReduceBitmapsResolutionLB.SelectEntryPos( 0 );
else
{
for( long i = ( DPI_COUNT - 1 ); i >= 0; i-- )
for( long i = ( SAL_N_ELEMENTS(aDPIArray) - 1 ); i >= 0; i-- )
{
if( nDPI >= aDPIArray[ i ] )
{
@ -362,7 +360,7 @@ void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOpt
pCurrentOptions->SetReducedBitmapMode( aReduceBitmapsOptimalRB.IsChecked() ? PRINTER_BITMAP_OPTIMAL :
( aReduceBitmapsNormalRB.IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) );
pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ Min( (USHORT) aReduceBitmapsResolutionLB.GetSelectEntryPos(),
(USHORT)( sizeof( aDPIArray ) / sizeof( aDPIArray[ 0 ] ) - 1 ) ) ] );
(USHORT)( SAL_N_ELEMENTS( aDPIArray ) - 1 ) ) ] );
pCurrentOptions->SetReducedBitmapIncludesTransparency( aReduceBitmapsTransparencyCB.IsChecked() );
pCurrentOptions->SetConvertToGreyscales( aConvertToGreyscalesCB.IsChecked() );
}

View file

@ -459,7 +459,7 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
};
::comphelper::NamedValueCollection aViewArgs;
for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i )
for ( size_t i=0; i < SAL_N_ELEMENTS( pKnownViewArgs ); ++i )
{
if ( io_rDescriptor.has( pKnownViewArgs[i] ) )
{

View file

@ -819,8 +819,7 @@ ConfigurationValue const ConfigurationValues[] =
#endif // ENABLE_LOCKDOWN
};
std::size_t const nConfigurationValues =
sizeof ConfigurationValues / sizeof ConfigurationValues[0];
std::size_t const nConfigurationValues = SAL_N_ELEMENTS(ConfigurationValues);
css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
{

View file

@ -53,7 +53,7 @@ namespace /* private */
{{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT},VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"}
};
size_t ColumnInfoTableSize = sizeof(ColumnInfoTable)/sizeof(ColumnInfoTable[0]);
size_t ColumnInfoTableSize = SAL_N_ELEMENTS(ColumnInfoTable);
}
//----------------------------

View file

@ -68,7 +68,7 @@ PROPERTYMAP g_rgPROPERTYMAP[] =
{ PKEY_Comment, L"OpenOffice.org", L"Comments" },
};
size_t gPropertyMapTableSize = sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]);
size_t gPropertyMapTableSize = SAL_N_ELEMENTS(g_rgPROPERTYMAP);
//----------------------------
//

View file

@ -68,7 +68,7 @@ FileExtensionEntry OOFileExtensionTable[] = {
};
size_t OOFileExtensionTableSize = sizeof(OOFileExtensionTable)/sizeof(OOFileExtensionTable[0]);
size_t OOFileExtensionTableSize = SAL_N_ELEMENTS(OOFileExtensionTable);
//---------------------------------
/** Return the extension of a file

View file

@ -187,7 +187,7 @@ char* KnownParameter[] =
"--mapi-logon-ui"
};
const size_t nKnownParameter = (sizeof(KnownParameter)/sizeof(KnownParameter[0]));
const size_t nKnownParameter = (SAL_N_ELEMENTS(KnownParameter));
/** @internal */
bool isKnownParameter(const char* aParameterName)

View file

@ -1863,7 +1863,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
}
// loop through all the other windows and adjust their size
for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( ; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
Size aSize = (*pCurrent)->GetSizePixel();
aSize.Width() -= nDelta;
@ -1934,7 +1934,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
&maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT
};
Window** pCurrent = pWins;
for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
Point aPos = (*pCurrent)->GetPosPixel();
aPos.Y() -= nDelta;

View file

@ -895,7 +895,7 @@ void SvxSearchDialog::CalculateDelta_Impl()
if ( nOffset > 0 )
{
long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height();
for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
if ( ( bCalcApp && i < nCalcCtrlCount )
|| ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() )

View file

@ -1696,7 +1696,7 @@ void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol)
Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
Property aPropDesc;
const ::rtl::OUString* pProps = aPropsListenedTo;
const ::rtl::OUString* pPropsEnd = pProps + sizeof( aPropsListenedTo ) / sizeof( aPropsListenedTo[ 0 ] );
const ::rtl::OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo );
for (; pProps != pPropsEnd; ++pProps)
{
if ( xInfo->hasPropertyByName( *pProps ) )
@ -1719,7 +1719,7 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol)
};
Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
for (sal_uInt16 i=0; i<sizeof(aPropsListenedTo)/sizeof(aPropsListenedTo[0]); ++i)
for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(aPropsListenedTo); ++i)
if (xInfo->hasPropertyByName(aPropsListenedTo[i]))
xCol->removePropertyChangeListener(aPropsListenedTo[i], this);
}
@ -2765,7 +2765,7 @@ Sequence<sal_uInt16>& FmXGridPeer::getSupportedGridSlots()
DbGridControl::NavigationBar::RECORD_NEW,
SID_FM_RECORD_UNDO
};
aSupported.realloc(sizeof(nSupported)/sizeof(nSupported[0]));
aSupported.realloc(SAL_N_ELEMENTS(nSupported));
sal_uInt16* pSupported = aSupported.getArray();
for (sal_uInt16 i=0; i<aSupported.getLength(); ++i, ++pSupported)
*pSupported = nSupported[i];
@ -2787,7 +2787,7 @@ Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs()
FMURL_RECORD_MOVETONEW,
FMURL_RECORD_UNDO
};
aSupported.realloc(sizeof(sSupported)/sizeof(sSupported[0]));
aSupported.realloc(SAL_N_ELEMENTS(sSupported));
::com::sun::star::util::URL* pSupported = aSupported.getArray();
sal_uInt16 i;

View file

@ -736,7 +736,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
if ( ( _eInitWhat & InitWritingMode ) != 0 )
{
for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i )
for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i )
{
if ( pWindows[i] )
pWindows[i]->EnableRTL( rParent.IsRTLEnabled() );
@ -745,7 +745,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
if ( ( _eInitWhat & InitFont ) != 0 )
{
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if ( !pWindows[i] )
continue;
@ -777,7 +777,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
sal_Bool bTextLineColor = rParent.IsTextLineColor();
Color aTextLineColor( rParent.GetTextLineColor() );
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if ( pWindows[i] )
{
@ -798,7 +798,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni
if (rParent.IsControlBackground())
{
Color aColor( rParent.GetControlBackground());
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
if ( pWindows[i] )
{

View file

@ -778,7 +778,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
case STATE_CHANGE_MIRRORING:
{
BOOL bIsRTLEnabled = IsRTLEnabled();
for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i )
for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i )
pWindows[i]->EnableRTL( bIsRTLEnabled );
}
break;
@ -792,7 +792,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
pWindows[i]->SetZoom(aZoom);
pWindows[i]->SetZoomedPointFont(aFont);

View file

@ -171,7 +171,7 @@ IParseContext::InternationalKeyCode OSystemParseContext::getIntlKeyCode(const ::
KEY_COLLECT, KEY_FUSION, KEY_INTERSECTION
};
sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0];
sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID );
for (sal_uInt32 i = 0; i < nCount; i++)
{
::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]);

View file

@ -2925,7 +2925,7 @@ namespace svxform
&m_aCalculateBtn
};
Window** pCurrent = pWinsForHide;
for ( ; i < sizeof( pWinsForHide ) / sizeof( pWinsForHide[ 0 ] ); ++i, ++pCurrent )
for ( ; i < SAL_N_ELEMENTS( pWinsForHide ); ++i, ++pCurrent )
(*pCurrent)->Hide();
Window* pWinsForMove[] =
@ -2933,7 +2933,7 @@ namespace svxform
&m_aButtonsFL, &m_aOKBtn, &m_aEscBtn, &m_aHelpBtn
};
pCurrent = pWinsForMove;
for ( i = 0; i < sizeof( pWinsForMove ) / sizeof( pWinsForMove[ 0 ] ); ++i, ++pCurrent )
for ( i = 0; i < SAL_N_ELEMENTS( pWinsForMove ); ++i, ++pCurrent )
{
Point aNewPos = (*pCurrent)->GetPosPixel();
aNewPos.Y() -= nDelta;

View file

@ -307,7 +307,7 @@ FmPropBrw::~FmPropBrw()
, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) )
, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) )
, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ) };
for ( size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i )
xName->removeByName( pProps[i] );
}
}
@ -594,7 +594,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell )
::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ), makeAny( xControlMap ) )
};
m_xInspectorContext.set(
::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ),
xOwnContext ) );
bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );

View file

@ -87,7 +87,7 @@ using namespace ::svxform;
FM_SUN_COMPONENT_IMAGECONTROL
};
static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
::rtl::OUString* pStrings = aSeq.getArray();

View file

@ -230,7 +230,7 @@ sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView,
INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3,
INET_PROT_VIM, INET_PROT_LDAP
};
for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i)
for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(s_aQuickHelpSupported); ++i)
if (s_aQuickHelpSupported[i] == aProtocol)
{
aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS);

View file

@ -1139,7 +1139,7 @@ PopupMenu* FmXFormShell::GetConversionMenu()
PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU ));
ImageList aImageList( SVX_RES( bIsHiContrastMode ? RID_SVXIMGLIST_FMEXPL_HC : RID_SVXIMGLIST_FMEXPL) );
for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i )
{
// das entsprechende Image dran
pNewMenu->SetItemImage(nConvertSlots[i], aImageList.GetImage(nCreateSlots[i]));
@ -1152,7 +1152,7 @@ PopupMenu* FmXFormShell::GetConversionMenu()
bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::isControlConversionSlot" );
for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i )
if (nConvertSlots[i] == nSlotId)
return true;
return false;
@ -1190,7 +1190,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
OSL_ENSURE( isSolelySelected( _rxObject ),
"FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" );
for ( size_t lookupSlot = 0; lookupSlot < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++lookupSlot )
for ( size_t lookupSlot = 0; lookupSlot < SAL_N_ELEMENTS( nConvertSlots ); ++lookupSlot )
{
if (nConvertSlots[lookupSlot] == _nSlotId)
{
@ -1406,10 +1406,10 @@ bool FmXFormShell::canConvertCurrentSelectionToControl( sal_Int16 nConversionSlo
)
return false; // those types cannot be converted
DBG_ASSERT(sizeof(nConvertSlots)/sizeof(nConvertSlots[0]) == sizeof(nObjectTypes)/sizeof(nObjectTypes[0]),
DBG_ASSERT(SAL_N_ELEMENTS(nConvertSlots) == SAL_N_ELEMENTS(nObjectTypes),
"FmXFormShell::canConvertCurrentSelectionToControl: nConvertSlots & nObjectTypes must have the same size !");
for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i )
if (nConvertSlots[i] == nConversionSlot)
return nObjectTypes[i] != nObjectType;
@ -2168,7 +2168,7 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection )
impl_updateCurrentForm( xNewCurrentForm );
// ensure some slots are updated
for ( size_t i = 0; i < sizeof( SelObjectSlotMap ) / sizeof( SelObjectSlotMap[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( SelObjectSlotMap ); ++i )
InvalidateSlot( SelObjectSlotMap[i], sal_False);
return true;
@ -2211,7 +2211,7 @@ void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurFo
pPage->GetImpl().setCurForm( m_xCurrentForm );
// ensure the UI which depends on the current form is up-to-date
for ( size_t i = 0; i < sizeof( DlgSlotMap ) / sizeof( DlgSlotMap[0] ); ++i )
for ( size_t i = 0; i < SAL_N_ELEMENTS( DlgSlotMap ); ++i )
InvalidateSlot( DlgSlotMap[i], sal_False );
}

View file

@ -596,8 +596,8 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME,
FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE
};
sal_Int32 nDefaultValueProps = sizeof(pDefaultValueProperties)/sizeof(pDefaultValueProperties[0]);
OSL_ENSURE(sizeof(aValueProperties)/sizeof(aValueProperties[0]) == nDefaultValueProps,
sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties);
OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps,
"FmXUndoEnvironment::propertyChange: inconsistence!");
for (sal_Int32 i=0; i<nDefaultValueProps; ++i)
{

View file

@ -121,7 +121,7 @@ namespace svx
{ FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter },
{ FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort }
};
for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i )
for ( size_t i=0; i < SAL_N_ELEMENTS(aDescriptions); ++i )
s_aFeatureDescriptions.push_back( aDescriptions[i] );
}
};
@ -534,7 +534,7 @@ namespace svx
SID_FM_FILTER_START,
SID_FM_VIEW_AS_GRID
};
sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
sal_Int32 nFeatureCount = SAL_N_ELEMENTS( pSupportedFeatures );
aSupportedFeatures.resize( nFeatureCount );
::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );

View file

@ -879,7 +879,7 @@ namespace {
{ RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG },
{ RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG },
};
for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++)
for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++)
aImpl[rtl::OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id;
bInited = true;
}

View file

@ -551,7 +551,7 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con
{
const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US );
for( long i = 0, nCount = sizeof( aMapper ) / sizeof( aMapper[ 0 ] ); ( i < nCount ) && !aMimeType.Len(); i++ )
for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ )
if( aExt == aMapper[ i ].pExt )
aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US );
}

View file

@ -620,7 +620,7 @@ namespace ucb { namespace ucp { namespace ext
PropertyAttribute::BOUND | PropertyAttribute::READONLY
)
};
return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) );
return Sequence< Property >( aProperties, SAL_N_ELEMENTS( aProperties ));
}
//------------------------------------------------------------------------------------------------------------------

View file

@ -1255,7 +1255,7 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
};
const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]);
const int nProps = SAL_N_ELEMENTS(aGenericProperties);
return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
}
@ -1297,7 +1297,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc
-1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
};
const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]);
const int nProps = SAL_N_ELEMENTS(aCommandInfoTable);
return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
}

View file

@ -1355,7 +1355,7 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
};
const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]);
const int nProps = SAL_N_ELEMENTS(aGenericProperties);
return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
@ -1399,8 +1399,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
-1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
};
const int nProps
= sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] );
const int nProps = SAL_N_ELEMENTS( aCommandInfoTable );
return uno::Sequence< ucb::CommandInfo >(
aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 );
}

View file

@ -78,10 +78,10 @@ using namespace hierarchy_ucp;
//=========================================================================
#define MAKEPROPSEQUENCE( a ) \
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) )
#define MAKECMDSEQUENCE( a ) \
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
//=========================================================================
//

View file

@ -79,10 +79,10 @@ using namespace package_ucp;
//=========================================================================
#define MAKEPROPSEQUENCE( a ) \
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) )
#define MAKECMDSEQUENCE( a ) \
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
//=========================================================================
//

View file

@ -89,10 +89,10 @@ using namespace tdoc_ucp;
//=========================================================================
#define MAKEPROPSEQUENCE( a ) \
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< beans::Property >( a, SAL_N_ELEMTS( a ) )
#define MAKECMDSEQUENCE( a ) \
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
//=========================================================================
//

View file

@ -126,7 +126,7 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog
aFTMasterPasswordWarning.SetPosSizePixel( aFTMasterPasswordWarning.GetPosPixel(), aNewWarningSize );
Window* pControls[] = { &aFL, &aOKBtn, &aCancelBtn, &aHelpBtn };
const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
for ( int i = 0; i < nCCount; ++i )
{
Point aNewPos =(*pControls[i]).GetPosPixel();
@ -149,7 +149,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight()
&aFTMasterPasswordRepeat, &aEDMasterPasswordRepeat, &aFTCautionText,
&aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
Window** pWindow = pWins;
const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] );
const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
{
Point aNewPos = (*pWindow)->GetPosPixel();
@ -168,7 +168,7 @@ void MasterPasswordCreateDialog::CalculateTextHeight()
nDelta += nTemp;
Window* pWins[] = { &aFLCautionText, &aOKBtn, &aCancelBtn, &aHelpBtn };
Window** pWindow = pWins;
const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[0] );
const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
for ( sal_Int32 i = 0; i < nCount; ++i, ++pWindow )
{
Point aNewPos = (*pWindow)->GetPosPixel();

View file

@ -115,7 +115,7 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr,
aFTWarning.SetPosSizePixel( aFTWarning.GetPosPixel(), aNewWarningSize );
Window* pControls[] = { &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
for ( int i = 0; i < nCCount; ++i )
{
Point aNewPos =(*pControls[i]).GetPosPixel();

View file

@ -103,7 +103,7 @@ PasswordDialog::PasswordDialog(
aFTPassword.SetPosSizePixel( aFTPassword.GetPosPixel(), aNewLabelSize );
Window* pControls[] = { &aEDPassword, &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
for ( int i = 0; i < nCCount; ++i )
{
Point aNewPos =(*pControls[i]).GetPosPixel();

View file

@ -225,7 +225,7 @@ void MacroWarning::InitControls()
&maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
};
Window** pCurrent = pWins;
for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
Point aNewPos = (*pCurrent)->GetPosPixel();
aNewPos.Y() -= nDelta;
@ -323,7 +323,7 @@ void MacroWarning::FitControls()
&maDescr2FI, &maAlwaysTrustCB, &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn
};
Window** pCurrent = pWins;
for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent )
{
Point aNewPos = (*pCurrent)->GetPosPixel();
aNewPos.Y() -= nDelta;

View file

@ -352,7 +352,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
// handle the arguments
const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] );
int nArg = SAL_N_ELEMENTS( aArgsPtrArray );
uno::Sequence< uno::Any > aArgs( nArg );
const uno::Any** pArg = aArgsPtrArray;

View file

@ -60,7 +60,7 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s
};
// don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
// some strange behavior
mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
mxContext = ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), NULL );
}
VbaGlobalsBase::~VbaGlobalsBase()
@ -137,7 +137,7 @@ VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException)
// common
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ),
};
static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
static uno::Sequence< rtl::OUString > serviceNames( names, SAL_N_ELEMENTS( names ) );
return serviceNames;
}

View file

@ -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)

View file

@ -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