зеркало из https://github.com/mozilla/pjs.git
eliminating uses of deprecated nsComponentManager:: methods (bug 267040), r=bsmedberg
This commit is contained in:
Родитель
19e8c6ae88
Коммит
96c79cea45
|
@ -949,11 +949,7 @@ BookmarkParser::Parse(nsIRDFResource *aContainer, nsIRDFResource *aNodeType)
|
|||
// XXX this needs to handle quotes, etc. it'd be nice to use the real parser for this...
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
rv = nsComponentManager::CreateInstance(kRDFContainerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsCOMPtr<nsIRDFContainer> container = do_CreateInstance(kRDFContainerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = container->Init(mDataSource, aContainer);
|
||||
|
@ -2306,10 +2302,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
schedule,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
nsCOMPtr<nsISound> soundInterface;
|
||||
rv = nsComponentManager::CreateInstance(kSoundCID,
|
||||
nsnull, NS_GET_IID(nsISound),
|
||||
getter_AddRefs(soundInterface));
|
||||
nsCOMPtr<nsISound> soundInterface = do_CreateInstance(kSoundCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// for the moment, just beep
|
||||
|
@ -4940,10 +4933,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds,
|
|||
// rv is used for various functions
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
rv = nsComponentManager::CreateInstance(kRDFContainerCID, nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsCOMPtr<nsIRDFContainer> container = do_CreateInstance(kRDFContainerCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString indentation;
|
||||
|
|
|
@ -1085,10 +1085,7 @@ nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance(kRDFXMLDataSourceCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFDataSource),
|
||||
(void**) aResult);
|
||||
nsresult rv = CallCreateInstance(kRDFXMLDataSourceCID, aResult);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Seed the datasource with the ``chrome'' namespace
|
||||
|
@ -1468,10 +1465,7 @@ nsChromeRegistry::WriteInfoToDataSource(const char *aDocURI,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!container) {
|
||||
// Already exists. Create a container instead.
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
container = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = container->Init(dataSource, resource);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1510,13 +1504,9 @@ nsChromeRegistry::UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
|
|||
PRBool aIsOverlay,
|
||||
PRBool aUseProfile, PRBool aRemove)
|
||||
{
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
nsresult rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsCOMPtr<nsIRDFContainer> container = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = container->Init(aDataSource, aResource);
|
||||
|
@ -1624,11 +1614,8 @@ nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
|
|||
#endif
|
||||
|
||||
// Load the data source found at the base URL.
|
||||
nsCOMPtr<nsIRDFDataSource> dataSource;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kRDFXMLDataSourceCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFDataSource),
|
||||
(void**) getter_AddRefs(dataSource));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFDataSource> dataSource = do_CreateInstance(kRDFXMLDataSourceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(dataSource, &rv);
|
||||
|
@ -1773,11 +1760,7 @@ nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsCOMPtr<nsIRDFContainer> container = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = container->Init(dataSource, resource);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -1789,10 +1772,7 @@ nsChromeRegistry::InstallProvider(const nsACString& aProviderType,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!installContainer) {
|
||||
// Already exists. Create a container instead.
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(installContainer));
|
||||
installContainer = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = installContainer->Init(installSource, resource);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -2521,11 +2501,8 @@ nsChromeRegistry::GetArcs(nsIRDFDataSource* aDataSource,
|
|||
const nsACString& aType,
|
||||
nsISimpleEnumerator** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFContainer> container = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2556,10 +2533,8 @@ nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mChromeDataSource) {
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/datasource;1?name=composite-datasource",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFCompositeDataSource),
|
||||
getter_AddRefs(mChromeDataSource));
|
||||
mChromeDataSource = do_CreateInstance(
|
||||
"@mozilla.org/rdf/datasource;1?name=composite-datasource", &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -2933,11 +2908,8 @@ nsChromeRegistry::GetProviderCount(const nsACString& aProviderType, nsIRDFDataSo
|
|||
return 0;
|
||||
|
||||
// wrap it in a container
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
rv = nsComponentManager::CreateInstance("@mozilla.org/rdf/container;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIRDFContainer),
|
||||
getter_AddRefs(container));
|
||||
nsCOMPtr<nsIRDFContainer> container =
|
||||
do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
|
||||
if (NS_FAILED(rv)) return 0;
|
||||
|
||||
rv = container->Init(aDataSource, resource);
|
||||
|
|
|
@ -1429,14 +1429,8 @@ nsDocShell::GetDocumentCharsetInfo(nsIDocumentCharsetInfo **
|
|||
|
||||
// if the mDocumentCharsetInfo does not exist already, we create it now
|
||||
if (!mDocumentCharsetInfo) {
|
||||
nsresult res =
|
||||
nsComponentManager::CreateInstance(kDocumentCharsetInfoCID,
|
||||
NULL,
|
||||
NS_GET_IID
|
||||
(nsIDocumentCharsetInfo),
|
||||
getter_AddRefs
|
||||
(mDocumentCharsetInfo));
|
||||
if (NS_FAILED(res))
|
||||
mDocumentCharsetInfo = do_CreateInstance(kDocumentCharsetInfoCID);
|
||||
if (!mDocumentCharsetInfo)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1371,7 +1371,11 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
extern nsScriptNameSpaceManager *gNameSpaceManager;
|
||||
NS_ENSURE_TRUE(gNameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1398,15 +1402,15 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
getter_Copies(contractId));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCID cid;
|
||||
rv = nsComponentManager::ContractIDToClassID(contractId, &cid);
|
||||
|
||||
nsCID *cid;
|
||||
rv = registrar->ContractIDToCID(contractId, &cid);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Bad contract id registered with the script namespace manager");
|
||||
continue;
|
||||
}
|
||||
|
||||
rv = gNameSpaceManager->RegisterExternalClassName(categoryEntry.get(), cid);
|
||||
rv = gNameSpaceManager->RegisterExternalClassName(categoryEntry.get(), *cid);
|
||||
nsMemory::Free(cid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -4360,17 +4360,8 @@ GlobalWindowImpl::GetComputedStyle(nsIDOMElement* aElt,
|
|||
nsCOMPtr<nsIComputedDOMStyle> compStyle;
|
||||
|
||||
if (!sComputedDOMStyleFactory) {
|
||||
nsCID cid;
|
||||
rv = nsComponentManager::
|
||||
ContractIDToClassID("@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1",
|
||||
&cid);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsComponentManager::
|
||||
GetClassObject(cid, NS_GET_IID(nsIFactory),
|
||||
(void **)&sComputedDOMStyleFactory);
|
||||
|
||||
rv = CallGetClassObject("@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1",
|
||||
&sComputedDOMStyleFactory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -1964,10 +1964,7 @@ nsJSContext::FireGCTimer()
|
|||
return;
|
||||
}
|
||||
|
||||
nsComponentManager::CreateInstance("@mozilla.org/timer;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsITimer),
|
||||
(void **)&sGCTimer);
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sGCTimer);
|
||||
|
||||
if (!sGCTimer) {
|
||||
NS_WARNING("Failed to create timer");
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -190,9 +191,12 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
|
|||
const char *aCategory,
|
||||
nsGlobalNameStruct::nametype aType)
|
||||
{
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> e;
|
||||
nsresult rv = aCategoryManager->EnumerateCategory(aCategory,
|
||||
getter_AddRefs(e));
|
||||
rv = aCategoryManager->EnumerateCategory(aCategory, getter_AddRefs(e));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString categoryEntry;
|
||||
|
@ -215,9 +219,8 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
|
|||
getter_Copies(contractId));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCID cid;
|
||||
|
||||
rv = nsComponentManager::ContractIDToClassID(contractId, &cid);
|
||||
nsCID *cidPtr;
|
||||
rv = registrar->ContractIDToCID(contractId, &cidPtr);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Bad contract id registed with the script namespace manager");
|
||||
|
@ -225,6 +228,11 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
|
|||
continue;
|
||||
}
|
||||
|
||||
// Copy CID onto the stack, so we can free it right away and avoid having
|
||||
// to add cleanup code at every exit point from this loop/function.
|
||||
nsCID cid = *cidPtr;
|
||||
nsMemory::Free(cidPtr);
|
||||
|
||||
if (aType == nsGlobalNameStruct::eTypeExternalConstructor) {
|
||||
nsXPIDLCString constructorProto;
|
||||
rv = aCategoryManager->GetCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
|
||||
|
|
|
@ -807,9 +807,7 @@ nsJSProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
// CreateInstance.
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
|
|
@ -139,10 +139,7 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, PRBool aEnableSelection
|
|||
}
|
||||
}
|
||||
|
||||
rv = nsComponentManager::CreateInstance(NS_SPELLCHECKER_CONTRACTID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsISpellChecker),
|
||||
(void **)getter_AddRefs(mSpellChecker));
|
||||
mSpellChecker = do_CreateInstance(NS_SPELLCHECKER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mSpellChecker)
|
||||
|
|
|
@ -5096,10 +5096,7 @@ nsEditor::CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset,
|
|||
nsIDOMRange **aRange)
|
||||
{
|
||||
nsresult result;
|
||||
result = nsComponentManager::CreateInstance("@mozilla.org/content/range;1",
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDOMRange),
|
||||
(void **)aRange);
|
||||
result = CallCreateInstance("@mozilla.org/content/range;1", aRange);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
|
|
@ -1109,9 +1109,7 @@ NS_IMETHODIMP nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransfera
|
|||
PRBool aHavePrivFlavor)
|
||||
{
|
||||
// Create generic Transferable for getting the data
|
||||
nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/widget/transferable;1", nsnull,
|
||||
NS_GET_IID(nsITransferable),
|
||||
(void**)aTransferable);
|
||||
nsresult rv = CallCreateInstance("@mozilla.org/widget/transferable;1", aTransferable);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -472,9 +472,8 @@ NS_IMETHODIMP nsPlaintextEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPa
|
|||
// add the flavors for text editors
|
||||
for (const char* const* flavor = textEditorFlavors; *flavor; flavor++)
|
||||
{
|
||||
nsCOMPtr<nsISupportsCString> flavorString;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISupportsCString), getter_AddRefs(flavorString));
|
||||
nsCOMPtr<nsISupportsCString> flavorString =
|
||||
do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
|
||||
if (flavorString)
|
||||
{
|
||||
flavorString->SetData(nsDependentCString(*flavor));
|
||||
|
|
|
@ -786,16 +786,14 @@ quick_test(TestTransactionFactory *factory)
|
|||
printf("Create transaction manager instance ... ");
|
||||
|
||||
PRInt32 i, numitems = 0;
|
||||
nsITransactionManager *mgr = 0;
|
||||
nsCOMPtr<nsITransactionManager> mgr;
|
||||
nsITransaction *tx = 0;
|
||||
TestTransaction *tximpl = 0;
|
||||
nsITransaction *u1 = 0, *u2 = 0;
|
||||
nsITransaction *r1 = 0, *r2 = 0;
|
||||
nsresult result;
|
||||
|
||||
result = nsComponentManager::CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsITransactionManager), (void **)&mgr);
|
||||
|
||||
mgr = do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mgr) {
|
||||
printf("ERROR: Failed to create Transaction Manager instance.\n");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -2670,13 +2668,6 @@ quick_test(TestTransactionFactory *factory)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = mgr->Release();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: nsITransactionManager Release() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -2776,16 +2767,14 @@ quick_batch_test(TestTransactionFactory *factory)
|
|||
printf("Create transaction manager instance ... ");
|
||||
|
||||
PRInt32 i, numitems = 0;
|
||||
nsITransactionManager *mgr = 0;
|
||||
nsCOMPtr<nsITransactionManager> mgr;
|
||||
nsITransaction *tx = 0;
|
||||
TestTransaction *tximpl = 0;
|
||||
nsITransaction *u1 = 0, *u2 = 0;
|
||||
nsITransaction *r1 = 0, *r2 = 0;
|
||||
nsresult result;
|
||||
|
||||
result = nsComponentManager::CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsITransactionManager), (void **)&mgr);
|
||||
|
||||
mgr = do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mgr) {
|
||||
printf("ERROR: Failed to create Transaction Manager instance.\n");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -4381,13 +4370,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = mgr->Release();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: nsITransactionManager Release() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -4489,13 +4471,11 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
|
|||
fflush(stdout);
|
||||
|
||||
PRInt32 i, j;
|
||||
nsITransactionManager *mgr = 0;
|
||||
nsCOMPtr<nsITransactionManager> mgr;
|
||||
nsITransaction *tx = 0;
|
||||
nsresult result;
|
||||
|
||||
result = nsComponentManager::CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsITransactionManager), (void **)&mgr);
|
||||
|
||||
mgr = do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mgr) {
|
||||
printf("ERROR: Failed to create Transaction Manager instance.\n");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -4578,13 +4558,6 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
|
|||
}
|
||||
}
|
||||
|
||||
result = mgr->Release();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: nsITransactionManager Release() failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// printf("%d %d - ", sConstructorCount, sDestructorCount);
|
||||
|
||||
if (sConstructorCount != sDestructorCount) {
|
||||
|
|
|
@ -2773,10 +2773,7 @@ nsTextServicesDocument::CreateDocumentContentRange(nsIDOMRange **aRange)
|
|||
if (!node)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
result = nsComponentManager::CreateInstance("@mozilla.org/content/range;1", nsnull,
|
||||
NS_GET_IID(nsIDOMRange),
|
||||
(void **)aRange);
|
||||
|
||||
result = CallCreateInstance("@mozilla.org/content/range;1", aRange);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
@ -2863,10 +2860,7 @@ nsTextServicesDocument::CreateDocumentContentRootToNodeOffsetRange(nsIDOMNode *a
|
|||
}
|
||||
}
|
||||
|
||||
result = nsComponentManager::CreateInstance("@mozilla.org/content/range;1", nsnull,
|
||||
NS_GET_IID(nsIDOMRange),
|
||||
(void **)aRange);
|
||||
|
||||
result = CallCreateInstance("@mozilla.org/content/range;1", aRange);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
@ -4044,10 +4038,7 @@ nsTextServicesDocument::CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffs
|
|||
{
|
||||
nsresult result;
|
||||
|
||||
result = nsComponentManager::CreateInstance("@mozilla.org/content/range;1", nsnull,
|
||||
NS_GET_IID(nsIDOMRange),
|
||||
(void **)aRange);
|
||||
|
||||
result = CallCreateInstance("@mozilla.org/content/range;1", aRange);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
|
|
@ -1048,20 +1048,27 @@ HRESULT CMozillaBrowser::Initialize()
|
|||
nsCOMPtr<nsIFactory> promptFactory;
|
||||
rv = NS_NewPromptServiceFactory(getter_AddRefs(promptFactory));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsComponentManager::RegisterFactory(kPromptServiceCID,
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = registrar->RegisterFactory(kPromptServiceCID,
|
||||
"Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
promptFactory,
|
||||
PR_TRUE); // replace existing
|
||||
promptFactory);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Helper app launcher dialog
|
||||
nsCOMPtr<nsIFactory> helperAppDlgFactory;
|
||||
rv = NS_NewHelperAppLauncherDlgFactory(getter_AddRefs(helperAppDlgFactory));
|
||||
rv = nsComponentManager::RegisterFactory(kHelperAppLauncherDialogCID,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = registrar->RegisterFactory(kHelperAppLauncherDialogCID,
|
||||
"Helper App Launcher Dialog",
|
||||
"@mozilla.org/helperapplauncherdialog;1",
|
||||
helperAppDlgFactory,
|
||||
PR_TRUE); // replace existing
|
||||
helperAppDlgFactory);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// create our local object
|
||||
CWindowCreator *creator = new CWindowCreator();
|
||||
|
|
|
@ -98,11 +98,16 @@ nsCocoaBrowserService::InitEmbedding()
|
|||
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
|
||||
static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID);
|
||||
|
||||
rv = nsComponentManager::RegisterFactory(kPromptServiceCID,
|
||||
"Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
sSingleton,
|
||||
PR_TRUE); // replace existing
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = registrar->RegisterFactory(kPromptServiceCID,
|
||||
"Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
sSingleton);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -1125,9 +1125,12 @@ PtWidgetClass_t *PtCreateMozillaClass( void )
|
|||
|
||||
nsCOMPtr<nsIFactory> promptFactory;
|
||||
NS_NewPromptServiceFactory(getter_AddRefs(promptFactory));
|
||||
nsComponentManager::RegisterFactory(kPromptServiceCID, "Prompt Service",
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
registrar->RegisterFactory(kPromptServiceCID, "Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
promptFactory, PR_TRUE); // replace existing
|
||||
promptFactory);
|
||||
PtMozilla->wclass = PtCreateWidgetClass(PtContainer, 0, sizeof(args)/sizeof(args[0]), args);
|
||||
|
||||
return (PtMozilla->wclass);
|
||||
|
|
|
@ -218,10 +218,14 @@ int Init_nsUnknownContentTypeHandler_Factory( ) {
|
|||
// create a generic factory for UnkHandler
|
||||
nsCOMPtr<nsIGenericFactory> factory;
|
||||
rv = NS_NewGenericFactory( getter_AddRefs(factory), info );
|
||||
if (rv != NS_OK)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// register this factory with the component manager.
|
||||
rv = nsComponentManager::RegisterFactory( kCID, "nsUnknownContentTypeHandler", NS_IHELPERAPPLAUNCHERDLG_CONTRACTID, factory, PR_TRUE);
|
||||
// register this factory with the component registrar.
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = registrar->RegisterFactory( kCID, "nsUnknownContentTypeHandler", NS_IHELPERAPPLAUNCHERDLG_CONTRACTID, factory);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -76,10 +76,7 @@ public:
|
|||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(
|
||||
NS_DIALOGPARAMBLOCK_CONTRACTID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
|
|
@ -71,10 +71,7 @@ public:
|
|||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(
|
||||
NS_DIALOGPARAMBLOCK_CONTRACTID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
|
|
@ -93,10 +93,7 @@ public:
|
|||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(
|
||||
NS_DIALOGPARAMBLOCK_CONTRACTID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsIStorageStream.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
|
@ -1399,11 +1400,16 @@ nsWebBrowserPersist::GetDocEncoderContentType(nsIDOMDocument *aDocument, const P
|
|||
nsCAutoString contractID(NS_DOC_ENCODER_CONTRACTID_BASE);
|
||||
contractID.AppendWithConversion(contentType);
|
||||
|
||||
nsCID cid;
|
||||
nsresult rv = nsComponentManager::ContractIDToClassID(contractID.get(), &cid);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (registrar)
|
||||
{
|
||||
*aRealContentType = ToNewUnicode(contentType);
|
||||
PRBool result;
|
||||
nsresult rv = registrar->IsContractIDRegistered(contractID.get(), &result);
|
||||
if (NS_SUCCEEDED(rv) && result)
|
||||
{
|
||||
*aRealContentType = ToNewUnicode(contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,10 +72,7 @@ public:
|
|||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(
|
||||
NS_DIALOGPARAMBLOCK_CONTRACTID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "ProfileMgr.h"
|
||||
#include "BrowserView.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "plstr.h"
|
||||
#include "Preferences.h"
|
||||
#include <io.h>
|
||||
|
@ -175,12 +176,15 @@ nsresult CTestEmbedApp::OverrideComponents()
|
|||
|
||||
nsCOMPtr<nsIFactory> promptFactory;
|
||||
rv = MakeFactory(getter_AddRefs(promptFactory));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsComponentManager::RegisterFactory(kPromptServiceCID,
|
||||
"Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
promptFactory,
|
||||
PR_TRUE); // replace existing
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (registrar)
|
||||
registrar->RegisterFactory(kPromptServiceCID,
|
||||
"Prompt Service",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
promptFactory);
|
||||
}
|
||||
} else
|
||||
::FreeLibrary(overlib);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
@ -152,8 +153,11 @@ nsresult GeckoProtocolHandler::RegisterHandler(const char *aScheme, const char *
|
|||
// Create a factory object which will create the protocol handler on demand
|
||||
nsCOMPtr<nsIGenericFactory> factory;
|
||||
NS_NewGenericFactory(getter_AddRefs(factory), &ci);
|
||||
nsComponentManager::RegisterFactory(
|
||||
cid, aDescription, contractID.get(), factory, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (registrar)
|
||||
registrar->RegisterFactory(cid, aDescription, contractID.get(), factory);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -224,9 +228,8 @@ NS_IMETHODIMP GeckoProtocolHandlerImpl::GetProtocolFlags(PRUint32 *aProtocolFlag
|
|||
NS_IMETHODIMP GeckoProtocolHandlerImpl::NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI *aBaseURI, nsIURI **_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIURI* url = nsnull;
|
||||
rv = nsComponentManager::CreateInstance(
|
||||
kSimpleURICID, nsnull, NS_GET_IID(nsIURI), (void**) &url);
|
||||
nsIURI* url;
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = url->SetSpec(aSpec);
|
||||
|
|
|
@ -102,10 +102,9 @@ nsDateTimeHandler::NewURI(const nsACString &aSpec,
|
|||
nsresult rv;
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
|
|
|
@ -104,10 +104,9 @@ nsFingerHandler::NewURI(const nsACString &aSpec,
|
|||
nsresult rv;
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
|
|
|
@ -81,10 +81,7 @@ mozSqlResult::Init()
|
|||
(nsISupports**) &gRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
(void**) &gFormat);
|
||||
rv = CallCreateInstance(kDateTimeFormatCID, &gFormat);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING("SQL:ResultRoot"),
|
||||
|
|
|
@ -80,11 +80,7 @@ nsresult GetDetector(const char* key, nsICharsetDetector** det)
|
|||
char buf[128];
|
||||
strcpy(buf, NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||
strcat(buf, key);
|
||||
return nsComponentManager::CreateInstance(
|
||||
buf,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICharsetDetector),
|
||||
(void**)det);
|
||||
return CallCreateInstance(buf, det);
|
||||
}
|
||||
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -346,10 +346,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::GetDeviceContextFor(nsIDeviceContextSpec *aDe
|
|||
nsresult rv;
|
||||
nsIDeviceContextPS *dcps;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCDeviceContextPS,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDeviceContextPS),
|
||||
(void **)&dcps);
|
||||
rv = CallCreateInstance(kCDeviceContextPS, &dcps);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't create PS Device context");
|
||||
|
||||
|
|
|
@ -3012,8 +3012,7 @@ nsFontGTKSubstitute::Convert(const PRUnichar* aSrc, PRUint32 aSrcLen,
|
|||
{
|
||||
nsresult res;
|
||||
if (!gFontSubConverter) {
|
||||
nsComponentManager::CreateInstance(kSaveAsCharsetCID, nsnull,
|
||||
NS_GET_IID(nsISaveAsCharset), (void**) &gFontSubConverter);
|
||||
CallCreateInstance(kSaveAsCharsetCID, &gFontSubConverter);
|
||||
if (gFontSubConverter) {
|
||||
res = gFontSubConverter->Init("ISO-8859-1",
|
||||
nsISaveAsCharset::attr_FallbackQuestionMark +
|
||||
|
|
|
@ -692,9 +692,8 @@ PRBool nsUnicodeRenderingToolkit :: LoadTransliterator()
|
|||
return PR_TRUE;
|
||||
|
||||
nsresult res;
|
||||
if ( NS_SUCCEEDED(nsComponentManager::CreateInstance(
|
||||
kSaveAsCharsetCID, 0, NS_GET_IID(nsISaveAsCharset),
|
||||
getter_AddRefs(mTrans) ) ) )
|
||||
mTrans = do_CreateInstance(kSaveAsCharsetCID, &res);
|
||||
if ( NS_SUCCEEDED(res) )
|
||||
{
|
||||
res = mTrans->Init("x-mac-roman",
|
||||
nsISaveAsCharset::attr_FallbackQuestionMark +
|
||||
|
|
|
@ -144,8 +144,7 @@ nsFontListEnumerator::GetNext(nsISupports **aFont)
|
|||
PRUnichar *fontName = mFonts[mIndex++];
|
||||
nsCOMPtr<nsISupportsString> fontNameWrapper;
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISupportsString), getter_AddRefs(fontNameWrapper));
|
||||
fontNameWrapper = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(fontNameWrapper, NS_ERROR_OUT_OF_MEMORY);
|
||||
fontNameWrapper->SetData(nsDependentString(fontName));
|
||||
|
|
|
@ -220,8 +220,7 @@ NS_IMETHODIMP nsPrinterListEnumerator::GetNext(nsISupports **aPrinter)
|
|||
nsCOMPtr<nsISupportsString> printerNameWrapper;
|
||||
nsresult rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISupportsString), getter_AddRefs(printerNameWrapper));
|
||||
printerNameWrapper = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(printerNameWrapper, NS_ERROR_OUT_OF_MEMORY);
|
||||
printerNameWrapper->SetData(nsDependentString(printerName));
|
||||
|
|
|
@ -2495,9 +2495,7 @@ SubstituteChars(const PRUnichar* aString,
|
|||
{
|
||||
nsresult res;
|
||||
if (!gFontSubstituteConverter) {
|
||||
nsComponentManager::CreateInstance(NS_SAVEASCHARSET_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISaveAsCharset),
|
||||
(void**)&gFontSubstituteConverter);
|
||||
CallCreateInstance(NS_SAVEASCHARSET_CONTRACTID, &gFontSubstituteConverter);
|
||||
if (gFontSubstituteConverter) {
|
||||
res = gFontSubstituteConverter->Init("ISO-8859-1",
|
||||
nsISaveAsCharset::attr_EntityAfterCharsetConv +
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDeviceContextSpecFactoryP.h"
|
||||
#include "nsDeviceContextSpecPh.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIPrintOptions.h"
|
||||
|
||||
#include <Pt.h>
|
||||
#include "nsPhGfxLog.h"
|
||||
|
||||
nsDeviceContextSpecFactoryPh :: nsDeviceContextSpecFactoryPh()
|
||||
{
|
||||
}
|
||||
|
||||
nsDeviceContextSpecFactoryPh :: ~nsDeviceContextSpecFactoryPh()
|
||||
{
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
|
||||
static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecFactoryPh, nsIDeviceContextSpecFactory)
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: Init(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX this method needs to do what the API says...
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aQuiet)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidget);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIDeviceContextSpec *devSpec = nsnull;
|
||||
|
||||
nsComponentManager::CreateInstance(kDeviceContextSpecCID, nsnull, kIDeviceContextSpecIID, (void **)&devSpec);
|
||||
|
||||
if (devSpec != nsnull)
|
||||
{
|
||||
nsDeviceContextSpecPh* specPh = NS_STATIC_CAST(nsDeviceContextSpecPh*, devSpec);
|
||||
rv = specPh->Init(aWidget, aPrintSettings, aQuiet);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aNewSpec = devSpec;
|
||||
} else {
|
||||
NS_RELEASE(devSpec);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDeviceContextSpecFactoryW.h"
|
||||
#include "nsDeviceContextSpecWin.h"
|
||||
#include "nsGfxCIID.h"
|
||||
|
||||
nsDeviceContextSpecFactoryWin :: nsDeviceContextSpecFactoryWin()
|
||||
{
|
||||
}
|
||||
|
||||
nsDeviceContextSpecFactoryWin :: ~nsDeviceContextSpecFactoryWin()
|
||||
{
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
|
||||
static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecFactoryWin, nsIDeviceContextSpecFactory)
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: Init(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX this method needs to do what the API says...
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidget);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIDeviceContextSpec* devspec = nsnull;
|
||||
|
||||
nsComponentManager::CreateInstance(kDeviceContextSpecCID, nsnull, kIDeviceContextSpecIID, (void **)&devspec);
|
||||
|
||||
if (nsnull != devspec){
|
||||
nsDeviceContextSpecWin* specWin = NS_STATIC_CAST(nsDeviceContextSpecWin*, devspec);
|
||||
rv = specWin->Init(aWidget, aPrintSettings, aIsPrintPreview);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aNewSpec = devspec;
|
||||
} else {
|
||||
NS_RELEASE(devspec);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
|
@ -304,7 +304,7 @@ NS_IMETHODIMP nsDeviceContextWin :: CreateRenderingContext(nsIRenderingContext *
|
|||
nsresult rv;
|
||||
nsDrawingSurfaceWin *surf;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kRCCID,nsnull,NS_GET_IID(nsIRenderingContext),(void**)&pContext);
|
||||
rv = CallCreateInstance(kRCCID, &pContext);
|
||||
|
||||
if ( (NS_SUCCEEDED(rv)) && (nsnull != pContext))
|
||||
{
|
||||
|
|
|
@ -4345,10 +4345,7 @@ SubstituteChars(PRBool aDisplayUnicode,
|
|||
{
|
||||
nsresult res;
|
||||
if (!gFontSubstituteConverter) {
|
||||
nsComponentManager::
|
||||
CreateInstance(NS_SAVEASCHARSET_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISaveAsCharset),
|
||||
(void**)&gFontSubstituteConverter);
|
||||
CallCreateInstance(NS_SAVEASCHARSET_CONTRACTID, &gFontSubstituteConverter);
|
||||
if (gFontSubstituteConverter) {
|
||||
// if aDisplayUnicode is set: transliterate, and then fallback
|
||||
// to literal Unicode points &#xNNNN; for unknown characters
|
||||
|
|
|
@ -370,7 +370,7 @@ nsresult CoverageTest(int *argc, char **argv)
|
|||
//
|
||||
// Create Device Context based on main window
|
||||
//
|
||||
res = nsComponentManager::CreateInstance(kDeviceContextCID, nsnull, kDeviceContextIID, (void **)&deviceContext);
|
||||
res = CallCreateInstance(kDeviceContextCID, &deviceContext);
|
||||
|
||||
if (NS_OK == res)
|
||||
{
|
||||
|
|
|
@ -283,11 +283,7 @@ nsresult GetDetector(const char* key, nsICharsetDetector** det)
|
|||
char buf[128];
|
||||
strcpy(buf, NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||
strcat(buf, key);
|
||||
return nsComponentManager::CreateInstance(
|
||||
buf,
|
||||
nsnull,
|
||||
NS_GET_IID(nsICharsetDetector),
|
||||
(void**)det);
|
||||
return CallCreateInstance(buf, det);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -187,10 +187,7 @@ static void TestCollation(nsILocale *locale)
|
|||
printf("Start nsICollation Test \n");
|
||||
printf("==============================\n");
|
||||
|
||||
res = nsComponentManager::CreateInstance(kCollationFactoryCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsICollationFactory),
|
||||
(void**) &f);
|
||||
res = CallCreateInstance(kCollationFactoryCID, &f);
|
||||
|
||||
printf("Test 1 - CreateInstance():\n");
|
||||
if(NS_FAILED(res) || ( f == NULL ) ) {
|
||||
|
@ -199,10 +196,7 @@ static void TestCollation(nsILocale *locale)
|
|||
f->Release();
|
||||
}
|
||||
|
||||
res = nsComponentManager::CreateInstance(kCollationFactoryCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsICollationFactory),
|
||||
(void**) &f);
|
||||
res = CallCreateInstance(kCollationFactoryCID, &f);
|
||||
if(NS_FAILED(res) || ( f == NULL ) ) {
|
||||
printf("\t2nd CreateInstance failed\n");
|
||||
}
|
||||
|
@ -576,10 +570,7 @@ static void TestSort(nsILocale *locale, PRInt32 collationStrength, FILE *fp)
|
|||
printf("Start sort Test \n");
|
||||
printf("==============================\n");
|
||||
|
||||
res = nsComponentManager::CreateInstance(kCollationFactoryCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsICollationFactory),
|
||||
(void**) &factoryInst);
|
||||
res = CallCreateInstance(kCollationFactoryCID, &factoryInst);
|
||||
if(NS_FAILED(res)) {
|
||||
printf("\tFailed!! return value != NS_OK\n");
|
||||
}
|
||||
|
@ -696,10 +687,7 @@ static void TestDateTimeFormat(nsILocale *locale)
|
|||
printf("==============================\n");
|
||||
|
||||
nsIScriptableDateFormat *aScriptableDateFormat;
|
||||
res = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsIScriptableDateFormat),
|
||||
(void**) &aScriptableDateFormat);
|
||||
res = CallCreateInstance(kDateTimeFormatCID, &aScriptableDateFormat);
|
||||
if(NS_FAILED(res) || ( aScriptableDateFormat == NULL ) ) {
|
||||
printf("\tnsIScriptableDateFormat CreateInstance failed\n");
|
||||
}
|
||||
|
@ -742,10 +730,7 @@ static void TestDateTimeFormat(nsILocale *locale)
|
|||
printf("==============================\n");
|
||||
|
||||
nsIDateTimeFormat *t = NULL;
|
||||
res = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
(void**) &t);
|
||||
res = CallCreateInstance(kDateTimeFormatCID, &t);
|
||||
|
||||
printf("Test 1 - CreateInstance():\n");
|
||||
if(NS_FAILED(res) || ( t == NULL ) ) {
|
||||
|
@ -754,10 +739,7 @@ static void TestDateTimeFormat(nsILocale *locale)
|
|||
t->Release();
|
||||
}
|
||||
|
||||
res = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
(void**) &t);
|
||||
res = CallCreateInstance(kDateTimeFormatCID, &t);
|
||||
|
||||
if(NS_FAILED(res) || ( t == NULL ) ) {
|
||||
printf("\t2nd CreateInstance failed\n");
|
||||
|
@ -841,10 +823,9 @@ static void TestDateTimeFormat(nsILocale *locale)
|
|||
|
||||
static nsresult NewLocale(const nsString* localeName, nsILocale** locale)
|
||||
{
|
||||
nsCOMPtr<nsILocaleFactory> localeFactory;
|
||||
nsresult res;
|
||||
|
||||
res = nsComponentManager::FindFactory(kLocaleFactoryCID, getter_AddRefs(localeFactory));
|
||||
nsCOMPtr<nsILocaleFactory> localeFactory = do_GetClassObject(kLocaleFactoryCID, &res);
|
||||
if (NS_FAILED(res) || localeFactory == nsnull) printf("FindFactory nsILocaleFactory failed\n");
|
||||
|
||||
res = localeFactory->NewLocale(localeName, locale);
|
||||
|
@ -1019,9 +1000,7 @@ int main(int argc, char** argv) {
|
|||
nsCOMPtr<nsILocale> locale;
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsILocaleFactory> localeFactory;
|
||||
|
||||
res = nsComponentManager::FindFactory(kLocaleFactoryCID, getter_AddRefs(localeFactory));
|
||||
nsCOMPtr<nsILocaleFactory> localeFactory = do_GetClassObject(kLocaleFactoryCID, &res);
|
||||
if (NS_FAILED(res) || localeFactory == nsnull) printf("FindFactory nsILocaleFactory failed\n");
|
||||
|
||||
res = localeFactory->GetApplicationLocale(getter_AddRefs(locale));
|
||||
|
@ -1096,11 +1075,5 @@ int main(int argc, char** argv) {
|
|||
|
||||
printf("Finish All The Test Cases\n");
|
||||
|
||||
res = nsComponentManager::FreeLibraries();
|
||||
if(NS_FAILED(res))
|
||||
printf("nsComponentManager failed\n");
|
||||
else
|
||||
printf("nsComponentManager FreeLibraries Done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -585,13 +585,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
// --------------------------------------------
|
||||
printf("Finish All The Test Cases\n");
|
||||
nsresult res = NS_OK;
|
||||
res = nsComponentManager::FreeLibraries();
|
||||
|
||||
if(NS_FAILED(res))
|
||||
printf("nsComponentManager failed\n");
|
||||
else
|
||||
printf("nsComponentManager FreeLibraries Done\n");
|
||||
if(lbok && wbok)
|
||||
printf("Line/Word Break Test\nOK\n");
|
||||
else
|
||||
|
|
|
@ -164,9 +164,7 @@ NS_IMETHODIMP nsUnicodeToISO2022JP::FillInfo(PRUint32* aInfo)
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
return mHelper->FillInfo(aInfo,
|
||||
|
@ -183,9 +181,7 @@ NS_IMETHODIMP nsUnicodeToISO2022JP::ConvertNoBuffNoErr(
|
|||
nsresult res = NS_OK;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,9 +238,7 @@ NS_IMETHODIMP nsTableDecoderSupport::ConvertNoBuff(const char * aSrc,
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeDecodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeDecodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
}
|
||||
|
||||
|
@ -283,9 +281,7 @@ NS_IMETHODIMP nsMultiTableDecoderSupport::ConvertNoBuff(const char * aSrc,
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeDecodeHelper), (void**) &mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeDecodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
}
|
||||
|
||||
|
@ -323,8 +319,7 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Convert(const char * aSrc,
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeDecodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeDecodeHelper), (void**) &mHelper);
|
||||
res = CallCreateInstance(kUnicodeDecodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UDEC_NOHELPER;
|
||||
|
||||
res = mHelper -> CreateFastTable(mShiftTable, mMappingTable, mFastTable,
|
||||
|
@ -621,9 +616,7 @@ NS_IMETHODIMP nsTableEncoderSupport::FillInfo(PRUint32 *aInfo)
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
|
@ -642,9 +635,7 @@ NS_IMETHODIMP nsTableEncoderSupport::ConvertNoBuffNoErr(
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
|
@ -679,9 +670,7 @@ NS_IMETHODIMP nsMultiTableEncoderSupport::FillInfo(PRUint32 *aInfo)
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
|
@ -700,9 +689,7 @@ NS_IMETHODIMP nsMultiTableEncoderSupport::ConvertNoBuffNoErr(
|
|||
nsresult res;
|
||||
|
||||
if (mHelper == nsnull) {
|
||||
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
|
||||
NS_GET_IID(nsIUnicodeEncodeHelper), (void**) & mHelper);
|
||||
|
||||
res = CallCreateInstance(kUnicodeEncodeHelperCID, &mHelper);
|
||||
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
|
||||
}
|
||||
|
||||
|
|
|
@ -391,11 +391,9 @@ static void TestEntityConversion(PRUint32 version)
|
|||
uChar = (PRUnichar) 9830; //
|
||||
inString.Append(&uChar, 1);
|
||||
|
||||
nsCOMPtr <nsIEntityConverter> entityConv;
|
||||
res = nsComponentManager::CreateInstance(kEntityConverterCID, NULL, NS_GET_IID(nsIEntityConverter), getter_AddRefs(entityConv));
|
||||
nsCOMPtr <nsIEntityConverter> entityConv = do_CreateInstance(kEntityConverterCID, &res);;
|
||||
if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n"); return;}
|
||||
|
||||
|
||||
// convert char by char
|
||||
for (i = 0; i < inString.Length(); i++) {
|
||||
char *entity = NULL;
|
||||
|
@ -441,8 +439,7 @@ static void TestSaveAsCharset()
|
|||
}
|
||||
printf("\n");
|
||||
|
||||
nsCOMPtr <nsISaveAsCharset> saveAsCharset;
|
||||
res = nsComponentManager::CreateInstance(kSaveAsCharsetCID, NULL, NS_GET_IID(nsISaveAsCharset), getter_AddRefs(saveAsCharset));
|
||||
nsCOMPtr <nsISaveAsCharset> saveAsCharset = do_CreateInstance(kSaveAsCharsetCID, &res);
|
||||
if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
|
||||
|
||||
printf("ISO-8859-1 attr_plainTextDefault entityNone\n");
|
||||
|
@ -611,13 +608,6 @@ int main(int argc, char** argv) {
|
|||
|
||||
// --------------------------------------------
|
||||
printf("Finish All The Test Cases\n");
|
||||
nsresult res = NS_OK;
|
||||
res = nsComponentManager::FreeLibraries();
|
||||
|
||||
if(NS_FAILED(res))
|
||||
printf("nsComponentManager failed\n");
|
||||
else
|
||||
printf("nsComponentManager FreeLibraries Done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,11 @@
|
|||
#include "prmon.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsCLiveconnect.h"
|
||||
#include "nsCLiveconnectFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
@ -89,13 +91,18 @@ NSCanUnload(nsISupports* serviceMgr)
|
|||
extern "C" NS_EXPORT nsresult
|
||||
JSJ_RegisterLiveConnectFactory()
|
||||
{
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIFactory> factory = new nsCLiveconnectFactory;
|
||||
if (factory) {
|
||||
return nsComponentManager::RegisterFactory(kCLiveconnectCID, "LiveConnect",
|
||||
"@mozilla.org/liveconnect/liveconnect;1",
|
||||
factory, PR_TRUE);
|
||||
return registrar->RegisterFactory(kCLiveconnectCID, "LiveConnect",
|
||||
"@mozilla.org/liveconnect/liveconnect;1",
|
||||
factory);
|
||||
}
|
||||
return NS_ERROR_FACTORY_NOT_LOADED;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -716,10 +716,16 @@ nsJSCID::NewID(const char* str)
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCID cid;
|
||||
if(NS_SUCCEEDED(nsComponentManager::ContractIDToClassID(str, &cid)))
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
if (registrar)
|
||||
{
|
||||
success = idObj->mDetails.InitWithName(cid, str);
|
||||
nsCID *cid;
|
||||
if(NS_SUCCEEDED(registrar->ContractIDToCID(str, &cid)))
|
||||
{
|
||||
success = idObj->mDetails.InitWithName(*cid, str);
|
||||
nsMemory::Free(cid);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!success)
|
||||
|
@ -794,11 +800,13 @@ nsJSCID::CreateInstance(nsISupports **_retval)
|
|||
else
|
||||
iid = NS_GET_IID(nsISupports);
|
||||
|
||||
nsCOMPtr<nsISupports> inst;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentManager> compMgr;
|
||||
nsresult rv = NS_GetComponentManager(getter_AddRefs(compMgr));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(*mDetails.GetID(), nsnull, iid,
|
||||
(void**) getter_AddRefs(inst));
|
||||
nsCOMPtr<nsISupports> inst;
|
||||
rv = compMgr->CreateInstance(*mDetails.GetID(), nsnull, iid, getter_AddRefs(inst));
|
||||
NS_ASSERTION(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!");
|
||||
|
||||
if(NS_FAILED(rv) || !inst)
|
||||
|
|
|
@ -7018,9 +7018,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
void* nativeParentWidget = rootView->GetWidget()->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
// Create a new view manager.
|
||||
rv = nsComponentManager::CreateInstance(kViewManagerCID, nsnull,
|
||||
NS_GET_IID(nsIViewManager),
|
||||
(void**) &vm);
|
||||
rv = CallCreateInstance(kViewManagerCID, &vm);
|
||||
NS_ASSERTION(NS_SUCCEEDED (rv), "failed to create view manager");
|
||||
rv = vm->Init(dc);
|
||||
NS_ASSERTION(NS_SUCCEEDED (rv), "failed to init view manager");
|
||||
|
@ -7029,9 +7027,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
// Create a view
|
||||
nsRect tbounds = mPresContext->GetVisibleArea();
|
||||
nsIView* view;
|
||||
rv = nsComponentManager::CreateInstance(kViewCID, nsnull,
|
||||
NS_GET_IID(nsIView),
|
||||
(void **) &view);
|
||||
rv = CallCreateInstance(kViewCID, &view);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create scroll view");
|
||||
rv = view->Init(vm, tbounds, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to init scroll view");
|
||||
|
|
|
@ -1814,10 +1814,7 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext,
|
|||
|
||||
// Create an editor
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kTextEditorCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIEditor),
|
||||
getter_AddRefs(mEditor));
|
||||
mEditor = do_CreateInstance(kTextEditorCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!mEditor)
|
||||
|
@ -1825,10 +1822,7 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext,
|
|||
|
||||
// Create selection
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
rv = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
|
||||
NS_GET_IID(nsIFrameSelection),
|
||||
getter_AddRefs(frameSel));
|
||||
nsCOMPtr<nsIFrameSelection> frameSel = do_CreateInstance(kFrameSelectionCID, &rv);
|
||||
|
||||
// Create a SelectionController
|
||||
|
||||
|
|
|
@ -699,9 +699,7 @@ nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
|
|||
{
|
||||
// create, init, set the parent of the view
|
||||
nsIView* innerView;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCViewCID, nsnull,
|
||||
NS_GET_IID(nsIView),
|
||||
(void **)&innerView);
|
||||
nsresult rv = CallCreateInstance(kCViewCID, &innerView);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not create inner view");
|
||||
return rv;
|
||||
|
|
|
@ -2220,36 +2220,28 @@ nsGfxScrollFrameInner::SaveState()
|
|||
nsresult rv = NS_NewPresState(getter_AddRefs(state));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> xoffset;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(xoffset));
|
||||
nsCOMPtr<nsISupportsPRInt32> xoffset = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (xoffset) {
|
||||
rv = xoffset->SetData(x);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("x-offset"), xoffset);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> yoffset;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(yoffset));
|
||||
nsCOMPtr<nsISupportsPRInt32> yoffset = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (yoffset) {
|
||||
rv = yoffset->SetData(y);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("y-offset"), yoffset);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> width;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(width));
|
||||
nsCOMPtr<nsISupportsPRInt32> width = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (width) {
|
||||
rv = width->SetData(childRect.width);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("width"), width);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> height;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(height));
|
||||
nsCOMPtr<nsISupportsPRInt32> height = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (height) {
|
||||
rv = height->SetData(childRect.height);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
|
|
@ -755,14 +755,12 @@ nsObjectFrame::CreateWidget(nsPresContext* aPresContext,
|
|||
nscoord aHeight,
|
||||
PRBool aViewOnly)
|
||||
{
|
||||
nsIView* view;
|
||||
nsIView *view;
|
||||
|
||||
// Create our view and widget
|
||||
|
||||
nsresult result =
|
||||
nsComponentManager::CreateInstance(kViewCID, nsnull, NS_GET_IID(nsIView),
|
||||
(void **)&view);
|
||||
if (NS_OK != result) {
|
||||
nsresult result = CallCreateInstance(kViewCID, &view);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -2220,36 +2220,28 @@ nsGfxScrollFrameInner::SaveState()
|
|||
nsresult rv = NS_NewPresState(getter_AddRefs(state));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> xoffset;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(xoffset));
|
||||
nsCOMPtr<nsISupportsPRInt32> xoffset = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (xoffset) {
|
||||
rv = xoffset->SetData(x);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("x-offset"), xoffset);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> yoffset;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(yoffset));
|
||||
nsCOMPtr<nsISupportsPRInt32> yoffset = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (yoffset) {
|
||||
rv = yoffset->SetData(y);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("y-offset"), yoffset);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> width;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(width));
|
||||
nsCOMPtr<nsISupportsPRInt32> width = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (width) {
|
||||
rv = width->SetData(childRect.width);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
state->SetStatePropertyAsSupports(NS_LITERAL_STRING("width"), width);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt32> height;
|
||||
nsComponentManager::CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID,
|
||||
nsnull, NS_GET_IID(nsISupportsPRInt32), (void**)getter_AddRefs(height));
|
||||
nsCOMPtr<nsISupportsPRInt32> height = do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID);
|
||||
if (height) {
|
||||
rv = height->SetData(childRect.height);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
|
|
@ -755,14 +755,12 @@ nsObjectFrame::CreateWidget(nsPresContext* aPresContext,
|
|||
nscoord aHeight,
|
||||
PRBool aViewOnly)
|
||||
{
|
||||
nsIView* view;
|
||||
nsIView *view;
|
||||
|
||||
// Create our view and widget
|
||||
|
||||
nsresult result =
|
||||
nsComponentManager::CreateInstance(kViewCID, nsnull, NS_GET_IID(nsIView),
|
||||
(void **)&view);
|
||||
if (NS_OK != result) {
|
||||
nsresult result = CallCreateInstance(kViewCID, &view);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -7018,9 +7018,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
void* nativeParentWidget = rootView->GetWidget()->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
// Create a new view manager.
|
||||
rv = nsComponentManager::CreateInstance(kViewManagerCID, nsnull,
|
||||
NS_GET_IID(nsIViewManager),
|
||||
(void**) &vm);
|
||||
rv = CallCreateInstance(kViewManagerCID, &vm);
|
||||
NS_ASSERTION(NS_SUCCEEDED (rv), "failed to create view manager");
|
||||
rv = vm->Init(dc);
|
||||
NS_ASSERTION(NS_SUCCEEDED (rv), "failed to init view manager");
|
||||
|
@ -7029,9 +7027,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
// Create a view
|
||||
nsRect tbounds = mPresContext->GetVisibleArea();
|
||||
nsIView* view;
|
||||
rv = nsComponentManager::CreateInstance(kViewCID, nsnull,
|
||||
NS_GET_IID(nsIView),
|
||||
(void **) &view);
|
||||
rv = CallCreateInstance(kViewCID, &view);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create scroll view");
|
||||
rv = view->Init(vm, tbounds, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to init scroll view");
|
||||
|
|
|
@ -699,9 +699,7 @@ nsSubDocumentFrame::CreateViewAndWidget(nsContentType aContentType)
|
|||
{
|
||||
// create, init, set the parent of the view
|
||||
nsIView* innerView;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCViewCID, nsnull,
|
||||
NS_GET_IID(nsIView),
|
||||
(void **)&innerView);
|
||||
nsresult rv = CallCreateInstance(kCViewCID, &innerView);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not create inner view");
|
||||
return rv;
|
||||
|
|
|
@ -1814,10 +1814,7 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext,
|
|||
|
||||
// Create an editor
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kTextEditorCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIEditor),
|
||||
getter_AddRefs(mEditor));
|
||||
mEditor = do_CreateInstance(kTextEditorCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!mEditor)
|
||||
|
@ -1825,10 +1822,7 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext,
|
|||
|
||||
// Create selection
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
rv = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
|
||||
NS_GET_IID(nsIFrameSelection),
|
||||
getter_AddRefs(frameSel));
|
||||
nsCOMPtr<nsIFrameSelection> frameSel = do_CreateInstance(kFrameSelectionCID, &rv);
|
||||
|
||||
// Create a SelectionController
|
||||
|
||||
|
|
|
@ -1604,7 +1604,7 @@ int main(int argc, char** argv)
|
|||
|
||||
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance(kDeviceContextCID, nsnull, NS_GET_IID(nsIDeviceContext), (void **)&dx);
|
||||
nsresult rv = CallCreateInstance(kDeviceContextCID, &dx);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
dx->Init(nsull);
|
||||
|
|
|
@ -445,7 +445,7 @@ GeometryTest::GeometryTest(BasicTest *aDoc)
|
|||
|
||||
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance(kDeviceContextCID, nsnull, NS_GET_IID(nsIDeviceContext), (void **)&dx);
|
||||
nsresult rv = CallCreateInstance(kDeviceContextCID, &dx);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
dx->Init(nsnull);
|
||||
|
@ -468,10 +468,7 @@ GeometryTest::GeometryTest(BasicTest *aDoc)
|
|||
|
||||
static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID);
|
||||
|
||||
status = nsComponentManager::CreateInstance(kViewManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIViewManager),
|
||||
(void **)&vm);
|
||||
status = CallCreateInstance(kViewManagerCID, &vm);
|
||||
|
||||
if ((NS_FAILED(status)) || nsnull==vm)
|
||||
{
|
||||
|
@ -485,10 +482,7 @@ GeometryTest::GeometryTest(BasicTest *aDoc)
|
|||
// Create a view
|
||||
static NS_DEFINE_IID(kScrollingViewCID, NS_SCROLL_PORT_VIEW_CID);
|
||||
|
||||
status = nsComponentManager::CreateInstance(kScrollingViewCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIView),
|
||||
(void **)&rootView);
|
||||
status = CallCreateInstance(kScrollingViewCID, &rootView);
|
||||
|
||||
if ((NS_FAILED(status)) || nsnull==rootView)
|
||||
{
|
||||
|
|
|
@ -61,8 +61,9 @@ nsAbDirFactoryService::~nsAbDirFactoryService()
|
|||
}
|
||||
|
||||
/* nsIAbDirFactory getDirFactory (in string uri); */
|
||||
NS_IMETHODIMP nsAbDirFactoryService::GetDirFactory(const char* aURI,
|
||||
nsIAbDirFactory** aDirFactory)
|
||||
NS_IMETHODIMP
|
||||
nsAbDirFactoryService::GetDirFactory(const char* aURI,
|
||||
nsIAbDirFactory** aDirFactory)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -79,119 +80,14 @@ NS_IMETHODIMP nsAbDirFactoryService::GetDirFactory(const char* aURI,
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Extract the scheme
|
||||
nsCAutoString scheme;
|
||||
nsCAutoString scheme;
|
||||
rv = nsService->ExtractScheme (nsDependentCString(aURI), scheme);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// TODO
|
||||
// Change to use string classes
|
||||
|
||||
// Try to find a factory using the component manager.
|
||||
static const char kAbDirFactoryContractIDPrefix[]
|
||||
= NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX;
|
||||
nsCAutoString contractID;
|
||||
contractID.AppendLiteral(NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX);
|
||||
contractID.Append(scheme);
|
||||
|
||||
PRInt32 pos = scheme.Length();
|
||||
PRInt32 len = pos + sizeof(kAbDirFactoryContractIDPrefix) - 1;
|
||||
|
||||
// Safely convert to a C-string for the XPCOM APIs
|
||||
char buf[128];
|
||||
char* contractID = buf;
|
||||
if (len >= PRInt32(sizeof buf))
|
||||
contractID = NS_STATIC_CAST(char *,nsMemory::Alloc(len + 1));
|
||||
|
||||
if (contractID == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PL_strcpy(contractID, kAbDirFactoryContractIDPrefix);
|
||||
PL_strncpy(contractID + sizeof(kAbDirFactoryContractIDPrefix) - 1, aURI, pos);
|
||||
contractID[len] = '\0';
|
||||
|
||||
nsCID cid;
|
||||
rv = nsComponentManager::ContractIDToClassID(contractID, &cid);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (contractID != buf)
|
||||
nsCRT::free(contractID);
|
||||
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
rv = nsComponentManager::FindFactory(cid, getter_AddRefs(factory));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "factory registered, but couldn't load");
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = factory->CreateInstance(nsnull, NS_GET_IID(nsIAbDirFactory), NS_REINTERPRET_CAST(void**, aDirFactory));
|
||||
return rv;
|
||||
return CallCreateInstance(contractID.get(), aDirFactory);
|
||||
}
|
||||
|
||||
/* nsIAbDirFactory getDirFactory (in string uri); */
|
||||
/*
|
||||
NS_IMETHODIMP nsAbDirFactoryService::GetDirFactory(const char* aURI,
|
||||
nsIAbDirFactory** aDirFactory)
|
||||
{
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (!aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_PRECONDITION(aDirFactory != nsnull, "null ptr");
|
||||
if (!aDirFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Compute the scheme of the URI. Scan forward until we either:
|
||||
//
|
||||
// 1. Reach the end of the string
|
||||
// 2. Encounter a non-alpha character
|
||||
// 3. Encouter a colon.
|
||||
//
|
||||
// If we encounter a colon _before_ encountering a non-alpha
|
||||
// character, then assume it's the scheme.
|
||||
//
|
||||
// XXX Although it's really not correct, we'll allow underscore
|
||||
// characters ('_'), too.
|
||||
const char* p = aURI;
|
||||
while (IsLegalSchemeCharacter(*p))
|
||||
++p;
|
||||
|
||||
if (*p != ':')
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
PRUint32 prefixlen = 0;
|
||||
|
||||
prefixlen = (p - aURI);
|
||||
|
||||
// Try to find a factory using the component manager.
|
||||
static const char kAbDirFactoryContractIDPrefix[]
|
||||
= NS_AB_DIRECTORY_FACTORY_CONTRACTID_PREFIX;
|
||||
|
||||
PRInt32 pos = p - aURI;
|
||||
PRInt32 len = pos + sizeof(kAbDirFactoryContractIDPrefix) - 1;
|
||||
|
||||
// Safely convert to a C-string for the XPCOM APIs
|
||||
char buf[128];
|
||||
char* contractID = buf;
|
||||
if (len >= PRInt32(sizeof buf))
|
||||
contractID = NS_STATIC_CAST(char *,nsMemory::Alloc(len + 1));
|
||||
|
||||
if (contractID == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PL_strcpy(contractID, kAbDirFactoryContractIDPrefix);
|
||||
PL_strncpy(contractID + sizeof(kAbDirFactoryContractIDPrefix) - 1, aURI, pos);
|
||||
contractID[len] = '\0';
|
||||
|
||||
nsCID cid;
|
||||
rv = nsComponentManager::ContractIDToClassID(contractID, &cid);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (contractID != buf)
|
||||
nsCRT::free(contractID);
|
||||
|
||||
|
||||
rv = nsComponentManager::FindFactory(cid, getter_AddRefs(factory));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "factory registered, but couldn't load");
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = factory->CreateInstance(nsnull, NS_GET_IID(nsIAbDirFactory), NS_REINTERPRET_CAST(void**, aDirFactory));
|
||||
return rv;
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -166,15 +166,11 @@ static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
|||
static nsresult
|
||||
ConvertBufToPlainText(nsString &aConBuf)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoString convertedText;
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
|
||||
if (aConBuf.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID, nsnull,
|
||||
NS_GET_IID(nsIParser), getter_AddRefs(parser));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && parser)
|
||||
{
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
|
@ -185,6 +181,7 @@ ConvertBufToPlainText(nsString &aConBuf)
|
|||
nsCOMPtr<nsIHTMLToTextSink> textSink(do_QueryInterface(sink));
|
||||
NS_ENSURE_TRUE(textSink, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString convertedText;
|
||||
textSink->Initialize(&convertedText, 0, 72);
|
||||
|
||||
parser->SetContentSink(sink);
|
||||
|
@ -1627,12 +1624,10 @@ SendLaterListener::OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint
|
|||
NS_IMETHODIMP
|
||||
nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgSendLater> pMsgSendLater;
|
||||
rv = nsComponentManager::CreateInstance(kMsgSendLaterCID, NULL,NS_GET_IID(nsIMsgSendLater),
|
||||
(void **)getter_AddRefs(pMsgSendLater));
|
||||
if (NS_SUCCEEDED(rv) && pMsgSendLater)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgSendLater> pMsgSendLater = do_CreateInstance(kMsgSendLaterCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && pMsgSendLater)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("We succesfully obtained a nsIMsgSendLater interface....\n");
|
||||
#endif
|
||||
|
|
|
@ -421,11 +421,8 @@ nsMsgAccountManager::createKeyedIdentity(const char* key,
|
|||
nsIMsgIdentity ** aIdentity)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgIdentity> identity;
|
||||
rv = nsComponentManager::CreateInstance(NS_MSGIDENTITY_CONTRACTID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIMsgIdentity),
|
||||
getter_AddRefs(identity));
|
||||
nsCOMPtr<nsIMsgIdentity> identity =
|
||||
do_CreateInstance(NS_MSGIDENTITY_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
identity->SetKey(key);
|
||||
|
@ -972,10 +969,7 @@ NS_IMETHODIMP nsMsgAccountManager::GetFolderCache(nsIMsgFolderCache* *aFolderCac
|
|||
|
||||
if (!m_msgFolderCache)
|
||||
{
|
||||
rv = nsComponentManager::CreateInstance(kMsgFolderCacheCID,
|
||||
NULL,
|
||||
NS_GET_IID(nsIMsgFolderCache),
|
||||
getter_AddRefs(m_msgFolderCache));
|
||||
m_msgFolderCache = do_CreateInstance(kMsgFolderCacheCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -1618,14 +1612,10 @@ nsMsgAccountManager::createKeyedAccount(const char* key,
|
|||
nsIMsgAccount ** aAccount)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIMsgAccount> account;
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kMsgAccountCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIMsgAccount),
|
||||
(void **)getter_AddRefs(account));
|
||||
|
||||
nsCOMPtr<nsIMsgAccount> account = do_CreateInstance(kMsgAccountCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
account->SetKey(key);
|
||||
|
||||
// add to internal nsISupportsArray
|
||||
|
|
|
@ -111,11 +111,7 @@ nsMsgFolderCache::QueryInterface(const nsIID& iid, void **result)
|
|||
if (!gMDBFactory)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIMdbFactoryFactory> factoryfactory;
|
||||
rv = nsComponentManager::CreateInstance(kMorkCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIMdbFactoryFactory),
|
||||
(void **) getter_AddRefs(factoryfactory));
|
||||
nsCOMPtr <nsIMdbFactoryFactory> factoryfactory = do_CreateInstance(kMorkCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && factoryfactory)
|
||||
rv = factoryfactory->GetMdbFactory(&gMDBFactory);
|
||||
}
|
||||
|
|
|
@ -262,9 +262,8 @@ NS_IMETHODIMP nsMsgDBFolder::ForceDBClosed()
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, NS_GET_IID(nsIMsgDatabase), (void **) getter_AddRefs(mailDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory = do_CreateInstance(kCMailDB);
|
||||
if (mailDBFactory)
|
||||
mailDBFactory->ForceFolderDBClosed(this);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -3699,8 +3698,7 @@ NS_IMETHODIMP nsMsgDBFolder::SetFlags(PRUint32 aFlags)
|
|||
NS_IMETHODIMP nsMsgDBFolder::GetAllFoldersWithFlag(PRUint32 flag, nsISupportsArray **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
nsresult rv = nsComponentManager::CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsISupportsArray), (void **)aResult);
|
||||
nsresult rv = CallCreateInstance(NS_SUPPORTSARRAY_CONTRACTID, aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return ListFoldersWithFlag(flag, *aResult);
|
||||
|
|
|
@ -386,17 +386,13 @@ nsresult nsMsgI18NConvertToEntity(const nsString& inString, nsString* outString)
|
|||
nsresult res;
|
||||
|
||||
outString->Truncate();
|
||||
nsCOMPtr <nsIEntityConverter> entityConv;
|
||||
res = nsComponentManager::CreateInstance(kEntityConverterCID, NULL,
|
||||
NS_GET_IID(nsIEntityConverter), getter_AddRefs(entityConv));
|
||||
nsCOMPtr <nsIEntityConverter> entityConv = do_CreateInstance(kEntityConverterCID, &res);
|
||||
if(NS_SUCCEEDED(res)) {
|
||||
PRUnichar *entities = NULL;
|
||||
res = entityConv->ConvertToEntities(inString.get(), nsIEntityConverter::html40Latin1, &entities);
|
||||
if (NS_SUCCEEDED(res) && (NULL != entities)) {
|
||||
outString->Assign(entities);
|
||||
nsMemory::Free(entities);
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(res) && (NULL != entities))
|
||||
outString->Adopt(entities);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -2031,15 +2031,11 @@ static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
|||
nsresult
|
||||
ConvertBufToPlainText(nsString &aConBuf, PRBool formatflowed /* = PR_FALSE */)
|
||||
{
|
||||
nsresult rv;
|
||||
nsString convertedText;
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
|
||||
if (aConBuf.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID, nsnull,
|
||||
NS_GET_IID(nsIParser), getter_AddRefs(parser));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && parser)
|
||||
{
|
||||
PRUint32 converterFlags = 0;
|
||||
|
@ -2060,6 +2056,7 @@ ConvertBufToPlainText(nsString &aConBuf, PRBool formatflowed /* = PR_FALSE */)
|
|||
nsCOMPtr<nsIHTMLToTextSink> textSink(do_QueryInterface(sink));
|
||||
NS_ENSURE_TRUE(textSink, NS_ERROR_FAILURE);
|
||||
|
||||
nsString convertedText;
|
||||
textSink->Initialize(&convertedText, converterFlags, wrapWidth);
|
||||
|
||||
parser->SetContentSink(sink);
|
||||
|
|
|
@ -49,8 +49,7 @@ MIME_B64EncoderInit(nsresult (*output_fn) (const char *buf, PRInt32 size, void *
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->B64EncoderInit(output_fn, closure, &returnEncoderData);
|
||||
|
@ -64,8 +63,7 @@ MIME_QPEncoderInit(nsresult (*output_fn) (const char *buf, PRInt32 size, void *c
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->QPEncoderInit(output_fn, closure, &returnEncoderData);
|
||||
|
@ -79,8 +77,7 @@ MIME_UUEncoderInit(char *filename, nsresult (*output_fn) (const char *buf, PRInt
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->UUEncoderInit(filename, output_fn, closure, &returnEncoderData);
|
||||
|
@ -94,8 +91,7 @@ MIME_EncoderDestroy(MimeEncoderData *data, PRBool abort_p)
|
|||
{
|
||||
//MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->EncoderDestroy(data, abort_p);
|
||||
|
@ -111,13 +107,10 @@ MIME_EncoderWrite(MimeEncoderData *data, const char *buffer, PRInt32 size)
|
|||
// MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
PRInt32 written = 0;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter) {
|
||||
res = converter->EncoderWrite(data, buffer, size, &written);
|
||||
NS_RELEASE(converter);
|
||||
}
|
||||
return NS_SUCCEEDED(res) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -768,19 +768,14 @@ nsresult nsMsgSendLater::SetOrigMsgDisposition()
|
|||
nsresult
|
||||
nsMsgSendLater::DeleteCurrentMessage()
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> msgArray;
|
||||
|
||||
// Get the composition fields interface
|
||||
nsresult res = nsComponentManager::CreateInstance(kISupportsArrayCID, NULL, NS_GET_IID(nsISupportsArray),
|
||||
(void **) getter_AddRefs(msgArray));
|
||||
if (NS_FAILED(res) || !msgArray)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> msgArray = do_CreateInstance(kISupportsArrayCID);
|
||||
if (!msgArray)
|
||||
return NS_ERROR_FACTORY_NOT_LOADED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> msgSupport = do_QueryInterface(mMessage, &res);
|
||||
nsCOMPtr<nsISupports> msgSupport = do_QueryInterface(mMessage);
|
||||
msgArray->InsertElementAt(msgSupport, 0);
|
||||
res = mMessageFolder->DeleteMessages(msgArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
nsresult res = mMessageFolder->DeleteMessages(msgArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
if (NS_FAILED(res))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -317,11 +317,8 @@ NS_IMETHODIMP nsSmtpService::NewURI(const nsACString &aSpec,
|
|||
{
|
||||
// get a new smtp url
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr <nsIURI> mailtoUrl;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCMailtoUrlCID, NULL, NS_GET_IID(nsIURI), getter_AddRefs(mailtoUrl));
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIURI> mailtoUrl = do_CreateInstance(kCMailtoUrlCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString utf8Spec;
|
||||
|
@ -541,13 +538,8 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult)
|
|||
{
|
||||
if (!key) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsISmtpServer> server;
|
||||
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(NS_SMTPSERVER_CONTRACTID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsISmtpServer),
|
||||
(void **)getter_AddRefs(server));
|
||||
nsCOMPtr<nsISmtpServer> server = do_CreateInstance(NS_SMTPSERVER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
server->SetKey(key);
|
||||
|
|
|
@ -56,9 +56,7 @@ static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
|||
nsMailtoUrl::nsMailtoUrl()
|
||||
{
|
||||
mFormat = nsIMsgCompFormat::Default;
|
||||
nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void **) getter_AddRefs(m_baseURL));
|
||||
m_baseURL = do_CreateInstance(kSimpleURICID);
|
||||
}
|
||||
|
||||
nsMailtoUrl::~nsMailtoUrl()
|
||||
|
|
|
@ -968,11 +968,9 @@ NS_IMETHODIMP nsMsgDatabase::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
static nsIMdbFactory *gMDBFactory = nsnull;
|
||||
if (!gMDBFactory)
|
||||
{
|
||||
nsCOMPtr <nsIMdbFactoryFactory> factoryfactory;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCMorkFactory,
|
||||
nsnull,NS_GET_IID(nsIMdbFactoryFactory), (void **) getter_AddRefs(factoryfactory));
|
||||
if (NS_SUCCEEDED(rv) && factoryfactory)
|
||||
rv = factoryfactory->GetMdbFactory(&gMDBFactory);
|
||||
nsCOMPtr <nsIMdbFactoryFactory> factoryfactory = do_CreateInstance(kCMorkFactory);
|
||||
if (factoryfactory)
|
||||
factoryfactory->GetMdbFactory(&gMDBFactory);
|
||||
}
|
||||
return gMDBFactory;
|
||||
}
|
||||
|
@ -3135,15 +3133,11 @@ nsresult nsMsgDatabase::GetCollationKeyGenerator()
|
|||
// or generate a locale from a stored locale name ("en_US", "fr_FR")
|
||||
//err = localeFactory->NewLocale(&localeName, &locale);
|
||||
|
||||
nsCOMPtr <nsICollationFactory> f;
|
||||
|
||||
err = nsComponentManager::CreateInstance(kCollationFactoryCID, NULL,
|
||||
NS_GET_IID(nsICollationFactory), getter_AddRefs(f));
|
||||
nsCOMPtr <nsICollationFactory> f = do_CreateInstance(kCollationFactoryCID, &err);
|
||||
if (NS_SUCCEEDED(err) && f)
|
||||
{
|
||||
// get a collation interface instance
|
||||
err = f->CreateCollation(locale, getter_AddRefs(m_collationKeyGenerator));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,8 +92,7 @@ MIME_B64EncoderInit(nsresult (*PR_CALLBACK output_fn) (const char *buf, PRInt32
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->B64EncoderInit(output_fn, closure, &returnEncoderData);
|
||||
|
@ -107,8 +106,7 @@ MIME_QPEncoderInit(nsresult (*PR_CALLBACK output_fn) (const char *buf, PRInt32 s
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->QPEncoderInit(output_fn, closure, &returnEncoderData);
|
||||
|
@ -122,8 +120,7 @@ MIME_UUEncoderInit(char *filename, nsresult (*PR_CALLBACK output_fn) (const char
|
|||
{
|
||||
MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->UUEncoderInit(filename, output_fn, closure, &returnEncoderData);
|
||||
|
@ -137,8 +134,7 @@ MIME_EncoderDestroy(MimeEncoderData *data, PRBool abort_p)
|
|||
{
|
||||
//MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter)
|
||||
{
|
||||
res = converter->EncoderDestroy(data, abort_p);
|
||||
|
@ -154,8 +150,7 @@ MIME_EncoderWrite(MimeEncoderData *data, const char *buffer, PRInt32 size)
|
|||
// MimeEncoderData *returnEncoderData = nsnull;
|
||||
nsIMimeConverter *converter;
|
||||
PRInt32 written = 0;
|
||||
nsresult res = nsComponentManager::CreateInstance(NS_MIME_CONVERTER_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsIMimeConverter), (void **)&converter);
|
||||
nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
|
||||
if (NS_SUCCEEDED(res) && nsnull != converter) {
|
||||
res = converter->EncoderWrite(data, buffer, size, &written);
|
||||
NS_RELEASE(converter);
|
||||
|
|
|
@ -884,10 +884,8 @@ nsImapIncomingServer::CreateProtocolInstance(nsIEventQueue *aEventQueue,
|
|||
nsCOMPtr<nsISignatureVerifier> verifier = do_GetService(SIGNATURE_VERIFIER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsIImapProtocol * protocolInstance = nsnull;
|
||||
rv = nsComponentManager::CreateInstance(kImapProtocolCID, nsnull,
|
||||
NS_GET_IID(nsIImapProtocol),
|
||||
(void **) &protocolInstance);
|
||||
nsIImapProtocol * protocolInstance;
|
||||
rv = CallCreateInstance(kImapProtocolCID, &protocolInstance);
|
||||
if (NS_SUCCEEDED(rv) && protocolInstance)
|
||||
{
|
||||
nsCOMPtr<nsIImapHostSessionList> hostSession =
|
||||
|
|
|
@ -2814,31 +2814,22 @@ NS_IMETHODIMP nsImapMailFolder::ParseMsgHdrs(nsIImapProtocol *aProtocol, nsIImap
|
|||
nsresult nsImapMailFolder::SetupHeaderParseStream(PRUint32 aSize,
|
||||
const char *content_type, nsIMailboxSpec *boxSpec)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (!mDatabase)
|
||||
GetDatabase(nsnull);
|
||||
|
||||
m_nextMessageByteLength = aSize;
|
||||
if (!m_msgParser)
|
||||
{
|
||||
rv = nsComponentManager::CreateInstance(kParseMailMsgStateCID, nsnull,
|
||||
NS_GET_IID(nsIMsgParseMailMsgState), (void **) getter_AddRefs(m_msgParser));
|
||||
}
|
||||
m_msgParser = do_CreateInstance(kParseMailMsgStateCID);
|
||||
else
|
||||
m_msgParser->Clear();
|
||||
|
||||
if (m_msgParser)
|
||||
{
|
||||
m_msgParser->SetMailDB(mDatabase);
|
||||
return
|
||||
m_msgParser->SetState(nsIMsgParseMailMsgState::ParseHeadersState);
|
||||
return m_msgParser->SetState(nsIMsgParseMailMsgState::ParseHeadersState);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return rv;
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult nsImapMailFolder::ParseAdoptedHeaderLine(const char *aMessageLine, PRUint32 aMsgKey)
|
||||
|
|
|
@ -1212,8 +1212,7 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
|
|||
|
||||
// now we need to create an imap url to load into the connection. The url
|
||||
// needs to represent a select folder action.
|
||||
rv = nsComponentManager::CreateInstance(kImapUrlCID, nsnull,
|
||||
NS_GET_IID(nsIImapUrl), (void **) imapUrl);
|
||||
rv = CallCreateInstance(kImapUrlCID, imapUrl);
|
||||
if (NS_SUCCEEDED(rv) && *imapUrl)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(*imapUrl, &rv);
|
||||
|
@ -2693,8 +2692,8 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
|
|||
nsIURI *aBaseURI,
|
||||
nsIURI **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIImapUrl> aImapUrl;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kImapUrlCID, nsnull, NS_GET_IID(nsIImapUrl), getter_AddRefs(aImapUrl));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIImapUrl> aImapUrl = do_CreateInstance(kImapUrlCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// now extract lots of fun information...
|
||||
|
|
|
@ -109,7 +109,8 @@ nsImapUrl::nsImapUrl()
|
|||
|
||||
nsresult nsImapUrl::Initialize()
|
||||
{
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCImapMockChannel, nsnull, NS_GET_IID(nsIImapMockChannel), getter_AddRefs(m_mockChannel));
|
||||
nsresult rv;
|
||||
m_mockChannel = do_CreateInstance(kCImapMockChannel, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ nsresult nsEudoraCompose::CreateComponents( void)
|
|||
|
||||
NS_IF_RELEASE( m_pMsgFields);
|
||||
if (!m_pMsgSend) {
|
||||
rv = nsComponentManager::CreateInstance( kMsgSendCID, nsnull, NS_GET_IID( nsIMsgSend), (void **) &m_pMsgSend);
|
||||
rv = CallCreateInstance( kMsgSendCID, &m_pMsgSend);
|
||||
if (NS_SUCCEEDED( rv) && m_pMsgSend) {
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyMgr =
|
||||
do_GetService(kProxyObjectManagerCID, &rv);
|
||||
|
@ -289,7 +289,7 @@ nsresult nsEudoraCompose::CreateComponents( void)
|
|||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && m_pMsgSend) {
|
||||
rv = nsComponentManager::CreateInstance( kMsgCompFieldsCID, nsnull, nsCOMTypeInfo<nsIMsgCompFields>::GetIID(), (void **) &m_pMsgFields);
|
||||
rv = CallCreateInstance( kMsgCompFieldsCID, &m_pMsgFields);
|
||||
if (NS_SUCCEEDED(rv) && m_pMsgFields) {
|
||||
// IMPORT_LOG0( "nsOutlookCompose - CreateComponents succeeded\n");
|
||||
m_pMsgFields->SetForcePlainText( PR_FALSE);
|
||||
|
|
|
@ -261,7 +261,7 @@ nsresult nsOutlookCompose::CreateComponents( void)
|
|||
|
||||
NS_IF_RELEASE( m_pMsgFields);
|
||||
if (!m_pMsgSend) {
|
||||
rv = nsComponentManager::CreateInstance( kMsgSendCID, nsnull, NS_GET_IID( nsIMsgSend), (void **) &m_pMsgSend);
|
||||
rv = CallCreateInstance( kMsgSendCID, &m_pMsgSend);
|
||||
if (NS_SUCCEEDED( rv) && m_pMsgSend) {
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyMgr =
|
||||
do_GetService(kProxyObjectManagerCID, &rv);
|
||||
|
@ -283,7 +283,7 @@ nsresult nsOutlookCompose::CreateComponents( void)
|
|||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && m_pMsgSend) {
|
||||
rv = nsComponentManager::CreateInstance( kMsgCompFieldsCID, nsnull, nsCOMTypeInfo<nsIMsgCompFields>::GetIID(), (void **) &m_pMsgFields);
|
||||
rv = CallCreateInstance( kMsgCompFieldsCID, &m_pMsgFields);
|
||||
if (NS_SUCCEEDED(rv) && m_pMsgFields) {
|
||||
// IMPORT_LOG0( "nsOutlookCompose - CreateComponents succeeded\n");
|
||||
m_pMsgFields->SetForcePlainText( PR_FALSE);
|
||||
|
|
|
@ -730,8 +730,7 @@ PRBool nsOutlookMail::WriteAttachment( nsIFileSpec *pDest, CMapiMessage *pMsg)
|
|||
// Now set up the encoder object
|
||||
|
||||
if (bResult) {
|
||||
nsCOMPtr<nsIImportMimeEncode> encoder;
|
||||
rv = nsComponentManager::CreateInstance( kImportMimeEncodeCID, nsnull, NS_GET_IID(nsIImportMimeEncode), getter_AddRefs( encoder));
|
||||
nsCOMPtr<nsIImportMimeEncode> encoder = do_CreateInstance( kImportMimeEncodeCID, &rv);
|
||||
if (NS_FAILED( rv)) {
|
||||
IMPORT_LOG0( "*** Error creating mime encoder\n");
|
||||
return( PR_FALSE);
|
||||
|
|
|
@ -295,8 +295,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISuppor
|
|||
}
|
||||
IMPORT_LOG1( "Requesting sample data #: %ld\n", (long)rNum);
|
||||
if (m_pInterface) {
|
||||
nsCOMPtr<nsISupportsString> data;
|
||||
rv = nsComponentManager::CreateInstance( kSupportsWStringCID, nsnull, NS_GET_IID(nsISupportsString), getter_AddRefs( data));
|
||||
nsCOMPtr<nsISupportsString> data = do_CreateInstance( kSupportsWStringCID, &rv);
|
||||
if (NS_FAILED( rv))
|
||||
return( rv);
|
||||
PRUnichar * pData = nsnull;
|
||||
|
|
|
@ -280,8 +280,7 @@ NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_re
|
|||
if (!nsCRT::strcasecmp( dataId, "currentMailbox")) {
|
||||
// create an nsISupportsString, get the current mailbox
|
||||
// name being imported and put it in the string
|
||||
nsCOMPtr<nsISupportsString> data;
|
||||
rv = nsComponentManager::CreateInstance( kSupportsWStringCID, nsnull, NS_GET_IID(nsISupportsString), getter_AddRefs( data));
|
||||
nsCOMPtr<nsISupportsString> data = do_CreateInstance( kSupportsWStringCID, &rv);
|
||||
if (NS_FAILED( rv))
|
||||
return( rv);
|
||||
if (m_pThreadData) {
|
||||
|
|
|
@ -76,13 +76,8 @@ NS_IMPL_ISUPPORTS4(nsMailboxService, nsIMailboxService, nsIMsgMessageService, ns
|
|||
nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsFileSpec& aMailboxPath, nsIStreamListener *aMailboxParser,
|
||||
nsIUrlListener * aUrlListener, nsIURI ** aURL)
|
||||
{
|
||||
nsCOMPtr<nsIMailboxUrl> mailboxurl;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCMailboxUrl,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIMailboxUrl),
|
||||
(void **) getter_AddRefs(mailboxurl));
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMailboxUrl> mailboxurl = do_CreateInstance(kCMailboxUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mailboxurl)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
|
||||
|
@ -372,12 +367,7 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsComponentManager::CreateInstance(kCMailboxUrl,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIMailboxUrl),
|
||||
(void **) aMailboxUrl);
|
||||
|
||||
nsresult rv = CallCreateInstance(kCMailboxUrl, aMailboxUrl);
|
||||
if (NS_SUCCEEDED(rv) && aMailboxUrl && *aMailboxUrl)
|
||||
{
|
||||
// okay now generate the url string
|
||||
|
|
|
@ -48,12 +48,11 @@ static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID)
|
|||
extern "C" void *
|
||||
COM_GetmimeInlineTextClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeInlineTextClass(&ptr);
|
||||
|
||||
|
@ -63,12 +62,11 @@ COM_GetmimeInlineTextClass(void)
|
|||
extern "C" void *
|
||||
COM_GetmimeLeafClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeLeafClass(&ptr);
|
||||
|
||||
|
@ -78,12 +76,11 @@ COM_GetmimeLeafClass(void)
|
|||
extern "C" void *
|
||||
COM_GetmimeObjectClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeObjectClass(&ptr);
|
||||
|
||||
|
@ -93,12 +90,11 @@ COM_GetmimeObjectClass(void)
|
|||
extern "C" void *
|
||||
COM_GetmimeContainerClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeContainerClass(&ptr);
|
||||
|
||||
|
@ -108,12 +104,11 @@ COM_GetmimeContainerClass(void)
|
|||
extern "C" void *
|
||||
COM_GetmimeMultipartClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeMultipartClass(&ptr);
|
||||
|
||||
|
@ -123,12 +118,11 @@ COM_GetmimeMultipartClass(void)
|
|||
extern "C" void *
|
||||
COM_GetmimeMultipartSignedClass(void)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
void *ptr = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
objAccess->GetmimeMultipartSignedClass(&ptr);
|
||||
|
||||
|
@ -139,12 +133,11 @@ extern "C" int
|
|||
COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length,
|
||||
PRBool user_visible_p)
|
||||
{
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess;
|
||||
PRInt32 rc=-1;
|
||||
PRInt32 rc = -1;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kMimeObjectClassAccessCID,
|
||||
NULL, NS_GET_IID(nsIMimeObjectClassAccess),
|
||||
(void **) getter_AddRefs(objAccess));
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIMimeObjectClassAccess> objAccess =
|
||||
do_CreateInstance(kMimeObjectClassAccessCID, &res);
|
||||
if (NS_SUCCEEDED(res) && objAccess)
|
||||
{
|
||||
if (NS_SUCCEEDED(objAccess->MimeObjectWrite(mimeObject, data, length, user_visible_p)))
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
* Note: These will all register by their content type prefixed by the
|
||||
* following: mimecth:text/vcard
|
||||
*
|
||||
* libmime will then use nsComponentManager::ContractIDToCLSID() to
|
||||
* libmime will then use the XPCOM Component Manager to
|
||||
* locate the appropriate Content Type handler
|
||||
*/
|
||||
#ifndef nsMimeContentTypeHandler_h_
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
* Note: These will all register by their content type prefixed by the
|
||||
* following: mimecth:text/vcard
|
||||
*
|
||||
* libmime will then use nsComponentManager::ContractIDToCLSID() to
|
||||
* libmime will then use the XPCOM Component Manager to
|
||||
* locate the appropriate Content Type handler
|
||||
*/
|
||||
#ifndef nsIMimeContentTypeHandler_h_
|
||||
|
|
|
@ -249,9 +249,8 @@ PRInt32 generate_encodedwords(char *pUTF8, const char *charset, char method, cha
|
|||
}
|
||||
// Do nsITextTransform if needed
|
||||
if (conv_kana > 0) {
|
||||
nsCOMPtr <nsITextTransform> textTransform;
|
||||
rv = nsComponentManager::CreateInstance(NS_HANKAKUTOZENKAKU_CONTRACTID, nsnull,
|
||||
NS_GET_IID(nsITextTransform), getter_AddRefs(textTransform));
|
||||
nsCOMPtr <nsITextTransform> textTransform =
|
||||
do_CreateInstance(NS_HANKAKUTOZENKAKU_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsString text(pUCS2), result;
|
||||
rv = textTransform->Change(pUCS2, nsCRT::strlen(pUCS2), result);
|
||||
|
|
|
@ -225,14 +225,11 @@ mime_locate_external_content_handler(const char *content_type,
|
|||
nsCID classID = {0};
|
||||
char lookupID[256];
|
||||
nsCOMPtr<nsIMimeContentTypeHandler> ctHandler;
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv;
|
||||
|
||||
PR_snprintf(lookupID, sizeof(lookupID), "@mozilla.org/mimecth;1?type=%s", content_type);
|
||||
if (nsComponentManager::ContractIDToClassID(lookupID, &classID) != NS_OK)
|
||||
return NULL;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(classID, (nsISupports *)nsnull, NS_GET_IID(nsIMimeContentTypeHandler),
|
||||
(void **) getter_AddRefs(ctHandler));
|
||||
ctHandler = do_CreateInstance(lookupID, &rv);
|
||||
if (NS_FAILED(rv) || !ctHandler)
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -1545,9 +1545,7 @@ mime_bridge_create_display_stream(
|
|||
}
|
||||
|
||||
// Need the text converter...
|
||||
rv = nsComponentManager::CreateInstance(MOZ_TXTTOHTMLCONV_CONTRACTID,
|
||||
NULL, NS_GET_IID(mozITXTToHTMLConv),
|
||||
(void **)&(msd->options->conv));
|
||||
rv = CallCreateInstance(MOZ_TXTTOHTMLCONV_CONTRACTID, &(msd->options->conv));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
nsServiceManager::ReleaseService(kPrefCID, msd->options->prefs);
|
||||
|
|
|
@ -71,10 +71,8 @@ nsresult
|
|||
nsJARProtocolHandler::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kZipReaderCacheCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIZipReaderCache),
|
||||
getter_AddRefs(mJARCache));
|
||||
|
||||
mJARCache = do_CreateInstance(kZipReaderCacheCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJARCache->Init(NS_JAR_CACHE_SIZE);
|
||||
|
|
|
@ -4487,22 +4487,16 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
|
|||
if(plugin == NULL)
|
||||
{
|
||||
// nsIPlugin* of xpcom plugins can be found thru a call to
|
||||
// nsComponentManager::GetClassObject()
|
||||
nsCID clsid;
|
||||
// nsIComponentManager::GetClassObjectByContractID()
|
||||
nsCAutoString contractID(
|
||||
NS_LITERAL_CSTRING(NS_INLINE_PLUGIN_CONTRACTID_PREFIX) +
|
||||
nsDependentCString(aMimeType));
|
||||
nsresult rv =
|
||||
nsComponentManager::ContractIDToClassID(contractID.get(), &clsid);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsresult rv = CallGetClassObject(contractID.get(), &plugin);
|
||||
if (NS_SUCCEEDED(rv) && plugin)
|
||||
{
|
||||
rv = nsComponentManager::GetClassObject(clsid, nsIPlugin::GetIID(), (void**)&plugin);
|
||||
if (NS_SUCCEEDED(rv) && plugin)
|
||||
{
|
||||
// plugin was addref'd by nsComponentManager::GetClassObject
|
||||
pluginTag->mEntryPoint = plugin;
|
||||
plugin->Initialize();
|
||||
}
|
||||
// plugin is already addref'd
|
||||
pluginTag->mEntryPoint = plugin;
|
||||
plugin->Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@ static unsigned char * scale_image(unsigned char *rgb_data, int rgb_width,
|
|||
|
||||
static PRInt32 gPluginObjectCount = 0;
|
||||
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID );
|
||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID );
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID );
|
||||
|
||||
|
@ -137,9 +136,7 @@ nsSanePluginInstance::nsSanePluginInstance( void )
|
|||
mEvent_box = nsnull;
|
||||
mDrawing_area = nsnull;
|
||||
|
||||
if(nsComponentManager::CreateInstance(kCPluginManagerCID,
|
||||
NULL, kIPluginManagerIID,
|
||||
(void**)&mPluginManager) != NS_OK) {
|
||||
if (NS_FAILED(CallCreateInstance(kCPluginManagerCID, &mPluginManager))) {
|
||||
NS_ERROR("Error trying to create plugin manager!");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,10 +118,9 @@ nsAboutProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
nsresult rv;
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
|
|
|
@ -101,10 +101,9 @@ nsDataHandler::NewURI(const nsACString &aSpec,
|
|||
nsresult rv;
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
rv = CallCreateInstance(kSimpleURICID, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
|
|
|
@ -117,11 +117,9 @@ nsGopherHandler::NewURI(const nsACString &aSpec,
|
|||
nsIURI **result) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIStandardURL> url;
|
||||
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
|
||||
NS_GET_IID(nsIStandardURL),
|
||||
getter_AddRefs(url));
|
||||
nsCOMPtr<nsIStandardURL> url = do_CreateInstance(kStandardURLCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->Init(nsIStandardURL::URLTYPE_STANDARD, GOPHER_PORT,
|
||||
aSpec, aCharset, aBaseURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -163,16 +163,16 @@ NS_IMETHODIMP
|
|||
nsKeywordProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
const char *aCharset, // ignore charset info
|
||||
nsIURI *aBaseURI,
|
||||
nsIURI **result) {
|
||||
nsresult rv;
|
||||
nsIURI **result)
|
||||
{
|
||||
nsIURI* uri;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull, NS_GET_IID(nsIURI), (void**)&uri);
|
||||
nsresult rv = CallCreateInstance(kSimpleURICID, &uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = uri->SetSpec(aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(uri);
|
||||
return rv;
|
||||
NS_RELEASE(uri);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = uri;
|
||||
|
|
|
@ -129,7 +129,10 @@ nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest*
|
|||
nsresult rv = NS_NewCharInputStream(getter_AddRefs(dataStream), aData);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return aListener->OnDataAvailable(request, nsnull, dataStream, 0, -1);
|
||||
PRUint32 avail;
|
||||
dataStream->Available(&avail);
|
||||
|
||||
return aListener->OnDataAvailable(request, nsnull, dataStream, 0, avail);
|
||||
}
|
||||
#define SEND_DATA(x) SendData(x, converterListener, request)
|
||||
|
||||
|
@ -186,11 +189,10 @@ main(int argc, char* argv[])
|
|||
// per conversion pair (from - to pair).
|
||||
nsCString contractID(NS_ISTREAMCONVERTER_KEY);
|
||||
contractID.Append(converterList[count]);
|
||||
rv = nsComponentManager::RegisterFactory(kTestConverterCID,
|
||||
"TestConverter",
|
||||
contractID.get(),
|
||||
convFactSup,
|
||||
PR_TRUE);
|
||||
rv = registrar->RegisterFactory(kTestConverterCID,
|
||||
"TestConverter",
|
||||
contractID.get(),
|
||||
convFactSup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = catman->AddCategoryEntry(NS_ISTREAMCONVERTER_KEY, converterList[count], "x",
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
|
|
|
@ -96,9 +96,8 @@ main(int argc, char* argv[])
|
|||
ret = channel->Open(&in);
|
||||
if (NS_FAILED(ret)) return ret;
|
||||
|
||||
nsIPersistentProperties* props = nsnull;
|
||||
ret = nsComponentManager::CreateInstance(kPersistentPropertiesCID, nsnull,
|
||||
NS_GET_IID(nsIPersistentProperties), (void**) &props);
|
||||
nsIPersistentProperties* props;
|
||||
ret = CallCreateInstance(kPersistentPropertiesCID, &props);
|
||||
if (NS_FAILED(ret) || (!props)) {
|
||||
printf("create nsIPersistentProperties failed\n");
|
||||
return 1;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче