Coverage Report

Created: 2026-03-12 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwpd/src/lib/WP6HyperlinkPacket.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) 2015 David Tardon (dtardon@redhat.com)
11
 *
12
 * For minor contributions see the git repository.
13
 *
14
 * Alternatively, the contents of this file may be used under the terms
15
 * of the GNU Lesser General Public License Version 2.1 or later
16
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17
 * applicable instead of those above.
18
 *
19
 * For further information visit http://libwpd.sourceforge.net
20
 */
21
22
/* "This product is not manufactured, approved, or supported by
23
 * Corel Corporation or Corel Corporation Limited."
24
 */
25
26
#include "WP6HyperlinkPacket.h"
27
28
#include <string>
29
30
#include "libwpd_internal.h"
31
32
WP6HyperlinkPacket::WP6HyperlinkPacket(librevenge::RVNGInputStream *const input, WPXEncryption *const encryption, int, const unsigned dataOffset, const unsigned dataSize)
33
0
  : WP6PrefixDataPacket(input, encryption)
34
0
  , m_target()
35
0
{
36
0
  _read(input, encryption, dataOffset, dataSize);
37
0
}
38
39
void WP6HyperlinkPacket::_readContents(librevenge::RVNGInputStream *const input, WPXEncryption *const encryption)
40
0
{
41
0
  if (getDataSize() % 2 != 0)
42
0
  {
43
0
    WPD_DEBUG_MSG(("WP6HyperlinkPacket::_readContents: size of the UTF-16 string is odd"));
44
0
  }
45
  // read all chars except the trailing \0
46
0
  for (unsigned pos = 0; pos + 2 < getDataSize(); pos += 2)
47
0
  {
48
0
    const unsigned unichar = readU16(input, encryption);
49
0
    appendUCS4(m_target, unichar);
50
0
  }
51
0
}
52
53
const librevenge::RVNGString &WP6HyperlinkPacket::getTarget() const
54
0
{
55
0
  return m_target;
56
0
}
57
58
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */