Coverage Report

Created: 2026-04-29 07:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwpd/src/lib/WP42MultiByteFunctionGroup.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
/* libwpd
3
 * Version: MPL 2.0 / LGPLv2.1+
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * Major Contributor(s):
10
 * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
11
 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
12
 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13
 *
14
 * For minor contributions see the git repository.
15
 *
16
 * Alternatively, the contents of this file may be used under the terms
17
 * of the GNU Lesser General Public License Version 2.1 or later
18
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19
 * applicable instead of those above.
20
 *
21
 * For further information visit http://libwpd.sourceforge.net
22
 */
23
24
/* "This product is not manufactured, approved, or supported by
25
 * Corel Corporation or Corel Corporation Limited."
26
 */
27
28
#include "WP42MultiByteFunctionGroup.h"
29
#include "WP42UnsupportedMultiByteFunctionGroup.h"
30
#include "WP42HeaderFooterGroup.h"
31
#include "WP42MarginResetGroup.h"
32
#include "WP42SuppressPageCharacteristicsGroup.h"
33
#include "WP42ExtendedCharacterGroup.h"
34
#include "WP42DefineColumnsGroup.h"
35
#include "WP42FileStructure.h"
36
#include "libwpd_internal.h"
37
38
WP42MultiByteFunctionGroup::WP42MultiByteFunctionGroup(unsigned char group)
39
152k
  : m_group(group)
40
152k
{
41
152k
}
42
43
WP42MultiByteFunctionGroup *WP42MultiByteFunctionGroup::constructMultiByteFunctionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group)
44
152k
{
45
152k
  switch (group)
46
152k
  {
47
3.84k
  case WP42_MARGIN_RESET_GROUP:
48
3.84k
    return new WP42MarginResetGroup(input, encryption, group);
49
72.9k
  case WP42_SUPPRESS_PAGE_CHARACTERISTICS_GROUP:
50
72.9k
    return new WP42SuppressPageCharacteristicsGroup(input, encryption, group);
51
5.86k
  case WP42_HEADER_FOOTER_GROUP:
52
5.86k
    return new WP42HeaderFooterGroup(input, encryption, group);
53
317
  case WP42_EXTENDED_CHARACTER_GROUP:
54
317
    return new WP42ExtendedCharacterGroup(input, encryption, group);
55
619
  case WP42_DEFINE_COLUMNS_OLD_GROUP:
56
896
  case WP42_DEFINE_COLUMNS_NEW_GROUP:
57
896
    return new WP42DefineColumnsGroup(input, encryption, group);
58
68.2k
  default:
59
    // this is an unhandled group, just skip it
60
68.2k
    return new WP42UnsupportedMultiByteFunctionGroup(input, encryption, group);
61
152k
  }
62
152k
}
63
64
void WP42MultiByteFunctionGroup::_read(librevenge::RVNGInputStream *input, WPXEncryption *encryption)
65
152k
{
66
152k
  _readContents(input, encryption);
67
68
  // skip over the remaining bytes of the group, if any
69
3.77M
  while (!input->isEnd() && (readU8(input, encryption) != m_group)) // getGroup()));
70
3.61M
  {
71
3.61M
  }
72
  // IMPORTANT: if the class that implements _readContent(input, encryption) already reads the closing gate,
73
  // IMPORTANT: it is necessary to make an input->seek(-1, librevenge::RVNG_SEEK_CUR) for this function to work well.
74
152k
}
75
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */