Solaris bustage fix from scc/bruce/#mozilla

git-svn-id: svn://10.0.0.236/trunk@78010 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mcafee%netscape.com
2000-09-02 07:14:59 +00:00
parent c1616c08d6
commit d290cd5114
6 changed files with 186 additions and 9 deletions

View File

@@ -196,7 +196,35 @@ class nsReadingIterator
return mPosition - mFragment.mStart;
}
nsReadingIterator<CharT>& advance( difference_type );
nsReadingIterator<CharT>&
advance( difference_type n )
{
while ( n > 0 )
{
difference_type one_hop = NS_MIN(n, size_forward());
NS_ASSERTION(one_hop>0, "Infinite loop: can't advance a reading iterator beyond the end of a string");
// perhaps I should |break| if |!one_hop|?
mPosition += one_hop;
normalize_forward();
n -= one_hop;
}
while ( n < 0 )
{
normalize_backward();
difference_type one_hop = NS_MAX(n, -size_backward());
NS_ASSERTION(one_hop<0, "Infinite loop: can't advance (backward) a reading iterator beyond the end of a string");
// perhaps I should |break| if |!one_hop|?
mPosition += one_hop;
n -= one_hop;
}
return *this;
}
/**
* Really don't want to call these two operations |+=| and |-=|.
@@ -217,6 +245,7 @@ class nsReadingIterator
}
};
#if 0
template <class CharT>
nsReadingIterator<CharT>&
nsReadingIterator<CharT>::advance( difference_type n )
@@ -247,6 +276,7 @@ nsReadingIterator<CharT>::advance( difference_type n )
return *this;
}
#endif
template <class Iterator>
inline

View File

@@ -156,7 +156,35 @@ class nsWritingIterator
return mPosition - mFragment.mStart;
}
nsWritingIterator<CharT>& advance( difference_type );
nsWritingIterator<CharT>&
advance( difference_type n )
{
while ( n > 0 )
{
difference_type one_hop = NS_MIN(n, size_forward());
NS_ASSERTION(one_hop>0, "Infinite loop: can't advance a writing iterator beyond the end of a string");
// perhaps I should |break| if |!one_hop|?
mPosition += one_hop;
normalize_forward();
n -= one_hop;
}
while ( n < 0 )
{
normalize_backward();
difference_type one_hop = NS_MAX(n, -size_backward());
NS_ASSERTION(one_hop<0, "Infinite loop: can't advance (backward) a writing iterator beyond the end of a string");
// perhaps I should |break| if |!one_hop|?
mPosition += one_hop;
n -= one_hop;
}
return *this;
}
/**
* Really don't want to call these two operations |+=| and |-=|.
@@ -188,6 +216,7 @@ class nsWritingIterator
}
};
#if 0
template <class CharT>
nsWritingIterator<CharT>&
nsWritingIterator<CharT>::advance( difference_type n )
@@ -218,7 +247,7 @@ nsWritingIterator<CharT>::advance( difference_type n )
return *this;
}
#endif
/*
This file defines the abstract interfaces |nsAWritableString| and