typedef CharT* CharT_ptr;
typedef typename StringT::char_type char_type; typedef char_type*                  char_ptr;
NS_AllocateContiguousHandleWithData( const HandleT* aDummyHandlePtr, const basic_nsAReadableString<CharT>& aDataSource, PRUint32 aAdditionalCapacity )  {    typedef CharT* CharT_ptr;      // figure out the number of bytes needed the |HandleT| part, including padding to correctly align the data part    size_t handle_size    = NS_AlignedHandleSize(aDummyHandlePtr, CharT_ptr(0));      // figure out how many |CharT|s wee need to fit in the data part    size_t data_length    = aDataSource.Length();    size_t buffer_length  = data_length + aAdditionalCapacity;      // how many bytes is that (including a zero-terminator so we can claim to be flat)?    size_t buffer_size    = buffer_length * sizeof(CharT);    HandleT* result = 0;    void* handle_ptr = ::operator new(handle_size + buffer_size);    if ( handle_ptr )      {        CharT* data_start_ptr = CharT_ptr(NS_STATIC_CAST(unsigned char*, handle_ptr) + handle_size);        CharT* data_end_ptr   = data_start_ptr + data_length;        CharT* buffer_end_ptr = data_start_ptr + buffer_length;        nsReadingIterator<CharT> fromBegin, fromEnd;        CharT* toBegin = data_start_ptr;        copy_string(aDataSource.BeginReading(fromBegin), aDataSource.EndReading(fromEnd), toBegin);          // and if the caller bothered asking for a buffer bigger than their string, we'll zero-terminate        if ( aAdditionalCapacity > 0 )          *toBegin = CharT(0);        result = new (handle_ptr) HandleT(data_start_ptr, data_end_ptr, data_start_ptr, buffer_end_ptr, PR_TRUE);      }    return result;  }