mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 559695 - warning C4700: uninitialized local variable 'rv' used in nsStorageFormHistory.cpp [r=gavin]
Hard code return of NS_ERROR_OUT_OF_MEMORY on failure to createInstance. Push down declarations of rv to its first assignment.
This commit is contained in:
parent
f3bcbe0252
commit
161443de41
@ -1032,15 +1032,13 @@ nsresult
|
||||
nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
const nsAString &aName)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISupportsString> fieldName = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
|
||||
if (!fieldName)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
fieldName->SetData(aName);
|
||||
|
||||
rv = SendNotification(aChangeType, fieldName);
|
||||
nsresult rv = SendNotification(aChangeType, fieldName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
@ -1055,8 +1053,6 @@ nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
const nsAString &aValue,
|
||||
const nsAutoString &aGuid)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISupportsString> fieldName = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
|
||||
if (!fieldName)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1074,11 +1070,11 @@ nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
guid->SetData(aGuid);
|
||||
|
||||
|
||||
nsCOMPtr<nsIMutableArray> notifyData = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (!notifyData)
|
||||
return rv;
|
||||
rv = notifyData->AppendElement(fieldName, PR_FALSE);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = notifyData->AppendElement(fieldName, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = notifyData->AppendElement(fieldValue, PR_FALSE);
|
||||
@ -1100,15 +1096,13 @@ nsresult
|
||||
nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
const PRInt64 &aNumber)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt64> valOne = do_CreateInstance(NS_SUPPORTS_PRINT64_CONTRACTID);
|
||||
if (!valOne)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
valOne->SetData(aNumber);
|
||||
|
||||
rv = SendNotification(aChangeType, valOne);
|
||||
nsresult rv = SendNotification(aChangeType, valOne);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
@ -1122,8 +1116,6 @@ nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
const PRInt64 &aOne,
|
||||
const PRInt64 &aTwo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISupportsPRInt64> valOne = do_CreateInstance(NS_SUPPORTS_PRINT64_CONTRACTID);
|
||||
if (!valOne)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1138,8 +1130,9 @@ nsFormHistory::SendNotification(const nsAString &aChangeType,
|
||||
|
||||
nsCOMPtr<nsIMutableArray> notifyData = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
if (!notifyData)
|
||||
return rv;
|
||||
rv = notifyData->AppendElement(valOne, PR_FALSE);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = notifyData->AppendElement(valOne, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = notifyData->AppendElement(valTwo, PR_FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user