[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - hwpfilter/source
Caolán McNamara
caolanm at redhat.com
Tue Mar 21 16:05:14 UTC 2017
hwpfilter/source/hbox.cxx | 5 --
hwpfilter/source/hbox.h | 91 ++++++++++++++++++++-----------------------
hwpfilter/source/hwpread.cxx | 10 ++--
3 files changed, 49 insertions(+), 57 deletions(-)
New commits:
commit 96581fb96f6375a03029a434f42821bb882fe07d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 10 10:35:43 2017 +0000
ofz#798 oom
(cherry picked from commit 75f118da50b217956ee7a735e921524d0c2935ff)
Change-Id: I6fa8dd999af7e00d6236a1ead5f8bb519f2d128d
Reviewed-on: https://gerrit.libreoffice.org/35039
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index e501949ace73..3d912b5c85d5 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -74,18 +74,13 @@ hchar_string HBox::GetString()
// skip block
SkipData::SkipData(hchar hch)
: HBox(hch)
- , data_block_len(0)
- , dummy(0)
- , data_block(nullptr)
{
}
SkipData::~SkipData()
{
- delete[]data_block;
}
-
// FieldCode [5]
FieldCode::FieldCode()
: HBox(CH_FIELD)
diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h
index 36b8a146467f..d29c02752e4f 100644
--- a/hwpfilter/source/hbox.h
+++ b/hwpfilter/source/hbox.h
@@ -1,21 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* This file incorporates work covered by the following license notice:
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed
+* with this work for additional information regarding copyright
+* ownership. The ASF licenses this file to you under the Apache
+* License, Version 2.0 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.apache.org/licenses/LICENSE-2.0 .
+*/
#ifndef INCLUDED_HWPFILTER_SOURCE_HBOX_H
#define INCLUDED_HWPFILTER_SOURCE_HBOX_H
@@ -32,53 +32,50 @@
#include "hpara.h"
/**
- * The HBox class is the base class for all date classes in hwp document.
- * For example, there are special character, table, image, etc.
- * It has one character. The ascii code value of special characters are smaller than 32. General character is greater than 32.
- *
- * @short Base class for characters
- */
+* The HBox class is the base class for all date classes in hwp document.
+* For example, there are special character, table, image, etc.
+* It has one character. The ascii code value of special characters are smaller than 32. General character is greater than 32.
+*
+* @short Base class for characters
+*/
struct HBox
{
- public:
- hchar hh;
+public:
+ hchar hh;
/**
- * Construct a HBox object with parameter hch.
- * @param hch 16bit character being able to have Korean character.
- */
- explicit HBox( hchar hch );
- virtual ~HBox();
+* Construct a HBox object with parameter hch.
+* @param hch 16bit character being able to have Korean character.
+*/
+ explicit HBox( hchar hch );
+ virtual ~HBox();
/**
- * @returns The Size of HBox object
- */
- int WSize();
+* @returns The Size of HBox object
+*/
+ int WSize();
/**
- * Read properties from HIODevice object like stream, file, memory.
- *
- * @param hwpf HWPFile Object having all information for a hwp file.
- * @returns True if reading from stream is successful.
- */
- virtual bool Read(HWPFile &hwpf);
+* Read properties from HIODevice object like stream, file, memory.
+*
+* @param hwpf HWPFile Object having all information for a hwp file.
+* @returns True if reading from stream is successful.
+*/
+ virtual bool Read(HWPFile &hwpf);
- virtual hchar_string GetString();
- private:
- static int boxCount;
+ virtual hchar_string GetString();
+private:
+ static int boxCount;
};
/**
- * @short Class for saving data to be skipped.
- */
+* @short Class for skipping data.
+*/
struct SkipData: public HBox
{
- uint data_block_len;
- hchar dummy;
- char *data_block;
-
explicit SkipData(hchar);
virtual ~SkipData();
virtual bool Read(HWPFile &hwpf) override;
};
+
struct DateCode;
struct FieldCode : public HBox
{
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index a939b3cb15ad..d3bedc3baeec 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -45,19 +45,19 @@ bool HBox::Read(HWPFile & )
bool SkipData::Read(HWPFile & hwpf)
{
+ uint data_block_len;
hwpf.Read4b(&data_block_len, 1);
+
+ hchar dummy;
hwpf.Read2b(&dummy, 1);
if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
return hwpf.SetState(HWP_InvalidFileFormat);
- }
-
- data_block = new char[data_block_len];
+ }
- return hwpf.Read1b(data_block, data_block_len);
+ return hwpf.SkipBlock(data_block_len);
}
-
// Field code(5)
bool FieldCode::Read(HWPFile & hwpf)
{
More information about the Libreoffice-commits
mailing list