Bad use of nsIFile in component manager

--pete
This commit is contained in:
pete%alphanumerica.com 2001-12-11 03:25:32 +00:00
Родитель 97a7c761c0
Коммит 7c2ab7cf47
2 изменённых файлов: 7 добавлений и 26 удалений

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

@ -705,18 +705,6 @@ nsComponentManagerImpl::PlatformInit(void)
if (!mComponentsDir)
return NS_ERROR_OUT_OF_MEMORY;
char* componentDescriptor;
mComponentsDir->GetPath(&componentDescriptor);
if (!componentDescriptor)
return NS_ERROR_NULL_POINTER;
mComponentsOffset = strlen(componentDescriptor);
if (componentDescriptor)
nsMemory::Free(componentDescriptor);
if (mNativeComponentLoader) {
/* now that we have the registry, Init the native loader */
rv = mNativeComponentLoader->Init(this, mRegistry);
@ -2102,30 +2090,24 @@ nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
PRBool containedIn;
mComponentsDir->Contains(aSpec, PR_TRUE, &containedIn);
char *persistentDescriptor;
if (containedIn){
rv = aSpec->GetPath(&persistentDescriptor);
if (NS_FAILED(rv))
return rv;
nsXPIDLCString relativeLocation;
if (NS_FAILED(rv = aSpec->GetLeafName(getter_Copies(relativeLocation))))
return rv;
char* relativeLocation = persistentDescriptor + mComponentsOffset + 1;
rv = MakeRegistryName(relativeLocation, XPCOM_RELCOMPONENT_PREFIX,
rv = MakeRegistryName(relativeLocation.get(), XPCOM_RELCOMPONENT_PREFIX,
aRegistryName);
} else {
nsXPIDLCString absoluteLocation;
/* absolute names include volume info on Mac, so persistent descriptor */
rv = aSpec->GetPath(&persistentDescriptor);
rv = aSpec->GetPath(getter_Copies(absoluteLocation));
if (NS_FAILED(rv))
return rv;
rv = MakeRegistryName(persistentDescriptor, XPCOM_ABSCOMPONENT_PREFIX,
rv = MakeRegistryName(absoluteLocation.get(), XPCOM_ABSCOMPONENT_PREFIX,
aRegistryName);
}
if (persistentDescriptor)
nsMemory::Free(persistentDescriptor);
return rv;
}

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

@ -205,7 +205,6 @@ protected:
nsNativeComponentLoader *mNativeComponentLoader;
nsIComponentLoader *mStaticComponentLoader;
nsCOMPtr<nsIFile> mComponentsDir;
PRInt32 mComponentsOffset;
// Shutdown
#define NS_SHUTDOWN_NEVERHAPPENED 0