From 10593acac0bc42878fea34fe7da3f389f256c317 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 25 Nov 2017 18:33:25 +0100 Subject: Replace most lists by vectors in codemaker Change-Id: Id867b497514d2d795504ae5c9e7d0ad356524ad5 Reviewed-on: https://gerrit.libreoffice.org/45274 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Julien Nabet --- codemaker/source/javamaker/classfile.cxx | 8 ++++---- codemaker/source/javamaker/classfile.hxx | 5 ++--- codemaker/source/javamaker/javatype.cxx | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'codemaker') diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index 37858991edec..1df31aea6947 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -227,12 +227,12 @@ void ClassFile::Code::instrInvokevirtual( void ClassFile::Code::instrLookupswitch( 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> // // : - 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) { throw CannotDumpException("Lookup-switch too large for Java class file format"); } @@ -312,7 +312,7 @@ void ClassFile::Code::instrSwap() { void ClassFile::Code::instrTableswitch( Code const * defaultBlock, sal_Int32 low, - std::list< Code * > const & blocks) + std::vector< Code * > const & blocks) { // tableswitch <0--3 byte pad> // @@ -323,7 +323,7 @@ void ClassFile::Code::instrTableswitch( for (int i = 0; i < pad; ++i) { 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 sal_uInt32 defaultOffset = static_cast< sal_uInt32 >(pos2 - pos1); //FIXME: overflow diff --git a/codemaker/source/javamaker/classfile.hxx b/codemaker/source/javamaker/classfile.hxx index 6e5466d5b701..be6e3a36abe4 100644 --- a/codemaker/source/javamaker/classfile.hxx +++ b/codemaker/source/javamaker/classfile.hxx @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -89,7 +88,7 @@ public: void instrLookupswitch( 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 instrNewarray(codemaker::UnoType::Sort sort); @@ -108,7 +107,7 @@ public: void instrTableswitch( Code const * defaultBlock, sal_Int32 low, - std::list< Code * > const & blocks); + std::vector< Code * > const & blocks); void loadIntegerConstant(sal_Int32 value); void loadStringConstant(rtl::OString const & value); diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index dae125e7a3bb..71f4faa16117 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -752,7 +751,7 @@ void handleEnumType( std::unique_ptr< ClassFile::Code > defCode(cf->newCode()); defCode->instrAconstNull(); defCode->instrAreturn(); - std::list< ClassFile::Code * > blocks; + std::vector< ClassFile::Code * > blocks; //FIXME: pointers contained in blocks may leak sal_Int32 last = SAL_MAX_INT32; for (const auto& pair : map) @@ -779,7 +778,7 @@ void handleEnumType( std::unique_ptr< ClassFile::Code > defCode(cf->newCode()); defCode->instrAconstNull(); 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 for (const auto& pair : map ) { -- cgit