зеркало из https://github.com/mozilla/pjs.git
fixing code that relied on implicit string construction
This commit is contained in:
Родитель
61d9f3abd8
Коммит
301746a559
|
@ -3648,7 +3648,7 @@ nsDocument::SaveFile(nsFileSpec* aFileSpec,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString charsetStr = aSaveCharset;
|
||||
nsAutoString charsetStr(aSaveCharset);
|
||||
if (charsetStr.Length() == 0)
|
||||
{
|
||||
rv = GetDocumentCharacterSet(charsetStr);
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
|
|||
else if (mUnit == eHTMLUnit_String) {
|
||||
if (mValue.mString) {
|
||||
PRInt32 err=0;
|
||||
nsAutoString str = mValue.mString; // XXX copy. new string APIs will make this better, right?
|
||||
nsAutoString str(mValue.mString); // XXX copy. new string APIs will make this better, right?
|
||||
return str.ToInteger(&err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1533,7 +1533,7 @@ nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 a
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> encoder;
|
||||
nsCAutoString formatType = NS_DOC_ENCODER_PROGID_BASE;
|
||||
nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE );
|
||||
formatType.AppendWithConversion(aFormatType);
|
||||
rv = nsComponentManager::CreateInstance(formatType,
|
||||
nsnull,
|
||||
|
|
|
@ -485,7 +485,7 @@ nsHTMLOptionElement::GetText(nsString& aText)
|
|||
// the option could be all spaces, so compress the white space
|
||||
// then make sure the length is greater than zero
|
||||
if (aText.Length() > 0) {
|
||||
nsAutoString compressText = aText;
|
||||
nsAutoString compressText(aText);
|
||||
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
if (compressText.Length() != 0) {
|
||||
aText = compressText;
|
||||
|
|
|
@ -3732,7 +3732,7 @@ HTMLContentSink::ProcessLink(nsIHTMLContent* aElement, const nsString& aLinkData
|
|||
}
|
||||
if (kNullCh != *equals) {
|
||||
*equals = kNullCh;
|
||||
nsAutoString attr = start;
|
||||
nsAutoString attr(start);
|
||||
attr.StripWhitespace();
|
||||
|
||||
PRUnichar* value = ++equals;
|
||||
|
@ -4238,7 +4238,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
if (!uriAttrib) {
|
||||
uri = baseURI;
|
||||
} else {
|
||||
rv = NS_NewURI(getter_AddRefs(uri), uriAttrib, baseURI);
|
||||
rv = NS_NewURI(getter_AddRefs(uri), nsAutoString(uriAttrib), baseURI);
|
||||
nsMemory::Free(uriAttrib);
|
||||
}
|
||||
|
||||
|
|
|
@ -1573,7 +1573,7 @@ NS_IMETHODIMP CSSLoaderImpl::SetCharset(/*in*/ const nsString &aCharsetSrc)
|
|||
} else {
|
||||
NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &rv);
|
||||
NS_ASSERTION(calias, "cannot find charset alias");
|
||||
nsAutoString charsetName = aCharsetSrc;
|
||||
nsAutoString charsetName(aCharsetSrc);
|
||||
if( NS_SUCCEEDED(rv) && (nsnull != calias))
|
||||
{
|
||||
PRBool same = PR_FALSE;
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
|
|||
else if (mUnit == eHTMLUnit_String) {
|
||||
if (mValue.mString) {
|
||||
PRInt32 err=0;
|
||||
nsAutoString str = mValue.mString; // XXX copy. new string APIs will make this better, right?
|
||||
nsAutoString str(mValue.mString); // XXX copy. new string APIs will make this better, right?
|
||||
return str.ToInteger(&err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
|
|||
else if (mUnit == eHTMLUnit_String) {
|
||||
if (mValue.mString) {
|
||||
PRInt32 err=0;
|
||||
nsAutoString str = mValue.mString; // XXX copy. new string APIs will make this better, right?
|
||||
nsAutoString str(mValue.mString); // XXX copy. new string APIs will make this better, right?
|
||||
return str.ToInteger(&err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ nsBindingManager::LoadBindingDocument(const nsString& aURL)
|
|||
// Load the binding doc.
|
||||
nsCString url; url.AssignWithConversion(aURL);
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
xblService->LoadBindingDocumentInfo(nsnull, url, "", PR_TRUE, getter_AddRefs(info));
|
||||
xblService->LoadBindingDocumentInfo(nsnull, url, nsCAutoString(), PR_TRUE, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -867,7 +867,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
|
||||
if (!getter.IsEmpty() && classObject) {
|
||||
rv = context->CompileFunction(classObject,
|
||||
"onget",
|
||||
nsCAutoString("onget"),
|
||||
0,
|
||||
nsnull,
|
||||
getter,
|
||||
|
@ -901,7 +901,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
|
||||
if (!setter.IsEmpty() && classObject) {
|
||||
rv = context->CompileFunction(classObject,
|
||||
"onset",
|
||||
nsCAutoString("onset"),
|
||||
1,
|
||||
gPropertyArg,
|
||||
setter,
|
||||
|
|
|
@ -320,7 +320,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
|
|||
nsCOMPtr<nsIURI> uri(mBindingDocument->GetDocumentURL());
|
||||
nsXPIDLCString str;
|
||||
uri->GetSpec(getter_Copies(str));
|
||||
bindingManager->RemoveLoadingDocListener((const char*)str);
|
||||
bindingManager->RemoveLoadingDocListener(nsCAutoString(NS_STATIC_CAST(const char*, str)));
|
||||
|
||||
nsCOMPtr<nsIContent> root = getter_AddRefs(mBindingDocument->GetRootContent());
|
||||
if (root)
|
||||
|
@ -592,7 +592,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aA
|
|||
}
|
||||
|
||||
if (!newBinding) {
|
||||
nsCAutoString str = "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ";
|
||||
nsCAutoString str( "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ");
|
||||
str.AppendWithConversion(aURL);
|
||||
NS_ERROR(str);
|
||||
return NS_OK;
|
||||
|
@ -1057,7 +1057,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIURI* aURI, cons
|
|||
boundDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsXPIDLCString uri;
|
||||
aURI->GetSpec(getter_Copies(uri));
|
||||
bindingManager->PutLoadingDocListener((const char*)uri, xblListener);
|
||||
bindingManager->PutLoadingDocListener(nsCAutoString(NS_STATIC_CAST(const char*, uri)), xblListener);
|
||||
|
||||
// Add our request.
|
||||
nsCAutoString bindingURI(uri);
|
||||
|
|
|
@ -2006,7 +2006,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
|
|||
nsAutoString nameSpace;
|
||||
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
|
||||
|
||||
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
|
||||
nsCAutoString progID( NS_ELEMENT_FACTORY_PROGID_PREFIX );
|
||||
progID.AppendWithConversion(nameSpace);
|
||||
|
||||
// Retrieve the appropriate factory.
|
||||
|
|
|
@ -3648,7 +3648,7 @@ nsDocument::SaveFile(nsFileSpec* aFileSpec,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString charsetStr = aSaveCharset;
|
||||
nsAutoString charsetStr(aSaveCharset);
|
||||
if (charsetStr.Length() == 0)
|
||||
{
|
||||
rv = GetDocumentCharacterSet(charsetStr);
|
||||
|
|
|
@ -1533,7 +1533,7 @@ nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 a
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> encoder;
|
||||
nsCAutoString formatType = NS_DOC_ENCODER_PROGID_BASE;
|
||||
nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE );
|
||||
formatType.AppendWithConversion(aFormatType);
|
||||
rv = nsComponentManager::CreateInstance(formatType,
|
||||
nsnull,
|
||||
|
|
|
@ -857,7 +857,7 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), absURL.GetUnicode(), nsnull);
|
||||
NS_NewURI(getter_AddRefs(uri), absURL, nsnull);
|
||||
|
||||
// Check for security
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
|
|
|
@ -1051,10 +1051,11 @@ nsObjectFrame::IsHidden() const
|
|||
// Yes, these are really the kooky ways that you could tell 4.x
|
||||
// not to hide the <embed> once you'd put the 'hidden' attribute
|
||||
// on the tag...
|
||||
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
|
||||
if (hidden.Length() &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("false")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("no")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("off"))) {
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("false")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("no")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("off"))) {
|
||||
// The <embed> or <applet> is hidden.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -1533,7 +1533,7 @@ nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 a
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> encoder;
|
||||
nsCAutoString formatType = NS_DOC_ENCODER_PROGID_BASE;
|
||||
nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE );
|
||||
formatType.AppendWithConversion(aFormatType);
|
||||
rv = nsComponentManager::CreateInstance(formatType,
|
||||
nsnull,
|
||||
|
|
|
@ -1051,10 +1051,11 @@ nsObjectFrame::IsHidden() const
|
|||
// Yes, these are really the kooky ways that you could tell 4.x
|
||||
// not to hide the <embed> once you'd put the 'hidden' attribute
|
||||
// on the tag...
|
||||
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
|
||||
if (hidden.Length() &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("false")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("no")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_LITERAL_STRING("off"))) {
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("false")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("no")) &&
|
||||
! hidden.EqualsIgnoreCase(NS_ConvertASCIItoUCS2("off"))) {
|
||||
// The <embed> or <applet> is hidden.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ nsHTMLOptionElement::GetText(nsString& aText)
|
|||
// the option could be all spaces, so compress the white space
|
||||
// then make sure the length is greater than zero
|
||||
if (aText.Length() > 0) {
|
||||
nsAutoString compressText = aText;
|
||||
nsAutoString compressText(aText);
|
||||
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
if (compressText.Length() != 0) {
|
||||
aText = compressText;
|
||||
|
|
|
@ -857,7 +857,7 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), absURL.GetUnicode(), nsnull);
|
||||
NS_NewURI(getter_AddRefs(uri), absURL, nsnull);
|
||||
|
||||
// Check for security
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
|
|
|
@ -3732,7 +3732,7 @@ HTMLContentSink::ProcessLink(nsIHTMLContent* aElement, const nsString& aLinkData
|
|||
}
|
||||
if (kNullCh != *equals) {
|
||||
*equals = kNullCh;
|
||||
nsAutoString attr = start;
|
||||
nsAutoString attr(start);
|
||||
attr.StripWhitespace();
|
||||
|
||||
PRUnichar* value = ++equals;
|
||||
|
@ -4238,7 +4238,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
if (!uriAttrib) {
|
||||
uri = baseURI;
|
||||
} else {
|
||||
rv = NS_NewURI(getter_AddRefs(uri), uriAttrib, baseURI);
|
||||
rv = NS_NewURI(getter_AddRefs(uri), nsAutoString(uriAttrib), baseURI);
|
||||
nsMemory::Free(uriAttrib);
|
||||
}
|
||||
|
||||
|
|
|
@ -1573,7 +1573,7 @@ NS_IMETHODIMP CSSLoaderImpl::SetCharset(/*in*/ const nsString &aCharsetSrc)
|
|||
} else {
|
||||
NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &rv);
|
||||
NS_ASSERTION(calias, "cannot find charset alias");
|
||||
nsAutoString charsetName = aCharsetSrc;
|
||||
nsAutoString charsetName(aCharsetSrc);
|
||||
if( NS_SUCCEEDED(rv) && (nsnull != calias))
|
||||
{
|
||||
PRBool same = PR_FALSE;
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRInt32 nsHTMLValue::GetIntValue(void) const
|
|||
else if (mUnit == eHTMLUnit_String) {
|
||||
if (mValue.mString) {
|
||||
PRInt32 err=0;
|
||||
nsAutoString str = mValue.mString; // XXX copy. new string APIs will make this better, right?
|
||||
nsAutoString str(mValue.mString); // XXX copy. new string APIs will make this better, right?
|
||||
return str.ToInteger(&err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1573,7 +1573,7 @@ NS_IMETHODIMP CSSLoaderImpl::SetCharset(/*in*/ const nsString &aCharsetSrc)
|
|||
} else {
|
||||
NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &rv);
|
||||
NS_ASSERTION(calias, "cannot find charset alias");
|
||||
nsAutoString charsetName = aCharsetSrc;
|
||||
nsAutoString charsetName(aCharsetSrc);
|
||||
if( NS_SUCCEEDED(rv) && (nsnull != calias))
|
||||
{
|
||||
PRBool same = PR_FALSE;
|
||||
|
|
|
@ -382,7 +382,7 @@ nsBindingManager::LoadBindingDocument(const nsString& aURL)
|
|||
// Load the binding doc.
|
||||
nsCString url; url.AssignWithConversion(aURL);
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
xblService->LoadBindingDocumentInfo(nsnull, url, "", PR_TRUE, getter_AddRefs(info));
|
||||
xblService->LoadBindingDocumentInfo(nsnull, url, nsCAutoString(), PR_TRUE, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -867,7 +867,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
|
||||
if (!getter.IsEmpty() && classObject) {
|
||||
rv = context->CompileFunction(classObject,
|
||||
"onget",
|
||||
nsCAutoString("onget"),
|
||||
0,
|
||||
nsnull,
|
||||
getter,
|
||||
|
@ -901,7 +901,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
|
||||
if (!setter.IsEmpty() && classObject) {
|
||||
rv = context->CompileFunction(classObject,
|
||||
"onset",
|
||||
nsCAutoString("onset"),
|
||||
1,
|
||||
gPropertyArg,
|
||||
setter,
|
||||
|
|
|
@ -320,7 +320,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
|
|||
nsCOMPtr<nsIURI> uri(mBindingDocument->GetDocumentURL());
|
||||
nsXPIDLCString str;
|
||||
uri->GetSpec(getter_Copies(str));
|
||||
bindingManager->RemoveLoadingDocListener((const char*)str);
|
||||
bindingManager->RemoveLoadingDocListener(nsCAutoString(NS_STATIC_CAST(const char*, str)));
|
||||
|
||||
nsCOMPtr<nsIContent> root = getter_AddRefs(mBindingDocument->GetRootContent());
|
||||
if (root)
|
||||
|
@ -592,7 +592,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aA
|
|||
}
|
||||
|
||||
if (!newBinding) {
|
||||
nsCAutoString str = "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ";
|
||||
nsCAutoString str( "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ");
|
||||
str.AppendWithConversion(aURL);
|
||||
NS_ERROR(str);
|
||||
return NS_OK;
|
||||
|
@ -1057,7 +1057,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIURI* aURI, cons
|
|||
boundDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsXPIDLCString uri;
|
||||
aURI->GetSpec(getter_Copies(uri));
|
||||
bindingManager->PutLoadingDocListener((const char*)uri, xblListener);
|
||||
bindingManager->PutLoadingDocListener(nsCAutoString(NS_STATIC_CAST(const char*, uri)), xblListener);
|
||||
|
||||
// Add our request.
|
||||
nsCAutoString bindingURI(uri);
|
||||
|
|
|
@ -2006,7 +2006,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
|
|||
nsAutoString nameSpace;
|
||||
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
|
||||
|
||||
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
|
||||
nsCAutoString progID( NS_ELEMENT_FACTORY_PROGID_PREFIX );
|
||||
progID.AppendWithConversion(nameSpace);
|
||||
|
||||
// Retrieve the appropriate factory.
|
||||
|
|
|
@ -136,7 +136,7 @@ nsPopupSetBoxObject::CreatePopup(nsIDOMElement* aSrcContent,
|
|||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
return popupFrame->CreatePopup(srcContent, popupContent, aXPos, aYPos, aPopupType, anAnchorAlignment, aPopupAlignment);
|
||||
return popupFrame->CreatePopup(srcContent, popupContent, aXPos, aYPos, nsAutoString(aPopupType), nsAutoString(anAnchorAlignment), nsAutoString(aPopupAlignment));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPopupSetBoxObject::GetActiveChild(nsIDOMElement** aResult)
|
||||
|
|
|
@ -441,7 +441,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin
|
|||
return;
|
||||
|
||||
// insert what character we can in.
|
||||
nsAutoString title = mTitle;
|
||||
nsAutoString title( mTitle );
|
||||
title.Truncate(i);
|
||||
mCroppedTitle.Insert(title, 0);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче