Bug 41321. Use PRUnichar* instead of nsString* to store string values for nsCSSValue and nsHTMLValue. r=attinasi.

git-svn-id: svn://10.0.0.236/trunk@71406 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com
2000-06-02 22:54:35 +00:00
parent 6a5e71f874
commit f39433e11c
14 changed files with 100 additions and 88 deletions

View File

@@ -84,7 +84,7 @@ protected:
union {
PRInt32 mInt;
float mFloat;
nsString* mString;
PRUnichar* mString;
nsISupports* mISupports;
nscolor mColor;
} mValue;
@@ -102,8 +102,11 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
return mValue.mInt;
}
else if (mUnit == eHTMLUnit_String) {
PRInt32 err=0;
return (mValue.mString) ? mValue.mString->ToInteger(&err):0;
if (mValue.mString) {
PRInt32 err=0;
nsAutoString str = mValue.mString; // XXX copy. new string APIs will make this better, right?
return str.ToInteger(&err);
}
}
return 0;
}
@@ -133,7 +136,7 @@ inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const
aBuffer.SetLength(0);
if (((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName)) &&
(nsnull != mValue.mString)) {
aBuffer.Append(*(mValue.mString));
aBuffer.Append(mValue.mString);
}
return aBuffer;
}
@@ -158,7 +161,7 @@ inline nscolor nsHTMLValue::GetColorValue(void) const
}
if ((mUnit == eHTMLUnit_ColorName) && (mValue.mString)) {
nscolor color;
if (NS_ColorNameToRGB(*(mValue.mString), &color)) {
if (NS_ColorNameToRGB(nsAutoString(mValue.mString), &color)) {
return color;
}
}