landing dbaron's patch for bug 235735 "fix callers that cast away const on result of ns[C]String::get" r+sr=darin
git-svn-id: svn://10.0.0.236/trunk@153357 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -112,6 +112,7 @@ class nsTDependentString_CharT : public nsTString_CharT
|
||||
{
|
||||
mData = NS_CONST_CAST(char_type*, data);
|
||||
mLength = char_traits::length(data);
|
||||
SetDataFlags(F_TERMINATED);
|
||||
AssertValid();
|
||||
}
|
||||
|
||||
@@ -119,6 +120,7 @@ class nsTDependentString_CharT : public nsTString_CharT
|
||||
{
|
||||
mData = NS_CONST_CAST(char_type*, data);
|
||||
mLength = length;
|
||||
SetDataFlags(F_TERMINATED);
|
||||
AssertValid();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ class nsTDependentSubstring_CharT : public nsTSubstring_CharT
|
||||
NS_ASSERTION(start && end, "nsTDependentSubstring must wrap a non-NULL buffer");
|
||||
mData = NS_CONST_CAST(char_type*, start);
|
||||
mLength = end - start;
|
||||
SetDataFlags(F_NONE);
|
||||
}
|
||||
|
||||
nsTDependentSubstring_CharT( const abstract_string_type& str, PRUint32 startPos, PRUint32 length = size_type(-1) )
|
||||
|
||||
@@ -68,6 +68,13 @@ class nsTSubstring_CharT : public nsTAString_CharT
|
||||
* reading iterators
|
||||
*/
|
||||
|
||||
const_char_iterator BeginReading() const { return mData; }
|
||||
const_char_iterator EndReading() const { return mData + mLength; }
|
||||
|
||||
/**
|
||||
* deprecated reading iterators
|
||||
*/
|
||||
|
||||
const_iterator& BeginReading( const_iterator& iter ) const
|
||||
{
|
||||
iter.mStart = mData;
|
||||
@@ -99,6 +106,13 @@ class nsTSubstring_CharT : public nsTAString_CharT
|
||||
* writing iterators
|
||||
*/
|
||||
|
||||
char_iterator BeginWriting() { EnsureMutable(); return mData; }
|
||||
char_iterator EndWriting() { EnsureMutable(); return mData + mLength; }
|
||||
|
||||
/**
|
||||
* deprecated writing iterators
|
||||
*/
|
||||
|
||||
iterator& BeginWriting( iterator& iter )
|
||||
{
|
||||
EnsureMutable();
|
||||
|
||||
Reference in New Issue
Block a user