bug #53067: r=danm, sr=alecf. Eliminate copying versions of |BeginReading|, |EndReading|, |BeginWriting|, |EndWriting|, and fix callers
git-svn-id: svn://10.0.0.236/trunk@86364 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1339,8 +1339,8 @@ nsPlainTextSerializer::Write(const nsAReadableString& aString)
|
||||
|
||||
// Find one of '\n' or '\r' using iterators since nsAReadableString
|
||||
// doesn't have the old FindCharInSet function.
|
||||
nsAReadableString::const_iterator iter = aString.BeginReading();
|
||||
nsAReadableString::const_iterator done_searching = aString.EndReading();
|
||||
nsAReadableString::const_iterator iter; aString.BeginReading(iter);
|
||||
nsAReadableString::const_iterator done_searching; aString.EndReading(done_searching);
|
||||
iter += bol;
|
||||
PRInt32 new_newline = bol;
|
||||
newline = kNotFound;
|
||||
|
||||
@@ -2128,7 +2128,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
||||
if (aTable->value == v) {
|
||||
aResult.Append(NS_ConvertASCIItoUCS2(aTable->tag));
|
||||
if (aFoldCase) {
|
||||
nsWritingIterator<PRUnichar> start(aResult.BeginWriting());
|
||||
nsWritingIterator<PRUnichar> start; aResult.BeginWriting(start);
|
||||
*start.get() = nsCRT::ToUpper(*start.get());
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
||||
@@ -4357,8 +4357,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
||||
// wouldn't get redirected to the correct URL.
|
||||
if (millis == -1 && (nsCRT::IsAsciiDigit(token.First()) || token.First()==PRUnichar('.'))) {
|
||||
PRBool tokenIsANumber = PR_TRUE;
|
||||
nsReadingIterator<PRUnichar> doneIterating(token.EndReading());
|
||||
nsReadingIterator<PRUnichar> iter(token.BeginReading());
|
||||
nsReadingIterator<PRUnichar> doneIterating; token.EndReading(doneIterating);
|
||||
nsReadingIterator<PRUnichar> iter; token.BeginReading(iter);
|
||||
while ( iter != doneIterating )
|
||||
{
|
||||
if (!(tokenIsANumber = nsCRT::IsAsciiDigit(*iter)) && *iter!=PRUnichar('.'))
|
||||
|
||||
@@ -1339,8 +1339,8 @@ nsPlainTextSerializer::Write(const nsAReadableString& aString)
|
||||
|
||||
// Find one of '\n' or '\r' using iterators since nsAReadableString
|
||||
// doesn't have the old FindCharInSet function.
|
||||
nsAReadableString::const_iterator iter = aString.BeginReading();
|
||||
nsAReadableString::const_iterator done_searching = aString.EndReading();
|
||||
nsAReadableString::const_iterator iter; aString.BeginReading(iter);
|
||||
nsAReadableString::const_iterator done_searching; aString.EndReading(done_searching);
|
||||
iter += bol;
|
||||
PRInt32 new_newline = bol;
|
||||
newline = kNotFound;
|
||||
|
||||
@@ -2128,7 +2128,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
||||
if (aTable->value == v) {
|
||||
aResult.Append(NS_ConvertASCIItoUCS2(aTable->tag));
|
||||
if (aFoldCase) {
|
||||
nsWritingIterator<PRUnichar> start(aResult.BeginWriting());
|
||||
nsWritingIterator<PRUnichar> start; aResult.BeginWriting(start);
|
||||
*start.get() = nsCRT::ToUpper(*start.get());
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
||||
@@ -4357,8 +4357,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
||||
// wouldn't get redirected to the correct URL.
|
||||
if (millis == -1 && (nsCRT::IsAsciiDigit(token.First()) || token.First()==PRUnichar('.'))) {
|
||||
PRBool tokenIsANumber = PR_TRUE;
|
||||
nsReadingIterator<PRUnichar> doneIterating(token.EndReading());
|
||||
nsReadingIterator<PRUnichar> iter(token.BeginReading());
|
||||
nsReadingIterator<PRUnichar> doneIterating; token.EndReading(doneIterating);
|
||||
nsReadingIterator<PRUnichar> iter; token.BeginReading(iter);
|
||||
while ( iter != doneIterating )
|
||||
{
|
||||
if (!(tokenIsANumber = nsCRT::IsAsciiDigit(*iter)) && *iter!=PRUnichar('.'))
|
||||
|
||||
@@ -777,8 +777,8 @@ void nsCString::AssignWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -800,8 +800,8 @@ void nsCString::AppendWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -1470,8 +1470,8 @@ void nsCString::DebugDump(void) const {
|
||||
|
||||
NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString )
|
||||
{
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
nsReadableFragment<PRUnichar> frag(start.fragment());
|
||||
|
||||
@@ -324,10 +324,7 @@ class basic_nsAReadableString
|
||||
// ...yes, I expect to be sub-classed.
|
||||
|
||||
nsReadingIterator<CharT>& BeginReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> BeginReading() const; // deprecated
|
||||
|
||||
nsReadingIterator<CharT>& EndReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> EndReading() const; // deprecated
|
||||
|
||||
virtual PRUint32 Length() const = 0;
|
||||
PRBool IsEmpty() const;
|
||||
@@ -493,16 +490,6 @@ basic_nsAReadableString<CharT>::BeginReading( nsReadingIterator<CharT>& aResult
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::BeginReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return BeginReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>&
|
||||
@@ -515,16 +502,6 @@ basic_nsAReadableString<CharT>::EndReading( nsReadingIterator<CharT>& aResult )
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::EndReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return EndReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
PRBool
|
||||
@@ -1490,7 +1467,7 @@ basic_nsPromiseFlatString<CharT>::basic_nsPromiseFlatString( const basic_nsARead
|
||||
}
|
||||
|
||||
// Now figure out what we want to do with the string
|
||||
start = aString.BeginReading();
|
||||
aString.BeginReading(start);
|
||||
// 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 )
|
||||
|
||||
@@ -293,14 +293,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
BeginWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return BeginWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
nsWritingIterator<CharT>&
|
||||
EndWriting( nsWritingIterator<CharT>& aResult )
|
||||
@@ -312,14 +304,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
EndWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return EndWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* |SetCapacity| is not required to do anything; however, it can be used
|
||||
|
||||
@@ -324,10 +324,7 @@ class basic_nsAReadableString
|
||||
// ...yes, I expect to be sub-classed.
|
||||
|
||||
nsReadingIterator<CharT>& BeginReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> BeginReading() const; // deprecated
|
||||
|
||||
nsReadingIterator<CharT>& EndReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> EndReading() const; // deprecated
|
||||
|
||||
virtual PRUint32 Length() const = 0;
|
||||
PRBool IsEmpty() const;
|
||||
@@ -493,16 +490,6 @@ basic_nsAReadableString<CharT>::BeginReading( nsReadingIterator<CharT>& aResult
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::BeginReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return BeginReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>&
|
||||
@@ -515,16 +502,6 @@ basic_nsAReadableString<CharT>::EndReading( nsReadingIterator<CharT>& aResult )
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::EndReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return EndReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
PRBool
|
||||
@@ -1490,7 +1467,7 @@ basic_nsPromiseFlatString<CharT>::basic_nsPromiseFlatString( const basic_nsARead
|
||||
}
|
||||
|
||||
// Now figure out what we want to do with the string
|
||||
start = aString.BeginReading();
|
||||
aString.BeginReading(start);
|
||||
// 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 )
|
||||
|
||||
@@ -293,14 +293,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
BeginWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return BeginWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
nsWritingIterator<CharT>&
|
||||
EndWriting( nsWritingIterator<CharT>& aResult )
|
||||
@@ -312,14 +304,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
EndWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return EndWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* |SetCapacity| is not required to do anything; however, it can be used
|
||||
|
||||
@@ -777,8 +777,8 @@ void nsCString::AssignWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -800,8 +800,8 @@ void nsCString::AppendWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -1470,8 +1470,8 @@ void nsCString::DebugDump(void) const {
|
||||
|
||||
NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString )
|
||||
{
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
nsReadableFragment<PRUnichar> frag(start.fragment());
|
||||
|
||||
@@ -777,8 +777,8 @@ void nsCString::AssignWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -800,8 +800,8 @@ void nsCString::AppendWithConversion( const nsAReadableString& aString ) {
|
||||
PRInt32 count = aString.Length();
|
||||
|
||||
if(count){
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
PRUint32 fraglen = start.size_forward();
|
||||
@@ -1470,8 +1470,8 @@ void nsCString::DebugDump(void) const {
|
||||
|
||||
NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString )
|
||||
{
|
||||
nsReadingIterator<PRUnichar> start(aString.BeginReading());
|
||||
nsReadingIterator<PRUnichar> end(aString.EndReading());
|
||||
nsReadingIterator<PRUnichar> start; aString.BeginReading(start);
|
||||
nsReadingIterator<PRUnichar> end; aString.EndReading(end);
|
||||
|
||||
while (start != end) {
|
||||
nsReadableFragment<PRUnichar> frag(start.fragment());
|
||||
|
||||
@@ -324,10 +324,7 @@ class basic_nsAReadableString
|
||||
// ...yes, I expect to be sub-classed.
|
||||
|
||||
nsReadingIterator<CharT>& BeginReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> BeginReading() const; // deprecated
|
||||
|
||||
nsReadingIterator<CharT>& EndReading( nsReadingIterator<CharT>& ) const;
|
||||
nsReadingIterator<CharT> EndReading() const; // deprecated
|
||||
|
||||
virtual PRUint32 Length() const = 0;
|
||||
PRBool IsEmpty() const;
|
||||
@@ -493,16 +490,6 @@ basic_nsAReadableString<CharT>::BeginReading( nsReadingIterator<CharT>& aResult
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::BeginReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return BeginReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>&
|
||||
@@ -515,16 +502,6 @@ basic_nsAReadableString<CharT>::EndReading( nsReadingIterator<CharT>& aResult )
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
template <class CharT>
|
||||
inline
|
||||
nsReadingIterator<CharT>
|
||||
basic_nsAReadableString<CharT>::EndReading() const
|
||||
{
|
||||
nsReadingIterator<CharT> result;
|
||||
return EndReading(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
inline
|
||||
PRBool
|
||||
@@ -1490,7 +1467,7 @@ basic_nsPromiseFlatString<CharT>::basic_nsPromiseFlatString( const basic_nsARead
|
||||
}
|
||||
|
||||
// Now figure out what we want to do with the string
|
||||
start = aString.BeginReading();
|
||||
aString.BeginReading(start);
|
||||
// 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 )
|
||||
|
||||
@@ -293,14 +293,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
BeginWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return BeginWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
nsWritingIterator<CharT>&
|
||||
EndWriting( nsWritingIterator<CharT>& aResult )
|
||||
@@ -312,14 +304,6 @@ class basic_nsAWritableString
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
nsWritingIterator<CharT>
|
||||
EndWriting()
|
||||
{
|
||||
nsWritingIterator<CharT> result;
|
||||
return EndWriting(result); // copies (since I return a value, not a reference)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* |SetCapacity| is not required to do anything; however, it can be used
|
||||
|
||||
Reference in New Issue
Block a user