tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
parent
6bbc2eba29
commit
8b327cd86d
10 changed files with 20 additions and 22 deletions
|
@ -1584,7 +1584,7 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst)
|
|||
}
|
||||
|
||||
bool bChanged = false;
|
||||
for (unsigned i = 0; i != SAL_N_ELEMENTS(vIds); ++i)
|
||||
for (unsigned i = 0; i != std::size(vIds); ++i)
|
||||
{
|
||||
Color const aColor = aConfig.GetColorValue(vIds[i].eEntry).nColor;
|
||||
Color& rMyColor = aColors[vIds[i].eTokenType];
|
||||
|
|
|
@ -514,7 +514,7 @@ namespace basegfx::utils
|
|||
}
|
||||
|
||||
B2DPolygon aCurrSegment;
|
||||
const size_t sliceSize=SAL_N_ELEMENTS(numbers)/12;
|
||||
const size_t sliceSize=std::size(numbers)/12;
|
||||
const int* pCurrSegment=numbers + nNumber*sliceSize;
|
||||
for( size_t i=0; i<sliceSize; i++, pCurrSegment++)
|
||||
{
|
||||
|
|
|
@ -157,7 +157,7 @@ void VBATest::testMiscVBAFunctions()
|
|||
SvtSysLocaleOptions aLocalOptions;
|
||||
aLocalOptions.SetLocaleConfigString( aLocale.getBcp47() );
|
||||
|
||||
for ( size_t i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
|
||||
for ( size_t i=0; i<std::size( macroSource ); ++i )
|
||||
{
|
||||
OUString sMacroURL = sMacroPathURL
|
||||
+ OUString::createFromAscii( macroSource[ i ] );
|
||||
|
@ -238,7 +238,7 @@ void VBATest::testMiscOLEStuff()
|
|||
uno::makeAny(OUString(o3tl::toU(pODBCDriverName)))
|
||||
};
|
||||
|
||||
for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
|
||||
for ( sal_uInt32 i=0; i<std::size( macroSource ); ++i )
|
||||
{
|
||||
OUString sMacroURL = sMacroPathURL
|
||||
+ OUString::createFromAscii( macroSource[ i ] );
|
||||
|
|
|
@ -3734,7 +3734,7 @@ OUString getBasicTypeName( SbxDataType eType )
|
|||
};
|
||||
|
||||
size_t nPos = static_cast<size_t>(eType) & 0x0FFF;
|
||||
const size_t nTypeNameCount = SAL_N_ELEMENTS( pTypeNames );
|
||||
const size_t nTypeNameCount = std::size( pTypeNames );
|
||||
if ( nPos >= nTypeNameCount )
|
||||
{
|
||||
nPos = nTypeNameCount - 1;
|
||||
|
|
|
@ -1807,13 +1807,13 @@ static IntervalInfo const * getIntervalInfo( const OUString& rStringCode )
|
|||
{ INTERVAL_N, "n", 1.0 / 1440.0, true }, // Minute
|
||||
{ INTERVAL_S, "s", 1.0 / 86400.0, true } // Second
|
||||
};
|
||||
for( std::size_t i = 0; i != SAL_N_ELEMENTS(aIntervalTable); ++i )
|
||||
{
|
||||
if( rStringCode.equalsIgnoreAsciiCaseAscii(
|
||||
aIntervalTable[i].mStringCode ) )
|
||||
{
|
||||
return &aIntervalTable[i];
|
||||
}
|
||||
auto const pred = [&rStringCode](const IntervalInfo &aInterval) {
|
||||
return rStringCode.equalsIgnoreAsciiCaseAscii(aInterval.mStringCode);
|
||||
};
|
||||
|
||||
auto intervalIter = std::find_if(std::begin(aIntervalTable), std::end(aIntervalTable), pred);
|
||||
if(intervalIter != std::end(aIntervalTable)) {
|
||||
return intervalIter;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
// cf. jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java:
|
||||
void Test::testNothingLostFromLruList() {
|
||||
int a[8];
|
||||
for (int i = 0; i != int(SAL_N_ELEMENTS(a)); ++i) {
|
||||
for (int i = 0; i != int(std::size(a)); ++i) {
|
||||
for (int j = 0; j != i; ++j) {
|
||||
a[j] = 0;
|
||||
}
|
||||
|
|
|
@ -932,7 +932,7 @@ void Chart2ExportTest::testDataLabelBordersDOCX()
|
|||
{ 2, css::drawing::LineStyle_SOLID, 0x00FF0000 } // solid red
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < SAL_N_ELEMENTS(aDataPoints); ++i)
|
||||
for (size_t i = 0; i < std::size(aDataPoints); ++i)
|
||||
{
|
||||
xPropSet = xDataSeries->getDataPointByIndex(aDataPoints[i].mnIndex);
|
||||
CPPUNIT_ASSERT(xPropSet.is());
|
||||
|
|
|
@ -27,7 +27,7 @@ BarGeometryResources::BarGeometryResources(weld::Builder* pBuilder)
|
|||
: m_xFT_Geometry(pBuilder->weld_label("shapeft"))
|
||||
, m_xLB_Geometry(pBuilder->weld_tree_view("shape"))
|
||||
{
|
||||
for (size_t i = 0; i < SAL_N_ELEMENTS(CHART_TYPE); ++i)
|
||||
for (size_t i = 0; i < std::size(CHART_TYPE); ++i)
|
||||
m_xLB_Geometry->append_text(SchResId(CHART_TYPE[i]));
|
||||
m_xLB_Geometry->set_size_request(-1,
|
||||
m_xLB_Geometry->get_height_rows(SAL_N_ELEMENTS(CHART_TYPE)));
|
||||
|
|
|
@ -333,7 +333,7 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
|
|||
|
||||
const SfxPoolItem *pPoolItem = nullptr;
|
||||
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, true, &pPoolItem) == SfxItemState::SET )
|
||||
for(size_t i=0; i < SAL_N_ELEMENTS(our_aLBEntryMap); ++i )
|
||||
for(size_t i=0; i < std::size(our_aLBEntryMap); ++i )
|
||||
{
|
||||
if( our_aLBEntryMap[i] == static_cast<const SfxStringItem*>(pPoolItem)->GetValue())
|
||||
m_xLB_Separator->set_active( i );
|
||||
|
|
|
@ -143,12 +143,10 @@ bool isBootstrapType(OUString const & name)
|
|||
"com.sun.star.uno.XWeak",
|
||||
"com.sun.star.util.XMacroExpander" };
|
||||
// cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies)
|
||||
for (std::size_t i = 0; i < SAL_N_ELEMENTS(names); ++i) {
|
||||
if (name.equalsAscii(names[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
auto const pred = [&name](const char* aName) {
|
||||
return name.equalsAscii(aName);
|
||||
};
|
||||
return std::any_of(std::begin(names), std::end(names), pred);
|
||||
}
|
||||
|
||||
class CppuType
|
||||
|
|
Loading…
Reference in a new issue