mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 02:31:41 +00:00
making string conversions explicit
This commit is contained in:
parent
8ffaada718
commit
3dfcdc8d37
@ -59,8 +59,6 @@ class nsMyObserver : public nsICharsetDetectionObserver
|
||||
mNotifyByReload = PR_FALSE;
|
||||
mWeakRefDocument = nsnull;
|
||||
mWeakRefParser = nsnull;
|
||||
mCommand ="";
|
||||
mCharset ="";
|
||||
}
|
||||
virtual ~nsMyObserver( void )
|
||||
{
|
||||
@ -94,13 +92,13 @@ NS_IMETHODIMP nsMyObserver::Notify(
|
||||
const char* aCharset, nsDetectionConfident aConf)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if(!mCharset.Equals(aCharset)) {
|
||||
if(!mCharset.EqualsWithConversion(aCharset)) {
|
||||
if(mNotifyByReload) {
|
||||
rv = mWebShellSvc->SetRendering( PR_FALSE);
|
||||
rv = mWebShellSvc->StopDocumentLoad();
|
||||
rv = mWebShellSvc->ReloadDocument(aCharset, kCharsetFromAutoDetection);
|
||||
} else {
|
||||
nsAutoString newcharset(aCharset);
|
||||
nsAutoString newcharset; newcharset.AssignWithConversion(aCharset);
|
||||
if(mWeakRefDocument) {
|
||||
mWeakRefDocument->SetDocumentCharacterSet(newcharset);
|
||||
}
|
||||
|
@ -241,8 +241,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
|
||||
else if(0 == nsCRT::strcasecmp((const PRUnichar*)keys.ObjectAt(i), "content"))
|
||||
contentValue=(const PRUnichar*)values.ObjectAt(i);
|
||||
}
|
||||
static nsAutoString contenttype("Content-Type");
|
||||
static nsAutoString texthtml("text/html");
|
||||
static nsAutoString contenttype = NS_ConvertToString("Content-Type");
|
||||
static nsAutoString texthtml = NS_ConvertToString("text/html");
|
||||
if((nsnull != httpEquivValue) &&
|
||||
(nsnull != contentValue) &&
|
||||
((0==nsCRT::strcasecmp(httpEquivValue,contenttype.GetUnicode())) ||
|
||||
@ -317,7 +317,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::Start()
|
||||
NS_WITH_SERVICE(nsIObserverService, anObserverService, NS_OBSERVERSERVICE_PROGID, &res);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsAutoString htmlTopic(kHTMLTextContentType);
|
||||
nsAutoString htmlTopic; htmlTopic.AssignWithConversion(kHTMLTextContentType);
|
||||
return anObserverService->AddObserver(this, htmlTopic.GetUnicode());
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
@ -328,7 +328,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::End()
|
||||
NS_WITH_SERVICE(nsIObserverService, anObserverService, NS_OBSERVERSERVICE_PROGID, &res);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsAutoString htmlTopic(kHTMLTextContentType);
|
||||
nsAutoString htmlTopic; htmlTopic.AssignWithConversion(kHTMLTextContentType);
|
||||
return anObserverService->RemoveObserver(this, htmlTopic.GetUnicode());
|
||||
}
|
||||
//==========================================================================
|
||||
|
@ -166,9 +166,9 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify(
|
||||
PRBool bGotCurrentCharsetSource = PR_FALSE;
|
||||
PRBool bGotEncoding = PR_FALSE;
|
||||
|
||||
nsAutoString currentCharset("unknown");
|
||||
nsAutoString charsetSourceStr("unknown");
|
||||
nsAutoString encoding("unknown");
|
||||
nsAutoString currentCharset; currentCharset.AssignWithConversion("unknown");
|
||||
nsAutoString charsetSourceStr; charsetSourceStr.AssignWithConversion("unknown");
|
||||
nsAutoString encoding; encoding.AssignWithConversion("unknown");
|
||||
|
||||
for(i=0; i < numOfAttributes; i++)
|
||||
{
|
||||
@ -246,7 +246,7 @@ NS_IMETHODIMP nsXMLEncodingObserver::Observe(nsISupports*, const PRUnichar*, con
|
||||
NS_IMETHODIMP nsXMLEncodingObserver::Start()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsAutoString xmlTopic("xmlparser");
|
||||
nsAutoString xmlTopic; xmlTopic.AssignWithConversion("xmlparser");
|
||||
nsIObserverService* anObserverService = nsnull;
|
||||
|
||||
res = nsServiceManager::GetService(NS_OBSERVERSERVICE_PROGID,
|
||||
@ -266,7 +266,7 @@ done:
|
||||
NS_IMETHODIMP nsXMLEncodingObserver::End()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsAutoString xmlTopic("xmlparser");
|
||||
nsAutoString xmlTopic; xmlTopic.AssignWithConversion("xmlparser");
|
||||
nsIObserverService* anObserverService = nsnull;
|
||||
|
||||
res = nsServiceManager::GetService(NS_OBSERVERSERVICE_PROGID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user