ofz: epic slow use of std::list
Change-Id: I790a3098272101fd33f83f21bdcef1bb061efd76 Reviewed-on: https://gerrit.libreoffice.org/34635 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
BIN
hwpfilter/qa/cppunit/data/fail/cslist-1.hwp
Normal file
BIN
hwpfilter/qa/cppunit/data/fail/cslist-1.hwp
Normal file
Binary file not shown.
@@ -70,7 +70,7 @@ HWPFile::~HWPFile()
|
|||||||
for (; it != plist.end(); ++it)
|
for (; it != plist.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
|
|
||||||
std::list < Table* >::iterator tbl = tables.begin();
|
std::vector< Table* >::iterator tbl = tables.begin();
|
||||||
for (; tbl != tables.end(); ++tbl)
|
for (; tbl != tables.end(); ++tbl)
|
||||||
delete *tbl;
|
delete *tbl;
|
||||||
|
|
||||||
@@ -457,92 +457,53 @@ void HWPFile::AddBox(FBox * box)
|
|||||||
blist.push_back(box);
|
blist.push_back(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParaShape *HWPFile::getParaShape(int index)
|
ParaShape *HWPFile::getParaShape(int index)
|
||||||
{
|
{
|
||||||
std::list<ParaShape*>::iterator it = pslist.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= pslist.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != pslist.end(); ++it, i++ ){
|
return pslist[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != pslist.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CharShape *HWPFile::getCharShape(int index)
|
CharShape *HWPFile::getCharShape(int index)
|
||||||
{
|
{
|
||||||
std::list<CharShape*>::iterator it = cslist.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= cslist.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != cslist.end(); ++it, i++ ){
|
return cslist[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != cslist.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FBoxStyle *HWPFile::getFBoxStyle(int index)
|
FBoxStyle *HWPFile::getFBoxStyle(int index)
|
||||||
{
|
{
|
||||||
std::list<FBoxStyle*>::iterator it = fbslist.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= fbslist.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != fbslist.end(); ++it, i++ ){
|
return fbslist[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != fbslist.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DateCode *HWPFile::getDateCode(int index)
|
DateCode *HWPFile::getDateCode(int index)
|
||||||
{
|
{
|
||||||
std::list<DateCode*>::iterator it = datecodes.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= datecodes.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != datecodes.end(); ++it, i++ ){
|
return datecodes[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != datecodes.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderFooter *HWPFile::getHeaderFooter(int index)
|
HeaderFooter *HWPFile::getHeaderFooter(int index)
|
||||||
{
|
{
|
||||||
std::list<HeaderFooter*>::iterator it = headerfooters.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= headerfooters.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != headerfooters.end(); ++it, i++ ){
|
return headerfooters[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != headerfooters.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPageNum *HWPFile::getPageNumber(int index)
|
ShowPageNum *HWPFile::getPageNumber(int index)
|
||||||
{
|
{
|
||||||
std::list<ShowPageNum*>::iterator it = pagenumbers.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= pagenumbers.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != pagenumbers.end(); ++it, i++ ){
|
return pagenumbers[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != pagenumbers.end() ? *it : nullptr;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Table *HWPFile::getTable(int index)
|
Table *HWPFile::getTable(int index)
|
||||||
{
|
{
|
||||||
std::list<Table*>::iterator it = tables.begin();
|
if (index < 0 || static_cast<unsigned int>(index) >= tables.size())
|
||||||
|
return nullptr;
|
||||||
for( int i = 0; it != tables.end(); ++it, i++ ){
|
return tables[index];
|
||||||
if( i == index )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return it != tables.end() ? *it : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWPFile::AddParaShape(ParaShape * pshape)
|
void HWPFile::AddParaShape(ParaShape * pshape)
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#define INCLUDED_HWPFILTER_SOURCE_HWPFILE_H
|
#define INCLUDED_HWPFILTER_SOURCE_HWPFILE_H
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -282,13 +283,13 @@ class DLLEXPORT HWPFile
|
|||||||
std::list<EmPicture*> emblist;
|
std::list<EmPicture*> emblist;
|
||||||
std::list<HyperText*> hyperlist;
|
std::list<HyperText*> hyperlist;
|
||||||
int currenthyper;
|
int currenthyper;
|
||||||
std::list<ParaShape*> pslist; /* 스타오피스의 구조상 필요 */
|
std::vector<ParaShape*> pslist; /* 스타오피스의 구조상 필요 */
|
||||||
std::list<CharShape*> cslist;
|
std::vector<CharShape*> cslist;
|
||||||
std::list<FBoxStyle*> fbslist;
|
std::vector<FBoxStyle*> fbslist;
|
||||||
std::list<DateCode*> datecodes;
|
std::vector<DateCode*> datecodes;
|
||||||
std::list<HeaderFooter*> headerfooters;
|
std::vector<HeaderFooter*> headerfooters;
|
||||||
std::list<ShowPageNum*> pagenumbers;
|
std::vector<ShowPageNum*> pagenumbers;
|
||||||
std::list<Table*> tables;
|
std::vector<Table*> tables;
|
||||||
|
|
||||||
// for global document handling
|
// for global document handling
|
||||||
static HWPFile *cur_doc;
|
static HWPFile *cur_doc;
|
||||||
|
Reference in New Issue
Block a user