Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/xpcom/string/nsTDependentString.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
template <typename T>
8
nsTDependentString<T>::nsTDependentString(const char_type* aStart,
9
                                          const char_type* aEnd)
10
  : string_type(const_cast<char_type*>(aStart), uint32_t(aEnd - aStart),
11
                DataFlags::TERMINATED, ClassFlags(0))
12
0
{
13
0
  MOZ_RELEASE_ASSERT(aStart <= aEnd, "Overflow!");
14
0
  this->AssertValidDependentString();
15
0
}
Unexecuted instantiation: nsTDependentString<char>::nsTDependentString(char const*, char const*)
Unexecuted instantiation: nsTDependentString<char16_t>::nsTDependentString(char16_t const*, char16_t const*)
16
17
template <typename T>
18
void
19
nsTDependentString<T>::Rebind(const string_type& str, uint32_t startPos)
20
0
{
21
0
  MOZ_ASSERT(str.GetDataFlags() & DataFlags::TERMINATED, "Unterminated flat string");
22
0
23
0
  // If we currently own a buffer, release it.
24
0
  this->Finalize();
25
0
26
0
  size_type strLength = str.Length();
27
0
28
0
  if (startPos > strLength) {
29
0
    startPos = strLength;
30
0
  }
31
0
32
0
  char_type* newData =
33
0
    const_cast<char_type*>(static_cast<const char_type*>(str.Data())) + startPos;
34
0
  size_type newLen = strLength - startPos;
35
0
  DataFlags newDataFlags = str.GetDataFlags() & (DataFlags::TERMINATED | DataFlags::LITERAL);
36
0
  this->SetData(newData, newLen, newDataFlags);
37
0
}
Unexecuted instantiation: nsTDependentString<char>::Rebind(nsTString<char> const&, unsigned int)
Unexecuted instantiation: nsTDependentString<char16_t>::Rebind(nsTString<char16_t> const&, unsigned int)
38
39
template <typename T>
40
void
41
nsTDependentString<T>::Rebind(const char_type* aStart, const char_type* aEnd)
42
0
{
43
0
  MOZ_RELEASE_ASSERT(aStart <= aEnd, "Overflow!");
44
0
  this->Rebind(aStart, uint32_t(aEnd - aStart));
45
0
}
Unexecuted instantiation: nsTDependentString<char>::Rebind(char const*, char const*)
Unexecuted instantiation: nsTDependentString<char16_t>::Rebind(char16_t const*, char16_t const*)