fixing an off-by-one bug, and the associated problem when |mCapacity| and |mLength| are both |0|. r=waterson

git-svn-id: svn://10.0.0.236/trunk@64249 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%netscape.com
2000-03-27 22:13:41 +00:00
parent 3a2272eeab
commit 50e2ee0edc
3 changed files with 3 additions and 3 deletions

View File

@@ -285,7 +285,7 @@ void nsStr::Delete(nsStr& aDest,PRUint32 aDestOffset,PRUint32 aCount){
* @param aDestOffset is where in aDest truncation is to occur
*/
void nsStr::Truncate(nsStr& aDest,PRUint32 aDestOffset){
if(aDestOffset<aDest.mCapacity){
if(aDest.mCapacity && aDestOffset<=aDest.mCapacity){
aDest.mLength=aDestOffset;
AddNullTerminator(aDest);
NSSTR_SEEN(aDest);