Changed to use do_GetService instead of CreateInstance, bug 30209, r=cata.

This commit is contained in:
nhotta%netscape.com 2000-03-15 23:31:08 +00:00
Родитель 518661ae56
Коммит 40dbdfc97f
3 изменённых файлов: 4 добавлений и 11 удалений

Просмотреть файл

@ -417,9 +417,7 @@ NS_IMETHODIMP nsFileWidget::Create(nsIWidget *aParent,
if (nsnull == gUnicodeEncoder) {
nsAutoString localeCharset;
nsCOMPtr <nsIPlatformCharset> platformCharset;
rv = nsComponentManager::CreateInstance(NS_PLATFORMCHARSET_PROGID, nsnull,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, localeCharset);
}

Просмотреть файл

@ -597,9 +597,7 @@ void nsMacControl::GetFileSystemCharset(nsString & fileSystemCharset)
nsresult rv;
if (aCharset.Length() < 1) {
nsCOMPtr <nsIPlatformCharset> platformCharset;
rv = nsComponentManager::CreateInstance(NS_PLATFORMCHARSET_PROGID, nsnull,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &rv);
if (NS_SUCCEEDED(rv))
rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset);

Просмотреть файл

@ -377,15 +377,13 @@ void nsFileWidget::GetFileSystemCharset(nsString & fileSystemCharset)
nsresult rv;
if (aCharset.Length() < 1) {
nsCOMPtr <nsIPlatformCharset> platformCharset;
rv = nsComponentManager::CreateInstance(NS_PLATFORMCHARSET_PROGID, nsnull,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &rv);
if (NS_SUCCEEDED(rv))
rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "error getting platform charset");
if (NS_FAILED(rv))
aCharset.Assign("ISO-8859-1");
aCharset.Assign("windows-1252");
}
fileSystemCharset = aCharset;
}
@ -424,7 +422,6 @@ char * nsFileWidget::ConvertToFileSystemCharset(const PRUnichar *inString)
}
}
NS_ASSERTION(NS_SUCCEEDED(rv), "error charset conversion");
return NS_SUCCEEDED(rv) ? outString : nsnull;
}