copy_string( start, end, NS_STATIC_CAST(CharT *, &mInlineBuffer[0]));
CharT* toBegin = &mInlineBuffer[0]; copy_string( start, end, toBegin);
basic_nsPromiseFlatString<CharT>::basic_nsPromiseFlatString( const basic_nsAReadableString<CharT>& aString ) : mLength(aString.Length()), mOwnsBuffer(PR_FALSE){  typedef nsReadingIterator<CharT> iterator;  iterator start( aString.BeginReading() );  iterator end( aString.EndReading() );  // First count the number of buffers  PRInt32 buffer_count = 0;  while ( start != end ) {    buffer_count++;    start += start.size_forward();  }  // Now figure out what we want to do with the string  start = aString.BeginReading();  // XXX Not guaranteed null-termination in the first case  // If it's a single buffer, we just use the implementation's buffer  if ( buffer_count == 1 )     mBuffer = start.get();  // If it's too big for our inline buffer, we allocate a new one  else if ( mLength > kDefaultFlatStringSize-1 ) {    CharT* result = NS_STATIC_CAST(CharT*, 				   nsMemory::Alloc((mLength+1) * sizeof(CharT)));    *copy_string(start, end, result) = CharT(0);    mBuffer = result;    mOwnsBuffer = PR_TRUE;  }  // Otherwise copy into our internal buffer  else {    mBuffer = mInlineBuffer;    copy_string( start, end, NS_STATIC_CAST(CharT *, &mInlineBuffer[0]));    mInlineBuffer[mLength] = 0;  }}