Kaydet (Commit) 1e3a5bb9 authored tarafından Julien Nabet's avatar Julien Nabet

Use for-range loops in hwpfilter, i18n*, idl* and io

Change-Id: I980464162b73ed9ee0a09acbca1b9050af8d1027
Reviewed-on: https://gerrit.libreoffice.org/51492Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 2980e65d
......@@ -96,13 +96,11 @@ OUString AttributeListImpl::getValueByIndex(sal_Int16 i)
OUString AttributeListImpl::getTypeByName( const OUString& sName )
{
std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
for (; ii != m_pImpl->vecAttribute.end(); ++ii)
for (auto const& elem : m_pImpl->vecAttribute)
{
if( (*ii).sName == sName )
if( elem.sName == sName )
{
return (*ii).sType;
return elem.sType;
}
}
return OUString();
......@@ -111,13 +109,11 @@ OUString AttributeListImpl::getTypeByName( const OUString& sName )
OUString AttributeListImpl::getValueByName(const OUString& sName)
{
std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
for (; ii != m_pImpl->vecAttribute.end(); ++ii)
for (auto const& elem : m_pImpl->vecAttribute)
{
if( (*ii).sName == sName )
if( elem.sName == sName )
{
return (*ii).sValue;
return elem.sValue;
}
}
return OUString();
......
......@@ -749,28 +749,28 @@ bool checkMapping( const OUString& rStr1, const OUString& rStr2 )
void TestLanguageTag::testAllIsoLangEntries()
{
const ::std::vector< MsLangId::LanguagetagMapping > aList( MsLangId::getDefinedLanguagetags());
for (::std::vector< MsLangId::LanguagetagMapping >::const_iterator it( aList.begin()); it != aList.end(); ++it)
for (auto const& elem : aList)
{
bool b=false;
if ((*it).maBcp47 == "la-VA")
if (elem.maBcp47 == "la-VA")
b=true;
(void)b;
LanguageTag aTagString( (*it).maBcp47, true);
LanguageTag aTagID( (*it).mnLang);
if (!checkMapping( (*it).maBcp47, aTagString.getBcp47()))
LanguageTag aTagString( elem.maBcp47, true);
LanguageTag aTagID( elem.mnLang);
if (!checkMapping( elem.maBcp47, aTagString.getBcp47()))
{
OString aMessage( OUStringToOString( (*it).maBcp47, RTL_TEXTENCODING_ASCII_US));
OString aMessage( OUStringToOString( elem.maBcp47, RTL_TEXTENCODING_ASCII_US));
aMessage += " -> " + OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US);
CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage.getStr(), aTagString.getBcp47(), (*it).maBcp47 );
CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage.getStr(), aTagString.getBcp47(), elem.maBcp47 );
}
if ((*it).maBcp47 != aTagID.getBcp47())
if (elem.maBcp47 != aTagID.getBcp47())
{
// There are multiple mappings, ID must be equal after conversions.
LanguageTag aTagBack( aTagID.getBcp47(), true);
if (aTagString.getLanguageType() != aTagBack.getLanguageType())
{
OString aMessage( OUStringToOString( (*it).maBcp47, RTL_TEXTENCODING_ASCII_US));
OString aMessage( OUStringToOString( elem.maBcp47, RTL_TEXTENCODING_ASCII_US));
aMessage += " " + OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US) + ": " +
OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US) + " " +
OString::number( static_cast<sal_uInt16>(aTagString.getLanguageType()), 16) +
......@@ -783,13 +783,13 @@ void TestLanguageTag::testAllIsoLangEntries()
// This does not hold, there are cases like 'ar'
// LANGUAGE_ARABIC_PRIMARY_ONLY that when mapped back results in
// 'ar-SA' as default locale.
if ((*it).mnLang != aTagString.getLanguageType())
if (elem.mnLang != aTagString.getLanguageType())
{
// There are multiple mappings, string must be equal after conversions.
LanguageTag aTagBack( aTagString.getLanguageType());
if (aTagID.getBcp47() != aTagBack.getBcp47())
{
OString aMessage( OUStringToOString( (*it).maBcp47, RTL_TEXTENCODING_ASCII_US));
OString aMessage( OUStringToOString( elem.maBcp47, RTL_TEXTENCODING_ASCII_US));
aMessage += " " + OUStringToOString( aTagID.getBcp47(), RTL_TEXTENCODING_ASCII_US) +
" -> " + OUStringToOString( aTagBack.getBcp47(), RTL_TEXTENCODING_ASCII_US);
CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), aTagID.getBcp47() == aTagBack.getBcp47());
......
......@@ -61,16 +61,15 @@ static const KnownTagSet & getKnowns()
if (rKnowns.empty())
{
::std::vector< MsLangId::LanguagetagMapping > aDefined( MsLangId::getDefinedLanguagetags());
for (::std::vector< MsLangId::LanguagetagMapping >::const_iterator it( aDefined.begin());
it != aDefined.end(); ++it)
for (auto const& elemDefined : aDefined)
{
// Do not use the BCP47 string here to initialize the
// LanguageTag because then canonicalize() would call this
// getKnowns() again..
::std::vector< OUString > aFallbacks( LanguageTag( (*it).mnLang).getFallbackStrings( true));
for (::std::vector< OUString >::const_iterator fb( aFallbacks.begin()); fb != aFallbacks.end(); ++fb)
::std::vector< OUString > aFallbacks( LanguageTag( elemDefined.mnLang).getFallbackStrings( true));
for (auto const& fallback : aFallbacks)
{
rKnowns.insert( *fb);
rKnowns.insert(fallback);
}
}
}
......@@ -2101,9 +2100,9 @@ LanguageTag & LanguageTag::makeFallback()
// "en-US" is the last resort fallback, try if we get a better
// one for the fallback hierarchy of a non-"en" locale.
::std::vector< OUString > aFallbacks( getFallbackStrings( false));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
for (auto const& fallback : aFallbacks)
{
lang::Locale aLocale3( LanguageTag( *it).getLocale());
lang::Locale aLocale3( LanguageTag(fallback).getLocale());
aLocale2 = MsLangId::Conversion::lookupFallbackLocale( aLocale3);
if (aLocale2.Language != "en" || aLocale2.Country != "US")
break; // for, success
......@@ -2652,21 +2651,22 @@ LanguageTagImpl::Extraction LanguageTagImpl::simpleExtract( const OUString& rBcp
::std::vector< OUString > aFallbacks( LanguageTag( rReference).getFallbackStrings( false));
::std::vector< ::std::vector< OUString > > aListFallbacks( rList.size());
size_t i = 0;
for (it = rList.begin(); it != rList.end(); ++it, ++i)
for (auto const& elem : rList)
{
::std::vector< OUString > aTmp( LanguageTag( *it).getFallbackStrings( true));
aListFallbacks[i] = aTmp;
::std::vector< OUString > aTmp( LanguageTag(elem).getFallbackStrings( true));
aListFallbacks[i++] = aTmp;
}
for (::std::vector< OUString >::const_iterator rfb( aFallbacks.begin()); rfb != aFallbacks.end(); ++rfb)
for (auto const& rfb : aFallbacks)
{
for (::std::vector< ::std::vector< OUString > >::const_iterator lfb( aListFallbacks.begin());
lfb != aListFallbacks.end(); ++lfb)
size_t nPosFb = 0;
for (auto const& lfb : aListFallbacks)
{
for (::std::vector< OUString >::const_iterator fb( (*lfb).begin()); fb != (*lfb).end(); ++fb)
for (auto const& fb : lfb)
{
if (*rfb == *fb)
return rList.begin() + (lfb - aListFallbacks.begin());
if (rfb == fb)
return rList.begin() + nPosFb;
}
++nPosFb;
}
}
......
......@@ -182,9 +182,9 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
if (!bLoaded)
{
::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
for (auto const& fallback : aFallbacks)
{
bLoaded = createCollator( rLocale, *it + "_" + rSortAlgorithm, rSortAlgorithm);
bLoaded = createCollator( rLocale, fallback + "_" + rSortAlgorithm, rSortAlgorithm);
if (bLoaded)
break;
}
......
......@@ -133,9 +133,9 @@ IndexEntrySupplier::getLocaleSpecificIndexEntrySupplier(const Locale& rLocale, c
if (!bLoaded)
{
::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
for (auto const& fallback : aFallbacks)
{
bLoaded = createLocaleSpecificIndexEntrySupplier( *it + "_" + aSortAlgorithm);
bLoaded = createLocaleSpecificIndexEntrySupplier(fallback + "_" + aSortAlgorithm);
if (bLoaded)
break;
}
......
......@@ -920,11 +920,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
else
{
bool bHaveAbbr = false;
for (::std::vector< OUString >::const_iterator it( theDateAcceptancePatterns.begin());
!bHaveAbbr && it != theDateAcceptancePatterns.end(); ++it)
for (auto const& elem : theDateAcceptancePatterns)
{
if ((*it).indexOf('D') > -1 && (*it).indexOf('M') > -1 && (*it).indexOf('Y') <= -1)
if (elem.indexOf('D') > -1 && elem.indexOf('M') > -1 && elem.indexOf('Y') <= -1)
{
bHaveAbbr = true;
break;
}
}
if (!bHaveAbbr)
incError( "No abbreviated DateAcceptancePattern present. For example M/D or D.M.\n");
......@@ -1257,17 +1259,16 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
{
nIndex = 0;
sal_uInt32 cDecSep = aDecSep.iterateCodePoints( &nIndex);
for (vector<OUString>::const_iterator aIt = theDateAcceptancePatterns.begin();
aIt != theDateAcceptancePatterns.end(); ++aIt)
for (auto const& elem : theDateAcceptancePatterns)
{
if ((*aIt).getLength() == (cDecSep <= 0xffff ? 3 : 4))
if (elem.getLength() == (cDecSep <= 0xffff ? 3 : 4))
{
nIndex = 1;
if ((*aIt).iterateCodePoints( &nIndex) == cDecSep)
if (elem.iterateCodePoints( &nIndex) == cDecSep)
{
++nError;
fprintf( stderr, "Error: Date acceptance pattern '%s' matches decimal number '#%s#'\n",
OSTR( *aIt), OSTR( aDecSep));
OSTR(elem), OSTR( aDecSep));
}
}
}
......
......@@ -87,9 +87,9 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale)
if (!xI.is())
{
::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( aLocale));
for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
for (auto const& fallback : aFallbacks)
{
xI = m_xContext->getServiceManager()->createInstanceWithContext( aPrefix + *it, m_xContext);
xI = m_xContext->getServiceManager()->createInstanceWithContext( aPrefix + fallback, m_xContext);
if (xI.is())
break;
}
......
......@@ -264,17 +264,17 @@ bool SvIdlDataBase::ReadIdFile( const OString& rOFileName )
SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType,
SvRefMemberList<SvMetaType *>& rList )
{
for( SvRefMemberList<SvMetaType *>::const_iterator it = rList.begin(); it != rList.end(); ++it )
if( *it == pPType )
return *it;
for (auto const& elem : rList)
if( elem == pPType )
return elem;
return nullptr;
}
SvMetaType * SvIdlDataBase::FindType( const OString& rName )
{
for( SvRefMemberList<SvMetaType *>::const_iterator it = aTypeList.begin(); it != aTypeList.end(); ++it )
if( rName == (*it)->GetName() )
return *it;
for (auto const& elem : aTypeList)
if( rName == elem->GetName() )
return elem;
return nullptr;
}
......
......@@ -394,13 +394,12 @@ void AstAttribute::dumpExceptions(
"void", 0,
static_cast< sal_uInt16 >(exceptions.size()));
sal_uInt16 exceptionIndex = 0;
for (DeclList::const_iterator i(exceptions.begin());
i != exceptions.end(); ++i)
for (auto const& elem : exceptions)
{
writer.setMethodExceptionTypeName(
idx, exceptionIndex++,
OStringToOUString(
(*i)->getRelativName(), RTL_TEXTENCODING_UTF8));
elem->getRelativName(), RTL_TEXTENCODING_UTF8));
}
}
}
......
......@@ -195,21 +195,20 @@ bool AstInterface::dump(RegistryKey& rKey)
sal_uInt16 superTypeIndex = 0;
sal_uInt16 referenceIndex = 0;
for (InheritedInterfaces::iterator i = m_inheritedInterfaces.begin();
i != m_inheritedInterfaces.end(); ++i)
for (auto const& elem : m_inheritedInterfaces)
{
if (i->isOptional()) {
if (elem.isOptional()) {
aBlob.setReferenceData(
referenceIndex++, i->getDocumentation(), RTReferenceType::SUPPORTS,
referenceIndex++, elem.getDocumentation(), RTReferenceType::SUPPORTS,
RTFieldAccess::OPTIONAL,
OStringToOUString(
i->getInterface()->getRelativName(),
elem.getInterface()->getRelativName(),
RTL_TEXTENCODING_UTF8));
} else {
aBlob.setSuperTypeName(
superTypeIndex++,
OStringToOUString(
i->getInterface()->getRelativName(),
elem.getInterface()->getRelativName(),
RTL_TEXTENCODING_UTF8));
}
}
......@@ -294,13 +293,11 @@ void AstInterface::checkInheritedInterfaceClashes(
checkMemberClashes(
doubleDeclarations.members, *i, !mainOptional);
}
for (InheritedInterfaces::const_iterator i(
ifc->m_inheritedInterfaces.begin());
i != ifc->m_inheritedInterfaces.end(); ++i)
for (auto const& elem : ifc->m_inheritedInterfaces)
{
checkInheritedInterfaceClashes(
doubleDeclarations, seenInterfaces, i->getResolved(),
false, i->isOptional(), mainOptional);
doubleDeclarations, seenInterfaces, elem.getResolved(),
false, elem.isOptional(), mainOptional);
}
}
}
......@@ -322,13 +319,11 @@ void AstInterface::checkMemberClashes(
doubleMembers.push_back(d);
}
} else if (checkOptional) {
for (VisibleMember::Optionals::const_iterator j(
i->second.optionals.begin());
j != i->second.optionals.end(); ++j)
for (auto const& elem : i->second.optionals)
{
if (j->second->getScopedName() != member->getScopedName()) {
if (elem.second->getScopedName() != member->getScopedName()) {
DoubleMemberDeclaration d;
d.first = j->second;
d.first = elem.second;
d.second = member;
doubleMembers.push_back(d);
}
......@@ -357,11 +352,9 @@ void AstInterface::addVisibleInterface(
m_visibleMembers.emplace(
(*i)->getLocalName(), VisibleMember(*i));
}
for (InheritedInterfaces::const_iterator i(
ifc->m_inheritedInterfaces.begin());
i != ifc->m_inheritedInterfaces.end(); ++i)
for (auto const& elem : ifc->m_inheritedInterfaces)
{
addVisibleInterface(i->getResolved(), false, i->isOptional());
addVisibleInterface(elem.getResolved(), false, elem.isOptional());
}
}
}
......@@ -380,12 +373,10 @@ void AstInterface::addOptionalVisibleMembers(AstInterface const * ifc) {
visible->second.optionals.emplace(ifc->getScopedName(), *i);
}
}
for (InheritedInterfaces::const_iterator i(
ifc->m_inheritedInterfaces.begin());
i != ifc->m_inheritedInterfaces.end(); ++i)
for (auto const& elem : ifc->m_inheritedInterfaces)
{
if (!i->isOptional()) {
addOptionalVisibleMembers(i->getResolved());
if (!elem.isOptional()) {
addOptionalVisibleMembers(elem.getResolved());
}
}
}
......
......@@ -101,16 +101,13 @@ void AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
if ( nExcep )
{
DeclList::iterator iter = m_exceptions.begin();
DeclList::iterator end = m_exceptions.end();
sal_uInt16 exceptIndex = 0;
while ( iter != end )
for (auto const& exception : m_exceptions)
{
rBlob.setMethodExceptionTypeName(
index, exceptIndex++,
OStringToOUString(
(*iter)->getRelativName(), RTL_TEXTENCODING_UTF8));
++iter;
exception->getRelativName(), RTL_TEXTENCODING_UTF8));
}
}
}
......
......@@ -196,15 +196,10 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName)
AstDeclaration* AstScope::lookupByNameLocal(const OString& name) const
{
DeclList::const_iterator iter(m_declarations.begin());
DeclList::const_iterator end(m_declarations.end());
while ( iter != end )
for (auto const& declaration : m_declarations)
{
AstDeclaration* pDecl = *iter;
if ( pDecl->getLocalName() == name )
return pDecl;
++iter;
if ( declaration->getLocalName() == name )
return declaration;
}
return nullptr;
}
......@@ -223,20 +218,15 @@ AstDeclaration* AstScope::lookupInInherited(const OString& scopedName) const
}
// OK, loop through inherited interfaces. Stop when you find it
AstInterface::InheritedInterfaces::const_iterator iter(
pInterface->getAllInheritedInterfaces().begin());
AstInterface::InheritedInterfaces::const_iterator end(
pInterface->getAllInheritedInterfaces().end());
while ( iter != end )
for (auto const& elem : pInterface->getAllInheritedInterfaces())
{
AstInterface const * resolved = iter->getResolved();
AstInterface const * resolved = elem.getResolved();
AstDeclaration* pDecl = resolved->lookupByNameLocal(scopedName);
if ( pDecl )
return pDecl;
pDecl = resolved->lookupInInherited(scopedName);
if ( pDecl )
return pDecl;
++iter;
}
// Not found
return nullptr;
......
......@@ -30,11 +30,10 @@ AstStruct::AstStruct(
, AstScope(NT_struct)
, m_pBaseType(pBaseType)
{
for (std::vector< OString >::const_iterator i(typeParameters.begin());
i != typeParameters.end(); ++i)
for (auto const& elem : typeParameters)
{
m_typeParameters.push_back(
new AstType(NT_type_parameter, *i, nullptr));
new AstType(NT_type_parameter, elem, nullptr));
}
}
......@@ -50,21 +49,19 @@ AstStruct::AstStruct(const NodeType type,
AstStruct::~AstStruct()
{
for (DeclList::iterator i(m_typeParameters.begin());
i != m_typeParameters.end(); ++i)
for (auto const& elem : m_typeParameters)
{
delete *i;
delete elem;
}
}
AstDeclaration const * AstStruct::findTypeParameter(OString const & name)
const
{
for (DeclList::const_iterator i(m_typeParameters.begin());
i != m_typeParameters.end(); ++i)
for (auto const& elem : m_typeParameters)
{
if ((*i)->getLocalName() == name) {
return *i;
if (elem->getLocalName() == name) {
return elem;
}
}
return nullptr;
......@@ -148,13 +145,12 @@ bool AstStruct::dump(RegistryKey& rKey)
}
sal_uInt16 index = 0;
for (DeclList::iterator i(m_typeParameters.begin());
i != m_typeParameters.end(); ++i)
for (auto const& elem : m_typeParameters)
{
aBlob.setReferenceData(
index++, "", RTReferenceType::TYPE_PARAMETER, RTFieldAccess::INVALID,
OStringToOUString(
(*i)->getLocalName(), RTL_TEXTENCODING_UTF8));
elem->getLocalName(), RTL_TEXTENCODING_UTF8));
}
sal_uInt32 aBlobSize;
......
......@@ -317,12 +317,10 @@ sal_Int32 compileFile(const OString * pathname)
rtl_uString** pCmdArgs = nullptr;
pCmdArgs = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nCmdArgs * sizeof(rtl_uString*)));
::std::vector< OUString >::iterator iter = lCppArgs.begin();
::std::vector< OUString >::iterator end = lCppArgs.end();
int i = 0;
while ( iter != end ) {
pCmdArgs[i++] = (*iter).pData;
++iter;
for (auto const& elem : lCppArgs)
{
pCmdArgs[i++] = elem.pData;
}
procError = osl_executeProcess( cpp.pData, pCmdArgs, nCmdArgs, osl_Process_WAIT,
......
......@@ -79,13 +79,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
options.getProgramName().getStr(), static_cast<int>(files.size()) );
fflush( stdout );
}
for (std::vector< OString >::const_iterator i(files.begin());
i != files.end() && nErrors == 0; ++i)
for (auto const& elem : files)
{
OString sysFileName( convertToAbsoluteSystemPath(*i) );
if (nErrors)
break;
OString sysFileName( convertToAbsoluteSystemPath(elem) );
if ( !options.quiet() )
fprintf(stdout, "Compiling: %s\n", (*i).getStr());
fprintf(stdout, "Compiling: %s\n", elem.getStr());
nErrors = compileFile(&sysFileName);
if ( idlc()->getWarningCount() && !options.quiet() )
......@@ -93,7 +94,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
options.getProgramName().getStr(),
sal::static_int_cast< unsigned long >(
idlc()->getWarningCount()),
(*i).getStr());
elem.getStr());
// prepare output file name
OString const strippedFileName(
......
......@@ -95,21 +95,18 @@ static bool cleanPath()
{
if ( pCreatedDirectories )
{
std::list< OString >::iterator iter = pCreatedDirectories->begin();
std::list< OString >::iterator end = pCreatedDirectories->end();
while ( iter != end )
for (auto const& createdDirectory : *pCreatedDirectories)
{
//#ifdef SAL_UNX
// if (rmdir((char*)(*iter).getStr(), 0777) == -1)
// if (rmdir((char*)createdDirectory.getStr(), 0777) == -1)
//#else
if (rmdir((*iter).getStr()) == -1)
if (rmdir(createdDirectory.getStr()) == -1)
//#endif
{
fprintf(stderr, "%s: cannot remove directory '%s'\n",
idlc()->getOptions()->getProgramName().getStr(), (*iter).getStr());
idlc()->getOptions()->getProgramName().getStr(), createdDirectory.getStr());
return false;
}
++iter;
}
delete pCreatedDirectories;
}
......
......@@ -96,11 +96,9 @@ void checkIdentifier(::rtl::OString const * id)
void reportDoubleMemberDeclarations(
AstInterface::DoubleMemberDeclarations const & doubleMembers)
{
for (AstInterface::DoubleMemberDeclarations::const_iterator i(
doubleMembers.begin());
i != doubleMembers.end(); ++i)
for (auto const& doubleMember : doubleMembers)
{
ErrorHandler::error2(ErrorCode::DoubleMember, i->first, i->second);
ErrorHandler::error2(ErrorCode::DoubleMember, doubleMember.first, doubleMember.second);
}
}
......@@ -127,12 +125,10 @@ void addInheritedInterface(
static_cast< AstType * >(decl), optional,
documentation);
} else {
for (AstInterface::DoubleInterfaceDeclarations::iterator i(
doubleDecls.interfaces.begin());
i != doubleDecls.interfaces.end(); ++i)
for (auto const& elem : doubleDecls.interfaces)
{
ErrorHandler::error1(
ErrorCode::DoubleInheritance, *i);
ErrorCode::DoubleInheritance, elem);
}
reportDoubleMemberDeclarations(doubleDecls.members);
}
......@@ -1618,12 +1614,9 @@ service_export :
*/
if ( pScope && $2 )
{
std::list< OString >::iterator iter = $2->begin();
std::list< OString >::iterator end = $2->end();
while ( iter != end )
for (auto const& elem : *($2))
{
pDecl = pScope->lookupByName(*iter);
pDecl = pScope->lookupByName(elem);
if ( pDecl && (pDecl->getNodeType() == NT_interface) )
{
/* we relax the strict published check and allow to add new
......@@ -1633,14 +1626,13 @@ service_export :
if ( ErrorHandler::checkPublished(pDecl, bOptional) )
{
pIMember = new AstInterfaceMember(
$1, static_cast<AstInterface*>(pDecl), *iter, pScope);
$1, static_cast<AstInterface*>(pDecl), elem, pScope);
pScope->addDeclaration(pIMember);
}
} else
{
ErrorHandler::lookupError(ErrorCode::InterfaceMemberLookup, *iter, scopeAsDecl(pScope));
ErrorHandler::lookupError(ErrorCode::InterfaceMemberLookup, elem, scopeAsDecl(pScope));
}
++iter;
}
}
}
......@@ -1662,12 +1654,9 @@ service_export :
*/
if ( pScope && $2 )
{
std::list< OString >::iterator iter = $2->begin();
std::list< OString >::iterator end = $2->end();
while ( iter != end )
for (auto const& elem : *($2))
{
pDecl = pScope->lookupByName(*iter);
pDecl = pScope->lookupByName(elem);
if ( pDecl && (pDecl->getNodeType() == NT_service) )
{
if ( static_cast< AstService * >(pDecl)->isSingleInterfaceBasedService() || (pScope->getScopeNodeType() == NT_singleton && pScope->nMembers() > 0) )
......@@ -1675,14 +1664,13 @@ service_export :
else if ( ErrorHandler::checkPublished(pDecl) )
{
pSMember = new AstServiceMember(
$1, static_cast<AstService*>(pDecl), *iter, pScope);
$1, static_cast<AstService*>(pDecl), elem, pScope);
pScope->addDeclaration(pSMember);
}
} else
{
ErrorHandler::lookupError(ErrorCode::ServiceMemberLookup, *iter, scopeAsDecl(pScope));
ErrorHandler::lookupError(ErrorCode::ServiceMemberLookup, elem, scopeAsDecl(pScope));
}
++iter;
}
}
delete $2;
......@@ -1708,21 +1696,17 @@ service_export :
*/
if ( pScope && $2 )
{
std::list< OString >::iterator iter = $2->begin();
std::list< OString >::iterator end = $2->end();
while ( iter != end )
for (auto const& elem : *($2))
{
pDecl = pScope->lookupByName(*iter);
pDecl = pScope->lookupByName(elem);
if ( pDecl && (pDecl->getNodeType() == NT_interface) )
{
pObserves = new AstObserves(static_cast<AstInterface*>(pDecl), *iter, pScope);
pObserves = new AstObserves(static_cast<AstInterface*>(pDecl), elem, pScope);
pScope->addDeclaration(pObserves);
} else
{
ErrorHandler::lookupError(ErrorCode::InterfaceMemberLookup, *iter, scopeAsDecl(pScope));
ErrorHandler::lookupError(ErrorCode::InterfaceMemberLookup, elem, scopeAsDecl(pScope));
}
++iter;
}
}
}
......@@ -1749,21 +1733,17 @@ service_export :
*/
if ( pScope && $2 )
{
std::list< OString >::iterator iter = $2->begin();
std::list< OString >::iterator end = $2->end();
while ( iter != end )
for (auto const& elem : *($2))
{
pDecl = pScope->lookupByName(*iter);
pDecl = pScope->lookupByName(elem);
if ( pDecl && (pDecl->getNodeType() == NT_service) )
{
pNeeds = new AstNeeds(static_cast<AstService*>(pDecl), *iter, pScope);
pNeeds = new AstNeeds(static_cast<AstService*>(pDecl), elem, pScope);
pScope->addDeclaration(pNeeds);
} else
{
ErrorHandler::lookupError(ErrorCode::ServiceMemberLookup, *iter, scopeAsDecl(pScope));
ErrorHandler::lookupError(ErrorCode::ServiceMemberLookup, elem, scopeAsDecl(pScope));
}
++iter;
}
}
}
......
......@@ -318,17 +318,19 @@ void OMarkableOutputStream::checkMarksAndFlush()
// find the smallest mark
sal_Int32 nNextFound = m_nCurrentPos;
for( ii = m_mapMarks.begin() ; ii != m_mapMarks.end() ; ++ii ) {
if( (*ii).second <= nNextFound ) {
nNextFound = (*ii).second;
for (auto const& mark : m_mapMarks)
{
if( mark.second <= nNextFound ) {
nNextFound = mark.second;
}
}
if( nNextFound ) {
// some data must be released !
m_nCurrentPos -= nNextFound;
for( ii = m_mapMarks.begin() ; ii != m_mapMarks.end() ; ++ii ) {
(*ii).second -= nNextFound;
for (auto & mark : m_mapMarks)
{
mark.second -= nNextFound;
}
Sequence<sal_Int8> seq(nNextFound);
......@@ -733,17 +735,19 @@ void OMarkableInputStream::checkMarksAndFlush()
// find the smallest mark
sal_Int32 nNextFound = m_nCurrentPos;
for( ii = m_mapMarks.begin() ; ii != m_mapMarks.end() ; ++ii ) {
if( (*ii).second <= nNextFound ) {
nNextFound = (*ii).second;
for (auto const& mark : m_mapMarks)
{
if( mark.second <= nNextFound ) {
nNextFound = mark.second;
}
}
if( nNextFound ) {
// some data must be released !
m_nCurrentPos -= nNextFound;
for( ii = m_mapMarks.begin() ; ii != m_mapMarks.end() ; ++ii ) {
(*ii).second -= nNextFound;
for (auto & mark : m_mapMarks)
{
mark.second -= nNextFound;
}
m_pBuffer->forgetFromStart( nNextFound );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment