ofz#798 oom
Change-Id: I6fa8dd999af7e00d6236a1ead5f8bb519f2d128d
This commit is contained in:
@@ -77,9 +77,6 @@ hchar_string HBox::GetString()
|
|||||||
// skip block
|
// skip block
|
||||||
SkipData::SkipData(hchar hch)
|
SkipData::SkipData(hchar hch)
|
||||||
: HBox(hch)
|
: HBox(hch)
|
||||||
, data_block_len(0)
|
|
||||||
, dummy(0)
|
|
||||||
, data_block(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,18 +68,15 @@ struct HBox
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short Class for saving data to be skipped.
|
* @short Class for skipping data.
|
||||||
*/
|
*/
|
||||||
struct SkipData: public HBox
|
struct SkipData: public HBox
|
||||||
{
|
{
|
||||||
uint data_block_len;
|
|
||||||
hchar dummy;
|
|
||||||
std::unique_ptr<char[]> data_block;
|
|
||||||
|
|
||||||
explicit SkipData(hchar);
|
explicit SkipData(hchar);
|
||||||
virtual ~SkipData() override;
|
virtual ~SkipData() override;
|
||||||
virtual bool Read(HWPFile &hwpf) override;
|
virtual bool Read(HWPFile &hwpf) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DateCode;
|
struct DateCode;
|
||||||
struct FieldCode : public HBox
|
struct FieldCode : public HBox
|
||||||
{
|
{
|
||||||
|
@@ -45,19 +45,19 @@ bool HBox::Read(HWPFile & )
|
|||||||
|
|
||||||
bool SkipData::Read(HWPFile & hwpf)
|
bool SkipData::Read(HWPFile & hwpf)
|
||||||
{
|
{
|
||||||
|
uint data_block_len;
|
||||||
hwpf.Read4b(&data_block_len, 1);
|
hwpf.Read4b(&data_block_len, 1);
|
||||||
|
|
||||||
|
hchar dummy;
|
||||||
hwpf.Read2b(&dummy, 1);
|
hwpf.Read2b(&dummy, 1);
|
||||||
|
|
||||||
if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
|
if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
|
||||||
return hwpf.SetState(HWP_InvalidFileFormat);
|
return hwpf.SetState(HWP_InvalidFileFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
data_block.reset(new char[data_block_len]);
|
return hwpf.SkipBlock(data_block_len);
|
||||||
|
|
||||||
return hwpf.Read1b(data_block.get(), data_block_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Field code(5)
|
// Field code(5)
|
||||||
bool FieldCode::Read(HWPFile & hwpf)
|
bool FieldCode::Read(HWPFile & hwpf)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user