/src/mozilla-central/xpcom/string/nsTPromiseFlatString.cpp
Line | Count | Source |
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 | | void |
9 | | nsTPromiseFlatString<T>::Init(const substring_type& str) |
10 | 4.00M | { |
11 | 4.00M | if (str.IsTerminated()) { |
12 | 3.90M | char_type* newData = |
13 | 3.90M | const_cast<char_type*>(static_cast<const char_type*>(str.Data())); |
14 | 3.90M | size_type newLength = str.Length(); |
15 | 3.90M | DataFlags newDataFlags = |
16 | 3.90M | str.GetDataFlags() & (DataFlags::TERMINATED | DataFlags::LITERAL); |
17 | 3.90M | // does not promote DataFlags::VOIDED |
18 | 3.90M | |
19 | 3.90M | this->SetData(newData, newLength, newDataFlags); |
20 | 3.90M | } else { |
21 | 102k | this->Assign(str); |
22 | 102k | } |
23 | 4.00M | } nsTPromiseFlatString<char>::Init(nsTSubstring<char> const&) Line | Count | Source | 10 | 3.87M | { | 11 | 3.87M | if (str.IsTerminated()) { | 12 | 3.87M | char_type* newData = | 13 | 3.87M | const_cast<char_type*>(static_cast<const char_type*>(str.Data())); | 14 | 3.87M | size_type newLength = str.Length(); | 15 | 3.87M | DataFlags newDataFlags = | 16 | 3.87M | str.GetDataFlags() & (DataFlags::TERMINATED | DataFlags::LITERAL); | 17 | 3.87M | // does not promote DataFlags::VOIDED | 18 | 3.87M | | 19 | 3.87M | this->SetData(newData, newLength, newDataFlags); | 20 | 3.87M | } else { | 21 | 3 | this->Assign(str); | 22 | 3 | } | 23 | 3.87M | } |
nsTPromiseFlatString<char16_t>::Init(nsTSubstring<char16_t> const&) Line | Count | Source | 10 | 130k | { | 11 | 130k | if (str.IsTerminated()) { | 12 | 27.6k | char_type* newData = | 13 | 27.6k | const_cast<char_type*>(static_cast<const char_type*>(str.Data())); | 14 | 27.6k | size_type newLength = str.Length(); | 15 | 27.6k | DataFlags newDataFlags = | 16 | 27.6k | str.GetDataFlags() & (DataFlags::TERMINATED | DataFlags::LITERAL); | 17 | 27.6k | // does not promote DataFlags::VOIDED | 18 | 27.6k | | 19 | 27.6k | this->SetData(newData, newLength, newDataFlags); | 20 | 102k | } else { | 21 | 102k | this->Assign(str); | 22 | 102k | } | 23 | 130k | } |
|