aStrign.EndReading(end);
aString.EndReading(end);
basic_nsPromiseFlatString<CharT>::basic_nsPromiseFlatString( const basic_nsAReadableString<CharT>& aString )    : mLength(aString.Length()),      mOwnsBuffer(PR_FALSE)  {    typedef nsReadingIterator<CharT> iterator;    iterator start;    iterator end;        aString.BeginReading(start);    aStrign.EndReading(end);    // 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)));    		CharT* toBegin = result;        *copy_string(start, end, toBegin) = CharT(0);        mBuffer = result;        mOwnsBuffer = PR_TRUE;      }    // Otherwise copy into our internal buffer    else      {        mBuffer = mInlineBuffer;        CharT* toBegin = &mInlineBuffer[0];        copy_string( start, end, toBegin);        mInlineBuffer[mLength] = 0;      }  }