void
nsTPromiseFlatString_CharT::Init(const substring_type& str)
{
  if (str.IsTerminated()) {
    mData = const_cast<char_type*>(static_cast<const char_type*>(str.Data()));
    mLength = str.Length();
    mFlags = str.mFlags & (F_TERMINATED | F_LITERAL);
    // does not promote F_VOIDED
  } else {
    Assign(str);
  }
}
Beispiel #2
0
void
nsTDependentSubstring_CharT::Rebind( const substring_type& str, uint32_t startPos, uint32_t length )
{
  // If we currently own a buffer, release it.
  Finalize();

  size_type strLength = str.Length();

  if (startPos > strLength)
    startPos = strLength;

  mData = const_cast<char_type*>(static_cast<const char_type*>(str.Data())) + startPos;
  mLength = XPCOM_MIN(length, strLength - startPos);

  SetDataFlags(F_NONE);
}
void
nsTDependentSubstring_CharT::Rebind( const substring_type& str, PRUint32 startPos, PRUint32 length )
  {
    // If we currently own a buffer, release it.
    Finalize();

    size_type strLength = str.Length();

    if (startPos > strLength)
      startPos = strLength;

    mData = NS_CONST_CAST(char_type*, str.Data()) + startPos;
    mLength = NS_MIN(length, strLength - startPos);

    SetDataFlags(F_NONE);
  }