Kaydet (Commit) 10593aca authored tarafından Julien Nabet's avatar Julien Nabet

Replace most lists by vectors in codemaker

Change-Id: Id867b497514d2d795504ae5c9e7d0ad356524ad5
Reviewed-on: https://gerrit.libreoffice.org/45274Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 2618e4a1
...@@ -227,12 +227,12 @@ void ClassFile::Code::instrInvokevirtual( ...@@ -227,12 +227,12 @@ void ClassFile::Code::instrInvokevirtual(
void ClassFile::Code::instrLookupswitch( void ClassFile::Code::instrLookupswitch(
Code const * defaultBlock, Code const * defaultBlock,
std::list< std::pair< sal_Int32, Code * > > const & blocks) std::vector< std::pair< sal_Int32, Code * > > const & blocks)
{ {
// lookupswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3> // lookupswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3>
// <defaultbyte4> <npairs1> <npairs2> <npairs3> <npairs4> // <defaultbyte4> <npairs1> <npairs2> <npairs3> <npairs4>
// <match--offset pairs...>: // <match--offset pairs...>:
std::list< std::pair< sal_Int32, Code * > >::size_type size = blocks.size(); std::vector< std::pair< sal_Int32, Code * > >::size_type size = blocks.size();
if (size > SAL_MAX_INT32) { if (size > SAL_MAX_INT32) {
throw CannotDumpException("Lookup-switch too large for Java class file format"); throw CannotDumpException("Lookup-switch too large for Java class file format");
} }
...@@ -312,7 +312,7 @@ void ClassFile::Code::instrSwap() { ...@@ -312,7 +312,7 @@ void ClassFile::Code::instrSwap() {
void ClassFile::Code::instrTableswitch( void ClassFile::Code::instrTableswitch(
Code const * defaultBlock, sal_Int32 low, Code const * defaultBlock, sal_Int32 low,
std::list< Code * > const & blocks) std::vector< Code * > const & blocks)
{ {
// tableswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3> // tableswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3>
// <defaultbyte4> <lowbyte1> <lowbyte2> <lowbyte3> <lowbyte4> <highbyte1> // <defaultbyte4> <lowbyte1> <lowbyte2> <lowbyte3> <lowbyte4> <highbyte1>
...@@ -323,7 +323,7 @@ void ClassFile::Code::instrTableswitch( ...@@ -323,7 +323,7 @@ void ClassFile::Code::instrTableswitch(
for (int i = 0; i < pad; ++i) { for (int i = 0; i < pad; ++i) {
appendU1(m_code, 0); appendU1(m_code, 0);
} }
std::list< Code * >::size_type size = blocks.size(); std::vector< Code * >::size_type size = blocks.size();
Position pos2 = pos1 + 1 + pad + 12 + size * 4; //FIXME: overflow Position pos2 = pos1 + 1 + pad + 12 + size * 4; //FIXME: overflow
sal_uInt32 defaultOffset = static_cast< sal_uInt32 >(pos2 - pos1); sal_uInt32 defaultOffset = static_cast< sal_uInt32 >(pos2 - pos1);
//FIXME: overflow //FIXME: overflow
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <codemaker/unotype.hxx> #include <codemaker/unotype.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <list>
#include <map> #include <map>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -89,7 +88,7 @@ public: ...@@ -89,7 +88,7 @@ public:
void instrLookupswitch( void instrLookupswitch(
Code const * defaultBlock, Code const * defaultBlock,
std::list< std::pair< sal_Int32, Code * > > const & blocks); std::vector< std::pair< sal_Int32, Code * > > const & blocks);
void instrNew(rtl::OString const & type); void instrNew(rtl::OString const & type);
void instrNewarray(codemaker::UnoType::Sort sort); void instrNewarray(codemaker::UnoType::Sort sort);
...@@ -108,7 +107,7 @@ public: ...@@ -108,7 +107,7 @@ public:
void instrTableswitch( void instrTableswitch(
Code const * defaultBlock, sal_Int32 low, Code const * defaultBlock, sal_Int32 low,
std::list< Code * > const & blocks); std::vector< Code * > const & blocks);
void loadIntegerConstant(sal_Int32 value); void loadIntegerConstant(sal_Int32 value);
void loadStringConstant(rtl::OString const & value); void loadStringConstant(rtl::OString const & value);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cstdlib> #include <cstdlib>
#include <list>
#include <map> #include <map>
#include <memory> #include <memory>
#include <set> #include <set>
...@@ -752,7 +751,7 @@ void handleEnumType( ...@@ -752,7 +751,7 @@ void handleEnumType(
std::unique_ptr< ClassFile::Code > defCode(cf->newCode()); std::unique_ptr< ClassFile::Code > defCode(cf->newCode());
defCode->instrAconstNull(); defCode->instrAconstNull();
defCode->instrAreturn(); defCode->instrAreturn();
std::list< ClassFile::Code * > blocks; std::vector< ClassFile::Code * > blocks;
//FIXME: pointers contained in blocks may leak //FIXME: pointers contained in blocks may leak
sal_Int32 last = SAL_MAX_INT32; sal_Int32 last = SAL_MAX_INT32;
for (const auto& pair : map) for (const auto& pair : map)
...@@ -779,7 +778,7 @@ void handleEnumType( ...@@ -779,7 +778,7 @@ void handleEnumType(
std::unique_ptr< ClassFile::Code > defCode(cf->newCode()); std::unique_ptr< ClassFile::Code > defCode(cf->newCode());
defCode->instrAconstNull(); defCode->instrAconstNull();
defCode->instrAreturn(); defCode->instrAreturn();
std::list< std::pair< sal_Int32, ClassFile::Code * > > blocks; std::vector< std::pair< sal_Int32, ClassFile::Code * > > blocks;
//FIXME: pointers contained in blocks may leak //FIXME: pointers contained in blocks may leak
for (const auto& pair : map ) for (const auto& pair : map )
{ {
......
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