mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 347752 - Crash [@ MSVCR80.dll] when using nsIProperties service get method with null argumentp=Alfred Kayser <alfredkayser@nl.ibm.com>r=darin, sr=dougt
This commit is contained in:
parent
cb574d2844
commit
4f83fa46f3
@ -49,6 +49,8 @@ NS_INTERFACE_MAP_END
|
||||
NS_IMETHODIMP
|
||||
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCOMPtr<nsISupports> value;
|
||||
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -59,12 +61,16 @@ nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||
NS_IMETHODIMP
|
||||
nsProperties::Set(const char* prop, nsISupports* value)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsProperties::Undefine(const char* prop)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCOMPtr<nsISupports> value;
|
||||
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value)))
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -76,6 +82,8 @@ nsProperties::Undefine(const char* prop)
|
||||
NS_IMETHODIMP
|
||||
nsProperties::Has(const char* prop, PRBool *result)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCOMPtr<nsISupports> value;
|
||||
*result = nsProperties_HashBase::Get(prop,
|
||||
getter_AddRefs(value));
|
||||
@ -108,10 +116,12 @@ GetKeysEnumerate(const char *key, nsISupports* data,
|
||||
NS_IMETHODIMP
|
||||
nsProperties::GetKeys(PRUint32 *count, char ***keys)
|
||||
{
|
||||
NS_ENSURE_ARG(count);
|
||||
NS_ENSURE_ARG(keys);
|
||||
|
||||
PRUint32 n = Count();
|
||||
char ** k = (char **) nsMemory::Alloc(n * sizeof(char *));
|
||||
if (!k)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ENSURE_TRUE(k, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
GetKeysEnumData gked;
|
||||
gked.keys = k;
|
||||
|
@ -530,6 +530,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectorySer
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryService::Undefine(const char* prop)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCStringKey key(prop);
|
||||
if (!mHashtable.Exists(&key))
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -608,6 +610,8 @@ static PRBool FindProviderFile(nsISupports* aElement, void *aData)
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCStringKey key(prop);
|
||||
|
||||
nsCOMPtr<nsISupports> value = dont_AddRef(mHashtable.Get(&key));
|
||||
@ -656,6 +660,8 @@ nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryService::Set(const char* prop, nsISupports* value)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
nsCStringKey key(prop);
|
||||
if (mHashtable.Exists(&key) || value == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -677,6 +683,8 @@ nsDirectoryService::Set(const char* prop, nsISupports* value)
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryService::Has(const char *prop, PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
*_retval = PR_FALSE;
|
||||
nsCOMPtr<nsIFile> value;
|
||||
nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));
|
||||
|
Loading…
x
Reference in New Issue
Block a user