LCOV - code coverage report
Current view: top level - xpcom/string - nsTString.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 19 19 100.0 %
Date: 2017-07-14 16:53:18 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : nsTAdoptingString_CharT&
       8         225 : nsTAdoptingString_CharT::operator=(const self_type& str)
       9             : {
      10             :   // This'll violate the constness of this argument, that's just
      11             :   // the nature of this class...
      12         225 :   self_type* mutable_str = const_cast<self_type*>(&str);
      13             : 
      14         225 :   if (str.mDataFlags & DataFlags::OWNED) {
      15             :     // We want to do what Adopt() does, but without actually incrementing
      16             :     // the Adopt count.  Note that we can be a little more straightforward
      17             :     // about this than Adopt() is, because we know that str.mData is
      18             :     // non-null.  Should we be able to assert that str is not void here?
      19          34 :     NS_ASSERTION(str.mData, "String with null mData?");
      20          34 :     Finalize();
      21          34 :     mData = str.mData;
      22          34 :     mLength = str.mLength;
      23          34 :     mDataFlags = DataFlags::TERMINATED | DataFlags::OWNED;
      24             : 
      25             :     // Make str forget the buffer we just took ownership of.
      26          34 :     new (mutable_str) self_type();
      27             :   } else {
      28         191 :     Assign(str);
      29             : 
      30         191 :     mutable_str->Truncate();
      31             :   }
      32             : 
      33         225 :   return *this;
      34             : }
      35             : 
      36             : void
      37        2439 : nsTString_CharT::Rebind(const char_type* data, size_type length)
      38             : {
      39             :   // If we currently own a buffer, release it.
      40        2439 :   Finalize();
      41             : 
      42        2439 :   mData = const_cast<char_type*>(data);
      43        2439 :   mLength = length;
      44        2439 :   mDataFlags = DataFlags::TERMINATED;
      45        2439 :   AssertValidDependentString();
      46        2439 : }
      47             : 

Generated by: LCOV version 1.13