diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-01-26 16:31:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-01-26 16:36:09 +0100 |
commit | f1bca26afcc7593d0124c216c0400a9e2e47fc1d (patch) | |
tree | 37557f9a9afd815c4389ce7c4b3c47380829ef51 /codemaker | |
parent | 8e681942f771d7beae52b1e786fab16e6a653ab1 (diff) |
Remove redundant braces around for loops
...that had once been workarounds for compilers that did not yet support the
C++98 scoping rules for declarations in for-init-statements.
Change-Id: I51dc42982b30bf3adea6de1a10a91c0b4b4acfbe
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/source/codemaker/dependencies.cxx | 10 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 32 | ||||
-rw-r--r-- | codemaker/source/cppumaker/includes.cxx | 6 | ||||
-rw-r--r-- | codemaker/source/javamaker/classfile.cxx | 36 | ||||
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 48 |
5 files changed, 66 insertions, 66 deletions
diff --git a/codemaker/source/codemaker/dependencies.cxx b/codemaker/source/codemaker/dependencies.cxx index 9d2e7699544e..f3baf1ce10b9 100644 --- a/codemaker/source/codemaker/dependencies.cxx +++ b/codemaker/source/codemaker/dependencies.cxx @@ -65,13 +65,13 @@ Dependencies::Dependencies( } } if (tc != RT_TYPE_ENUM) { - {for (sal_Int16 i = 0; i < reader.getFieldCount(); ++i) { + for (sal_Int16 i = 0; i < reader.getFieldCount(); ++i) { if ((reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) == 0) { insert(reader.getFieldTypeName(i), false); } - }} + } } for (sal_Int16 i = 0; i < reader.getMethodCount(); ++i) { insert(reader.getMethodReturnTypeName(i), false); @@ -249,11 +249,11 @@ void Dependencies::insert(rtl::OString const & type, bool base) { case UnoType::SORT_COMPLEX: { - {for (std::vector< rtl::OString >::iterator i(args.begin()); - i != args.end(); ++i) + for (std::vector< rtl::OString >::iterator i(args.begin()); + i != args.end(); ++i) { insert(*i, false); - }} + } Map::iterator i(m_map.find(t)); if (i == m_map.end()) { m_map.insert( diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 09de49c97a06..2c4d80884d7b 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -1015,12 +1015,12 @@ void CppuType::dumpType(FileStream& o, const OString& type, if (bConst) o << "const "; - {for (sal_Int32 i = 0; i < seqNum; ++i) { + for (sal_Int32 i = 0; i < seqNum; ++i) { if (cppuUnoType) o << "::cppu::UnoSequenceType< "; else o << "::com::sun::star::uno::Sequence< "; - }} + } switch (typeClass) { @@ -1067,9 +1067,9 @@ void CppuType::dumpType(FileStream& o, const OString& type, break; } - {for (sal_Int32 i = 0; i < seqNum; ++i) { + for (sal_Int32 i = 0; i < seqNum; ++i) { o << " >"; - }} + } if (bRef) o << "&"; } @@ -1850,21 +1850,21 @@ void InterfaceType::dumpCppuMethodRefs(FileStream& o, sal_uInt32& index) sal_uInt32 InterfaceType::getMemberCount() { sal_uInt16 count = 0; sal_uInt16 methodCount = m_reader.getMethodCount(); - {for (sal_uInt16 i = 0; i < methodCount; ++i) { + for (sal_uInt16 i = 0; i < methodCount; ++i) { RTMethodMode flags = m_reader.getMethodFlags(i); if (flags != RT_MODE_ATTRIBUTE_GET && flags != RT_MODE_ATTRIBUTE_SET) { m_hasMethods = true; ++count; } - }} + } sal_uInt16 fieldCount = m_reader.getFieldCount(); - {for (sal_uInt16 i = 0; i < fieldCount; ++i) { + for (sal_uInt16 i = 0; i < fieldCount; ++i) { RTFieldAccess flags = m_reader.getFieldFlags(i); if (flags != RT_ACCESS_CONST && flags != RT_ACCESS_INVALID) { m_hasAttributes = true; ++count; } - }} + } return count; } @@ -1912,20 +1912,20 @@ void BaseOffset::calculate(typereg::Reader const & reader) { .second) { calculateBases(reader); - {for (sal_uInt16 i = 0; i < reader.getMethodCount(); ++i) { + for (sal_uInt16 i = 0; i < reader.getMethodCount(); ++i) { RTMethodMode flags = reader.getMethodFlags(i); if (flags != RT_MODE_ATTRIBUTE_GET && flags != RT_MODE_ATTRIBUTE_SET) { ++offset; } - }} - {for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { + } + for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { RTFieldAccess flags = reader.getFieldFlags(i); if (flags != RT_ACCESS_CONST && flags != RT_ACCESS_INVALID) { ++offset; } - }} + } } } @@ -2975,7 +2975,7 @@ void StructureType::dumpComprehensiveGetCppuType(FileStream & out) typedef std::map< rtl::OString, sal_uInt32 > Map; Map parameters; Map types; - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { rtl::OString type( rtl::OUStringToOString( m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8)); @@ -3027,10 +3027,10 @@ void StructureType::dumpComprehensiveGetCppuType(FileStream & out) m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8).replace( '/', '.') << "\" );\n"; - }} + } out << indent() << "::typelib_StructMember_Init the_members[] = {\n"; inc(); - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { out << indent() << "{ { "; rtl::OString type( rtl::OUStringToOString( @@ -3046,7 +3046,7 @@ void StructureType::dumpComprehensiveGetCppuType(FileStream & out) << ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) == 0 ? "false" : "true") << " }" << (i == fields - 1 ? " };" : ",") << "\n"; - }} + } dec(); out << indent() << "::typelib_TypeDescription * the_newType = 0;\n"; out << indent() diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index 9411312eca93..9ee0eb54fd3b 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -118,11 +118,11 @@ void Includes::add(rtl::OString const & registryType) { m_map.insert( codemaker::Dependencies::Map::value_type( type, codemaker::Dependencies::KIND_NO_BASE)); - {for (std::vector< rtl::OString >::iterator i(args.begin()); - i != args.end(); ++i) + for (std::vector< rtl::OString >::iterator i(args.begin()); + i != args.end(); ++i) { add(*i); - }} + } break; default: diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index bc0cf2c908a0..1a61e2fe2092 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -245,29 +245,29 @@ void ClassFile::Code::instrLookupswitch( Position pos1 = m_code.size(); appendU1(m_code, 0xAB); int pad = (pos1 + 1) % 4; - {for (int i = 0; i < pad; ++i) { + for (int i = 0; i < pad; ++i) { appendU1(m_code, 0); - }} + } Position pos2 = pos1 + 1 + pad + 8 + blocks.size() * 8; //FIXME: overflow appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1)); //FIXME: overflow pos2 += defaultBlock->m_code.size(); //FIXME: overflow appendU4(m_code, static_cast< sal_uInt32 >(size)); - {for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i( - blocks.begin()); - i != blocks.end(); ++i) + for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i( + blocks.begin()); + i != blocks.end(); ++i) { appendU4(m_code, static_cast< sal_uInt32 >(i->first)); appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1)); //FIXME: overflow pos2 += i->second->m_code.size(); //FIXME: overflow - }} + } appendStream(m_code, defaultBlock->m_code); - {for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i( - blocks.begin()); - i != blocks.end(); ++i) + for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i( + blocks.begin()); + i != blocks.end(); ++i) { appendStream(m_code, i->second->m_code); - }} + } } void ClassFile::Code::instrNew(rtl::OString const & type) { @@ -330,9 +330,9 @@ void ClassFile::Code::instrTableswitch( Position pos1 = m_code.size(); appendU1(m_code, 0xAA); int pad = (pos1 + 1) % 4; - {for (int i = 0; i < pad; ++i) { + for (int i = 0; i < pad; ++i) { appendU1(m_code, 0); - }} + } std::list< Code * >::size_type size = blocks.size(); Position pos2 = pos1 + 1 + pad + 12 + size * 4; //FIXME: overflow sal_uInt32 defaultOffset = static_cast< sal_uInt32 >(pos2 - pos1); @@ -341,8 +341,8 @@ void ClassFile::Code::instrTableswitch( pos2 += defaultBlock->m_code.size(); //FIXME: overflow appendU4(m_code, static_cast< sal_uInt32 >(low)); appendU4(m_code, static_cast< sal_uInt32 >(low + (size - 1))); - {for (std::list< Code * >::const_iterator i(blocks.begin()); - i != blocks.end(); ++i) + for (std::list< Code * >::const_iterator i(blocks.begin()); + i != blocks.end(); ++i) { if (*i == 0) { appendU4(m_code, defaultOffset); @@ -351,15 +351,15 @@ void ClassFile::Code::instrTableswitch( //FIXME: overflow pos2 += (*i)->m_code.size(); //FIXME: overflow } - }} + } appendStream(m_code, defaultBlock->m_code); - {for (std::list< Code * >::const_iterator i(blocks.begin()); - i != blocks.end(); ++i) + for (std::list< Code * >::const_iterator i(blocks.begin()); + i != blocks.end(); ++i) { if (*i != 0) { appendStream(m_code, (*i)->m_code); } - }} + } } void ClassFile::Code::loadIntegerConstant(sal_Int32 value) { diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index 5b8748e4bf5f..404626a0316f 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -856,7 +856,7 @@ void handleEnumType( rtl::OString())); SAL_WNODEPRECATED_DECLARATIONS_POP rtl::OString classDescriptor("L" + className + ";"); - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { RTConstValue fieldValue(reader.getFieldValue(i)); if (fieldValue.m_type != RT_TYPE_INT32 || reader.getFieldFlags(i) != RT_ACCESS_CONST @@ -880,7 +880,7 @@ void handleEnumType( fieldName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("_value")), rtl::OString(RTL_CONSTASCII_STRINGPARAM("I")), cf->addIntegerInfo(fieldValue.m_value.aLong), rtl::OString()); - }} + } SAL_WNODEPRECATED_DECLARATIONS_PUSH std::auto_ptr< ClassFile::Code > code(cf->newCode()); SAL_WNODEPRECATED_DECLARATIONS_POP @@ -914,14 +914,14 @@ void handleEnumType( std::map< sal_Int32, rtl::OString > map; sal_Int32 min = SAL_MAX_INT32; sal_Int32 max = SAL_MIN_INT32; - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { sal_Int32 value = reader.getFieldValue(i).m_value.aLong; min = std::min(min, value); max = std::max(max, value); map.insert( std::map< sal_Int32, rtl::OString >::value_type( value, codemaker::convertString(reader.getFieldName(i)))); - }} + } sal_uInt64 size = static_cast< sal_uInt64 >(map.size()); if ((static_cast< sal_uInt64 >(max) - static_cast< sal_uInt64 >(min) <= 2 * size) @@ -954,11 +954,11 @@ void handleEnumType( blockCode.release(); } code->instrTableswitch(defCode.get(), min, blocks); - {for (std::list< ClassFile::Code * >::iterator i(blocks.begin()); + for (std::list< ClassFile::Code * >::iterator i(blocks.begin()); i != blocks.end(); ++i) { delete *i; - }} + } } else{ SAL_WNODEPRECATED_DECLARATIONS_PUSH std::auto_ptr< ClassFile::Code > defCode(cf->newCode()); @@ -979,12 +979,12 @@ void handleEnumType( blockCode.release(); } code->instrLookupswitch(defCode.get(), blocks); - {for (std::list< std::pair< sal_Int32, ClassFile::Code * > >::iterator - i(blocks.begin()); - i != blocks.end(); ++i) + for (std::list< std::pair< sal_Int32, ClassFile::Code * > >::iterator + i(blocks.begin()); + i != blocks.end(); ++i) { delete i->second; - }} + } } code->setMaxStackAndLocals(1, 1); cf->addMethod( @@ -994,7 +994,7 @@ void handleEnumType( rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)")) + classDescriptor, code.get(), std::vector< rtl::OString >(), rtl::OString()); code.reset(cf->newCode()); - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { code->instrNew(className); code->instrDup(); code->loadIntegerConstant(reader.getFieldValue(i).m_value.aLong); @@ -1005,7 +1005,7 @@ void handleEnumType( className, codemaker::convertString(reader.getFieldName(i)), classDescriptor); - }} + } code->instrReturn(); code->setMaxStackAndLocals(3, 0); cf->addMethod( @@ -1924,7 +1924,7 @@ void handleAggregatingType( className, superClass, sig)); SAL_WNODEPRECATED_DECLARATIONS_POP std::vector< TypeInfo > typeInfo; - {for (sal_uInt16 i = firstField; i < fields; ++i) { + for (sal_uInt16 i = firstField; i < fields; ++i) { RTFieldAccess flags = reader.getFieldFlags(i); if ((flags != RT_ACCESS_READWRITE && flags != (RT_ACCESS_READWRITE | RT_ACCESS_PARAMETERIZED_TYPE)) @@ -1954,7 +1954,7 @@ void handleAggregatingType( addField( manager, dependencies, cf.get(), &typeInfo, typeParameterIndex, type, codemaker::convertString(reader.getFieldName(i)), i - firstField); - }} + } if (runtimeException) { addField( manager, dependencies, cf.get(), &typeInfo, -1, @@ -1970,7 +1970,7 @@ void handleAggregatingType( superClass, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")), rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V"))); sal_uInt16 stack = 0; - {for (sal_uInt16 i = firstField; i < fields; ++i) { + for (sal_uInt16 i = firstField; i < fields; ++i) { stack = std::max( stack, addFieldInit( @@ -1979,7 +1979,7 @@ void handleAggregatingType( (reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0, codemaker::convertString(reader.getFieldTypeName(i)), dependencies, code.get())); - }} + } if (runtimeException) { stack = std::max( stack, @@ -2055,7 +2055,7 @@ void handleAggregatingType( superClass, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")), desc.getDescriptor()); sal_uInt16 maxSize = index; - {for (sal_uInt16 i = firstField; i < fields; ++i) { + for (sal_uInt16 i = firstField; i < fields; ++i) { maxSize = std::max( maxSize, addDirectArgument( @@ -2063,7 +2063,7 @@ void handleAggregatingType( codemaker::convertString(reader.getFieldName(i)), (reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0, codemaker::convertString(reader.getFieldTypeName(i)))); - }} + } if (runtimeException) { maxSize = std::max( maxSize, @@ -2139,11 +2139,11 @@ void handleInterfaceType( rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")), rtl::OString())); SAL_WNODEPRECATED_DECLARATIONS_POP - {for (sal_uInt16 i = 0; i < superTypes; ++i) { + for (sal_uInt16 i = 0; i < superTypes; ++i) { rtl::OString t(codemaker::convertString(reader.getSuperTypeName(i))); dependencies->insert(t); cf->addInterface(t); - }} + } // As a special case, let com.sun.star.lang.XEventListener extend // java.util.EventListener ("A tagging interface that all event listener // interfaces must extend"): @@ -2157,7 +2157,7 @@ void handleInterfaceType( } std::vector< TypeInfo > typeInfo; sal_Int32 index = 0; - {for (sal_uInt16 i = 0; i < fields; ++i) { + for (sal_uInt16 i = 0; i < fields; ++i) { RTFieldAccess flags = reader.getFieldFlags(i); //TODO: ok if both READONLY and BOUND? if (((((flags & RT_ACCESS_READWRITE) != 0) @@ -2244,8 +2244,8 @@ void handleInterfaceType( ? 0 : TypeInfo::FLAG_BOUND)), index, polymorphicUnoType)); index += ((flags & RT_ACCESS_READONLY) == 0 ? 2 : 1); - }} - {for (sal_uInt16 i = 0; i < methods; ++i) { + } + for (sal_uInt16 i = 0; i < methods; ++i) { RTMethodMode flags = reader.getMethodFlags(i); switch (flags) { case RT_MODE_ONEWAY: @@ -2344,7 +2344,7 @@ void handleInterfaceType( rtl::OString( RTL_CONSTASCII_STRINGPARAM("Bad type information"))); //TODO } - }} + } addTypeInfo(className, typeInfo, dependencies, cf.get()); writeClassFile(options, className, *cf.get()); } |