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(
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> <defaultbyte1> <defaultbyte2> <defaultbyte3>
// <defaultbyte4> <npairs1> <npairs2> <npairs3> <npairs4>
// <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) {
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> <defaultbyte1> <defaultbyte2> <defaultbyte3>
// <defaultbyte4> <lowbyte1> <lowbyte2> <lowbyte3> <lowbyte4> <highbyte1>
......@@ -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
......
......@@ -23,7 +23,6 @@
#include <codemaker/unotype.hxx>
#include <sal/types.h>
#include <list>
#include <map>
#include <utility>
#include <vector>
......@@ -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);
......
......@@ -22,7 +22,6 @@
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <list>
#include <map>
#include <memory>
#include <set>
......@@ -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 )
{
......
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