272
edits
No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
<span class="highlightblue">+ LossyCopyUTF16toASCII(uniValue, charValue);</span> | <span class="highlightblue">+ LossyCopyUTF16toASCII(uniValue, charValue);</span> | ||
nsCString charStr; | nsCString charStr; | ||
<span class="highlightred">-PL_strchr(uri.get(), ' ')</span> | <span class="highlightred">- PL_strchr(uri.get(), ' ')</span> | ||
<span class="highlightblue">+ uri.FindChar(' '); (kNotFound)</span> | <span class="highlightblue">+ uri.FindChar(' '); (kNotFound)</span> | ||
nsCString charStr; | |||
<span class="highlightred">- PL_strcasecmp(charStr.get(), "nocopy://")</span> | |||
<span class="highlightblue">+ charStr.LowerCaseEqualsLiteral("nocopy://")</span> | |||
== nsCOMPtr == | == nsCOMPtr == | ||
Use swap to assign an object wrapped by a nsCOMPtr into a return variable | Use swap to assign an object wrapped by a nsCOMPtr into a return variable. This saves the cost of a reference count. Don't do this when the nsCOMPtr object is a member variable of a class or you want to use | ||
nsCOMPtr<nsIMsgIdentity> identity; | |||
<span class="highlightred">- NS_IF_ADDREF(*aIdentity = identity);</span> | |||
<span class="highlightblue">+ identity.swap(*aIdentity);</span> | |||
return NS_OK; | |||
<span class="highlightred">- *aIdentity = m_identity; | |||
- NS_IF_ADDREF(*aIdentity);</span> | |||
<span class="highlightblue">+ NS_IF_ADDREF(*aIdentity = m_identity);</span> | |||
== Validating Input Arguments == | == Validating Input Arguments == | ||
Line 61: | Line 48: | ||
Use do_QueryElementAt to get an element from an nsISupportsArray. | Use do_QueryElementAt to get an element from an nsISupportsArray. | ||
nsCOMPtr<nsISupportsArray> identityArray; | |||
<span class="highlightred">- nsCOMPtr<nsIMsgIdentity> identity; | |||
- rv = identityArray->QueryElementAt(index, NS_GET_IID(nsIMsgIdentity), | |||
(void **)getter_AddRefs(identity));</span> | |||
<span class="highlightblue">+ nsCOMPtr<nsIMsgIdentity> identity( do_QueryElementAt(identityArray, i, &rv));</span> | |||
nsCOMPtr<nsISupportsArray> identityArray; | |||
<span class="highlightred">- nsCOMPtr<nsISupports> thisElement; | |||
- identityArray->GetElementAt(index, getter_AddRefs(thisElement)); | |||
- nsCOMPtr<nsIMsgIdentity> identity = do_QueryInterface(thisElement, &rv);</span> | |||
<span class="highlightblue">+ nsCOMPtr<nsIMsgIdentity> identity( do_QueryElementAt(identityArray, i, &rv));</span> |
edits