summaryrefslogtreecommitdiffstats
path: root/codemaker/source/javamaker
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-01-26 16:31:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-01-26 16:36:09 +0100
commitf1bca26afcc7593d0124c216c0400a9e2e47fc1d (patch)
tree37557f9a9afd815c4389ce7c4b3c47380829ef51 /codemaker/source/javamaker
parentadd mnemonic widgets to column page (diff)
downloadcore-f1bca26afcc7593d0124c216c0400a9e2e47fc1d.tar.gz
core-f1bca26afcc7593d0124c216c0400a9e2e47fc1d.zip
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/source/javamaker')
-rw-r--r--codemaker/source/javamaker/classfile.cxx36
-rw-r--r--codemaker/source/javamaker/javatype.cxx48
2 files changed, 42 insertions, 42 deletions
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());
}