fixes for bugs #46898 and #46899: bad behavior in |nsCString::ToInteger| and a feature request for |ns[C]String::SetCapacity(0)| respectively. r={harishd, waterson}, a=waterson
git-svn-id: svn://10.0.0.236/trunk@75144 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -207,19 +207,26 @@ void nsString::SetLength(PRUint32 anIndex) {
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
* @update gess 1/4/99
|
||||
* @param aLength -- contains new length for mStr
|
||||
* @return
|
||||
* Call this method if you want to force the string to a certain capacity;
|
||||
* |SetCapacity(0)| discards associated storage.
|
||||
*
|
||||
* @param aNewCapacity -- desired minimum capacity
|
||||
*/
|
||||
void nsString::SetCapacity(PRUint32 aLength) {
|
||||
if(aLength) {
|
||||
if(aLength>mCapacity) {
|
||||
GrowCapacity(*this,aLength);
|
||||
}
|
||||
AddNullTerminator(*this);
|
||||
void
|
||||
nsString::SetCapacity( PRUint32 aNewCapacity )
|
||||
{
|
||||
if ( aNewCapacity )
|
||||
{
|
||||
if( aNewCapacity > mCapacity )
|
||||
GrowCapacity(*this, aNewCapacity);
|
||||
AddNullTerminator(*this);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsStr::Destroy(*this);
|
||||
nsStr::Initialize(*this, eTwoByte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
Accessor methods...
|
||||
|
||||
Reference in New Issue
Block a user