making string conversions explicit

This commit is contained in:
scc%netscape.com 2000-04-17 14:47:33 +00:00
parent f40b76249a
commit c709f689ab
5 changed files with 69 additions and 69 deletions

View File

@ -3028,8 +3028,8 @@ nsXULTemplateBuilder::Init()
if (gRefCnt++ == 0) {
nsXULAtoms::AddRef();
trueStr = "true";
falseStr = "false";
trueStr.AssignWithConversion("true");
falseStr.AssignWithConversion("false");
nsresult rv;
@ -3049,11 +3049,11 @@ nsXULTemplateBuilder::Init()
static const char kRDFNameSpaceURI[]
= RDF_NAMESPACE_URI;
rv = gNameSpaceManager->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL);
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");
if (NS_FAILED(rv)) return rv;
rv = gNameSpaceManager->RegisterNameSpace(kRDFNameSpaceURI, kNameSpaceID_RDF);
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kRDFNameSpaceURI), kNameSpaceID_RDF);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
if (NS_FAILED(rv)) return rv;
@ -3742,10 +3742,10 @@ nsXULTemplateBuilder::SubstituteText(nsIRDFResource* aResource,
{
nsresult rv;
if (aAttributeValue.Equals("...") || aAttributeValue.Equals("rdf:*")) {
if (aAttributeValue.EqualsWithConversion("...") || aAttributeValue.EqualsWithConversion("rdf:*")) {
const char *uri = nsnull;
aResource->GetValueConst(&uri);
aAttributeValue = uri;
aAttributeValue.AssignWithConversion(uri);
}
else if (aMatch.mRule && aAttributeValue[0] == PRUnichar('?')) {
PRInt32 var = aMatch.mRule->LookupSymbol(aAttributeValue);
@ -3961,7 +3961,7 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
aMatch.mInstantiation.mBindings.GetBindingFor(aMatch.mRule->GetMemberVariable(), &member);
aChild = VALUE_TO_IRDFRESOURCE(member);
}
else if (uri.Equals("...") || uri.Equals("rdf:*")) {
else if (uri.EqualsWithConversion("...") || uri.EqualsWithConversion("rdf:*")) {
// If we -are- the resource element, then we are no
// matter unique.
isResourceElement = PR_TRUE;
@ -4056,7 +4056,7 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource URI");
if (NS_FAILED(rv)) return rv;
nsAutoString id(uri);
nsAutoString id; id.AssignWithConversion(uri);
rv = realKid->SetAttribute(kNameSpaceID_None, nsXULAtoms::id, id, PR_FALSE);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set id attribute");
if (NS_FAILED(rv)) return rv;
@ -4435,7 +4435,7 @@ nsXULTemplateBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
if (NS_FAILED(rv)) return rv;
if (property.get() == aProperty) {
nsAutoString text("");
nsAutoString text;
rv = gXULUtils->GetTextForNode(aValue, text);
if (NS_FAILED(rv)) return rv;
@ -5191,7 +5191,7 @@ nsXULTemplateBuilder::GetElementsForResource(nsIRDFResource* aResource, nsISuppo
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource URI");
if (NS_FAILED(rv)) return rv;
rv = mDocument->GetElementsForID(nsAutoString(uri), aElements);
rv = mDocument->GetElementsForID(NS_ConvertASCIItoUCS2(uri), aElements);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to retrieve elements from resource");
if (NS_FAILED(rv)) return rv;
@ -5283,7 +5283,7 @@ nsXULTemplateBuilder::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory*
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID.Append(nameSpace);
progID.AppendWithConversion(nameSpace.GetUnicode());
// Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);
@ -5381,7 +5381,7 @@ nsXULTemplateBuilder::ContentIdTestNode::FilterInstantiations(InstantiationSet&
rv = VALUE_TO_IRDFRESOURCE(idValue)->GetValueConst(&uri);
if (NS_FAILED(rv)) return rv;
rv = mDocument->GetElementsForID(nsAutoString(uri), elements);
rv = mDocument->GetElementsForID(NS_ConvertASCIItoUCS2(uri), elements);
if (NS_FAILED(rv)) return rv;
PRUint32 count;
@ -5746,10 +5746,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRule,
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
if (value.Equals("true")) {
if (value.EqualsWithConversion("true")) {
iscontainer = RDFContainerInstanceTestNode::eTrue;
}
else if (value.Equals("false")) {
else if (value.EqualsWithConversion("false")) {
iscontainer = RDFContainerInstanceTestNode::eFalse;
}
}
@ -5761,10 +5761,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRule,
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
if (value.Equals("true")) {
if (value.EqualsWithConversion("true")) {
isempty = RDFContainerInstanceTestNode::eTrue;
}
else if (value.Equals("false")) {
else if (value.EqualsWithConversion("false")) {
isempty = RDFContainerInstanceTestNode::eFalse;
}
}

View File

@ -123,7 +123,7 @@ SetXULRadioGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
if (NS_SUCCEEDED(rv)) {
nsIDOMXULRadioElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIXULRadioElementIID, "XULRadioElement",
kIXULRadioElementIID, NS_ConvertASCIItoUCS2("XULRadioElement"),
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}

View File

@ -77,69 +77,69 @@ nsXULCheckboxElement::~nsXULCheckboxElement()
NS_IMETHODIMP
nsXULCheckboxElement::GetValue(nsString& aValue)
{
return mOuter->GetAttribute("value", aValue);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetValue(const nsString& aValue)
{
return mOuter->SetAttribute("value", aValue);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetCrop(nsString& aCrop)
{
return mOuter->GetAttribute("crop", aCrop);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetCrop(const nsString& aCrop)
{
return mOuter->SetAttribute("crop", aCrop);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetSrc(nsString& aSrc)
{
return mOuter->GetAttribute("src", aSrc);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetSrc(const nsString& aSrc)
{
return mOuter->SetAttribute("src", aSrc);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetImgalign(nsString& aImgalign)
{
return mOuter->GetAttribute("imgalign", aImgalign);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetImgalign(const nsString& aImgalign)
{
return mOuter->SetAttribute("imgalign", aImgalign);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetAccesskey(nsString& aAccesskey)
{
return mOuter->GetAttribute("accesskey", aAccesskey);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetAccesskey(const nsString& aAccesskey)
{
return mOuter->SetAttribute("accesskey", aAccesskey);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetChecked(PRBool* aChecked)
{
nsAutoString value;
mOuter->GetAttribute("checked", value);
if(value.Equals("true"))
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("checked"), value);
if(value.EqualsWithConversion("true"))
*aChecked = PR_TRUE;
else
*aChecked = PR_FALSE;
@ -156,9 +156,9 @@ nsXULCheckboxElement::SetChecked(PRBool aChecked)
return NS_OK;
if(aChecked)
mOuter->SetAttribute("checked", "true");
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("checked"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute("checked");
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("checked"));
return NS_OK;
}
@ -167,8 +167,8 @@ NS_IMETHODIMP
nsXULCheckboxElement::GetDisabled(PRBool* aDisabled)
{
nsAutoString value;
mOuter->GetAttribute("disabled", value);
if(value.Equals("true"))
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("disabled"), value);
if(value.EqualsWithConversion("true"))
*aDisabled = PR_TRUE;
else
*aDisabled = PR_FALSE;
@ -180,9 +180,9 @@ NS_IMETHODIMP
nsXULCheckboxElement::SetDisabled(PRBool aDisabled)
{
if(aDisabled)
mOuter->SetAttribute("disabled", "true");
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("disabled"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute("disabled");
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("disabled"));
return NS_OK;
}

View File

@ -77,69 +77,69 @@ nsXULRadioElement::~nsXULRadioElement()
NS_IMETHODIMP
nsXULRadioElement::GetValue(nsString& aValue)
{
return mOuter->GetAttribute("value", aValue);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULRadioElement::SetValue(const nsString& aValue)
{
return mOuter->SetAttribute("value", aValue);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULRadioElement::GetCrop(nsString& aCrop)
{
return mOuter->GetAttribute("crop", aCrop);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULRadioElement::SetCrop(const nsString& aCrop)
{
return mOuter->SetAttribute("crop", aCrop);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULRadioElement::GetSrc(nsString& aSrc)
{
return mOuter->GetAttribute("src", aSrc);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULRadioElement::SetSrc(const nsString& aSrc)
{
return mOuter->SetAttribute("src", aSrc);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULRadioElement::GetImgalign(nsString& aImgalign)
{
return mOuter->GetAttribute("imgalign", aImgalign);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULRadioElement::SetImgalign(const nsString& aImgalign)
{
return mOuter->SetAttribute("imgalign", aImgalign);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULRadioElement::GetAccesskey(nsString& aAccesskey)
{
return mOuter->GetAttribute("accesskey", aAccesskey);
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULRadioElement::SetAccesskey(const nsString& aAccesskey)
{
return mOuter->SetAttribute("accesskey", aAccesskey);
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULRadioElement::GetChecked(PRBool* aChecked)
{
nsAutoString value;
mOuter->GetAttribute("checked", value);
if(value.Equals("true"))
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("checked"), value);
if(value.EqualsWithConversion("true"))
*aChecked = PR_TRUE;
else
*aChecked = PR_FALSE;
@ -151,9 +151,9 @@ NS_IMETHODIMP
nsXULRadioElement::SetChecked(PRBool aChecked)
{
if(aChecked)
mOuter->SetAttribute("checked", "true");
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("checked"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute("checked");
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("checked"));
return NS_OK;
}
@ -163,8 +163,8 @@ NS_IMETHODIMP
nsXULRadioElement::GetDisabled(PRBool* aDisabled)
{
nsAutoString value;
mOuter->GetAttribute("disabled", value);
if(value.Equals("true"))
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("disabled"), value);
if(value.EqualsWithConversion("true"))
*aDisabled = PR_TRUE;
else
*aDisabled = PR_FALSE;
@ -176,9 +176,9 @@ NS_IMETHODIMP
nsXULRadioElement::SetDisabled(PRBool aDisabled)
{
if(aDisabled)
mOuter->SetAttribute("disabled", "true");
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("disabled"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute("disabled");
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("disabled"));
return NS_OK;
}

View File

@ -3028,8 +3028,8 @@ nsXULTemplateBuilder::Init()
if (gRefCnt++ == 0) {
nsXULAtoms::AddRef();
trueStr = "true";
falseStr = "false";
trueStr.AssignWithConversion("true");
falseStr.AssignWithConversion("false");
nsresult rv;
@ -3049,11 +3049,11 @@ nsXULTemplateBuilder::Init()
static const char kRDFNameSpaceURI[]
= RDF_NAMESPACE_URI;
rv = gNameSpaceManager->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL);
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");
if (NS_FAILED(rv)) return rv;
rv = gNameSpaceManager->RegisterNameSpace(kRDFNameSpaceURI, kNameSpaceID_RDF);
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kRDFNameSpaceURI), kNameSpaceID_RDF);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
if (NS_FAILED(rv)) return rv;
@ -3742,10 +3742,10 @@ nsXULTemplateBuilder::SubstituteText(nsIRDFResource* aResource,
{
nsresult rv;
if (aAttributeValue.Equals("...") || aAttributeValue.Equals("rdf:*")) {
if (aAttributeValue.EqualsWithConversion("...") || aAttributeValue.EqualsWithConversion("rdf:*")) {
const char *uri = nsnull;
aResource->GetValueConst(&uri);
aAttributeValue = uri;
aAttributeValue.AssignWithConversion(uri);
}
else if (aMatch.mRule && aAttributeValue[0] == PRUnichar('?')) {
PRInt32 var = aMatch.mRule->LookupSymbol(aAttributeValue);
@ -3961,7 +3961,7 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
aMatch.mInstantiation.mBindings.GetBindingFor(aMatch.mRule->GetMemberVariable(), &member);
aChild = VALUE_TO_IRDFRESOURCE(member);
}
else if (uri.Equals("...") || uri.Equals("rdf:*")) {
else if (uri.EqualsWithConversion("...") || uri.EqualsWithConversion("rdf:*")) {
// If we -are- the resource element, then we are no
// matter unique.
isResourceElement = PR_TRUE;
@ -4056,7 +4056,7 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource URI");
if (NS_FAILED(rv)) return rv;
nsAutoString id(uri);
nsAutoString id; id.AssignWithConversion(uri);
rv = realKid->SetAttribute(kNameSpaceID_None, nsXULAtoms::id, id, PR_FALSE);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set id attribute");
if (NS_FAILED(rv)) return rv;
@ -4435,7 +4435,7 @@ nsXULTemplateBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
if (NS_FAILED(rv)) return rv;
if (property.get() == aProperty) {
nsAutoString text("");
nsAutoString text;
rv = gXULUtils->GetTextForNode(aValue, text);
if (NS_FAILED(rv)) return rv;
@ -5191,7 +5191,7 @@ nsXULTemplateBuilder::GetElementsForResource(nsIRDFResource* aResource, nsISuppo
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource URI");
if (NS_FAILED(rv)) return rv;
rv = mDocument->GetElementsForID(nsAutoString(uri), aElements);
rv = mDocument->GetElementsForID(NS_ConvertASCIItoUCS2(uri), aElements);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to retrieve elements from resource");
if (NS_FAILED(rv)) return rv;
@ -5283,7 +5283,7 @@ nsXULTemplateBuilder::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory*
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID.Append(nameSpace);
progID.AppendWithConversion(nameSpace.GetUnicode());
// Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);
@ -5381,7 +5381,7 @@ nsXULTemplateBuilder::ContentIdTestNode::FilterInstantiations(InstantiationSet&
rv = VALUE_TO_IRDFRESOURCE(idValue)->GetValueConst(&uri);
if (NS_FAILED(rv)) return rv;
rv = mDocument->GetElementsForID(nsAutoString(uri), elements);
rv = mDocument->GetElementsForID(NS_ConvertASCIItoUCS2(uri), elements);
if (NS_FAILED(rv)) return rv;
PRUint32 count;
@ -5746,10 +5746,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRule,
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
if (value.Equals("true")) {
if (value.EqualsWithConversion("true")) {
iscontainer = RDFContainerInstanceTestNode::eTrue;
}
else if (value.Equals("false")) {
else if (value.EqualsWithConversion("false")) {
iscontainer = RDFContainerInstanceTestNode::eFalse;
}
}
@ -5761,10 +5761,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRule,
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
if (value.Equals("true")) {
if (value.EqualsWithConversion("true")) {
isempty = RDFContainerInstanceTestNode::eTrue;
}
else if (value.Equals("false")) {
else if (value.EqualsWithConversion("false")) {
isempty = RDFContainerInstanceTestNode::eFalse;
}
}