Coverage Report

Created: 2026-03-12 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwpd/src/lib/WP42Part.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-2004 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 "WP42Part.h"
29
#include "WP42FileStructure.h"
30
#include "WP42MultiByteFunctionGroup.h"
31
#include "libwpd_internal.h"
32
33
// constructPart: constructs a parseable low-level representation of part of the document
34
// returns the part if it successfully creates the part, returns 0 if it can't
35
// throws an exception if there is an error
36
// precondition: readVal us between 0xC0 and 0xFF
37
// TODO: check the precondition :D
38
WP42Part *WP42Part::constructPart(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char readVal)
39
152k
{
40
152k
  WPD_DEBUG_MSG(("WordPerfect: Offset: %i, ConstructPart(readVal: 0x%2x)\n", (unsigned int)input->tell(), readVal));
41
42
152k
  if (((unsigned char)0xC0 > readVal) || ((unsigned char)0xFE < readVal))
43
0
  {
44
0
    WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n"));
45
0
    return nullptr;
46
0
  }
47
48
152k
  WPD_DEBUG_MSG(("WordPerfect: constructMultiByteFunctionGroup(input, val)\n"));
49
152k
  return WP42MultiByteFunctionGroup::constructMultiByteFunctionGroup(input, encryption, readVal);
50
152k
}
51
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */