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:
darin%meer.net
2004-02-28 22:34:07 +00:00
parent 56a874f764
commit af98e4f306
97 changed files with 221 additions and 200 deletions

View File

@@ -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();
}

View File

@@ -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) )

View File

@@ -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();