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

This commit is contained in:
nhotta%netscape.com 2000-03-17 01:45:28 +00:00
Родитель fdcf455115
Коммит ace08e002d
4 изменённых файлов: 8 добавлений и 22 удалений

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

@ -168,18 +168,14 @@ nsresult nsCollationMac::Initialize(nsILocale* locale)
nsAllocator::Free(aLocaleUnichar);
short scriptcode, langcode, regioncode;
nsCOMPtr <nsIMacLocale> macLocale;
res = nsComponentManager::CreateInstance(kMacLocaleFactoryCID, NULL,
NS_GET_IID(nsIMacLocale), getter_AddRefs(macLocale));
nsCOMPtr <nsIMacLocale> macLocale = do_GetService(kMacLocaleFactoryCID, &res);
if (NS_SUCCEEDED(res)) {
if (NS_SUCCEEDED(res = macLocale->GetPlatformLocale(&aLocale, &scriptcode, &langcode, &regioncode))) {
m_scriptcode = scriptcode;
}
}
nsCOMPtr <nsIPlatformCharset> platformCharset;
res = nsComponentManager::CreateInstance(kPlatformCharsetCID, NULL,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &res);
if (NS_SUCCEEDED(res)) {
PRUnichar* mappedCharset = NULL;
res = platformCharset->GetDefaultCharsetForLocale(aLocale.GetUnicode(), &mappedCharset);

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

@ -276,16 +276,12 @@ nsresult nsDateTimeFormatMac::Initialize(nsILocale* locale)
mLocale.SetString(aLocaleUnichar); // cache locale name
nsAllocator::Free(aLocaleUnichar);
nsCOMPtr <nsIMacLocale> macLocale;
res = nsComponentManager::CreateInstance(kMacLocaleFactoryCID, NULL,
NS_GET_IID(nsIMacLocale), getter_AddRefs(macLocale));
nsCOMPtr <nsIMacLocale> macLocale = do_GetService(kMacLocaleFactoryCID, &res);
if (NS_SUCCEEDED(res)) {
res = macLocale->GetPlatformLocale(&mLocale, &mScriptcode, &mLangcode, &mRegioncode);
}
nsCOMPtr <nsIPlatformCharset> platformCharset;
res = nsComponentManager::CreateInstance(kPlatformCharsetCID, NULL,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &res);
if (NS_SUCCEEDED(res)) {
PRUnichar* mappedCharset = NULL;
res = platformCharset->GetDefaultCharsetForLocale(mLocale.GetUnicode(), &mappedCharset);

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

@ -111,8 +111,7 @@ nsresult nsCollationWin::Initialize(nsILocale* locale)
nsAllocator::Free(aLocaleUnichar);
}
nsCOMPtr <nsIWin32Locale> win32Locale;
res = nsComponentManager::CreateInstance(kWin32LocaleFactoryCID, NULL, kIWin32LocaleIID, getter_AddRefs(win32Locale));
nsCOMPtr <nsIWin32Locale> win32Locale = do_GetService(kWin32LocaleFactoryCID, &res);
if (NS_SUCCEEDED(res)) {
LCID lcid;
res = win32Locale->GetPlatformLocale(&aLocale, &lcid);
@ -121,9 +120,7 @@ nsresult nsCollationWin::Initialize(nsILocale* locale)
}
}
nsCOMPtr <nsIPlatformCharset> platformCharset;
res = nsComponentManager::CreateInstance(kPlatformCharsetCID, NULL,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &res);
if (NS_SUCCEEDED(res)) {
PRUnichar* mappedCharset = NULL;
res = platformCharset->GetDefaultCharsetForLocale(aLocale.GetUnicode(), &mappedCharset);

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

@ -115,15 +115,12 @@ nsresult nsDateTimeFormatWin::Initialize(nsILocale* locale)
mLocale.Assign(aLocaleUnichar); // cache locale name
nsAllocator::Free(aLocaleUnichar);
nsCOMPtr <nsIWin32Locale> win32Locale;
res = nsComponentManager::CreateInstance(kWin32LocaleFactoryCID, NULL, kIWin32LocaleIID, getter_AddRefs(win32Locale));
nsCOMPtr <nsIWin32Locale> win32Locale = do_GetService(kWin32LocaleFactoryCID, &res);
if (NS_SUCCEEDED(res)) {
res = win32Locale->GetPlatformLocale(&mLocale, (LCID *) &mLCID);
}
nsCOMPtr <nsIPlatformCharset> platformCharset;
res = nsComponentManager::CreateInstance(kPlatformCharsetCID, NULL,
NS_GET_IID(nsIPlatformCharset), getter_AddRefs(platformCharset));
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_PROGID, &res);
if (NS_SUCCEEDED(res)) {
PRUnichar* mappedCharset = NULL;
res = platformCharset->GetDefaultCharsetForLocale(mLocale.GetUnicode(), &mappedCharset);