michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: void michael@0: nsTDependentString_CharT::Rebind( const string_type& str, uint32_t startPos ) michael@0: { michael@0: NS_ABORT_IF_FALSE(str.Flags() & F_TERMINATED, "Unterminated flat string"); michael@0: michael@0: // If we currently own a buffer, release it. michael@0: Finalize(); michael@0: michael@0: size_type strLength = str.Length(); michael@0: michael@0: if (startPos > strLength) michael@0: startPos = strLength; michael@0: michael@0: mData = const_cast(static_cast(str.Data())) + startPos; michael@0: mLength = strLength - startPos; michael@0: michael@0: SetDataFlags(str.Flags() & (F_TERMINATED | F_LITERAL)); michael@0: }