mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1784205 - Avoid returning SIID_INVALID as a SHSTOCKICONID because it's not part of the enum. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D154355
This commit is contained in:
parent
24252edb7e
commit
99d04c97e8
@ -258,8 +258,8 @@ static nsresult GetIconHandleFromPathInfo(const IconPathInfo& aPathInfo,
|
||||
}
|
||||
|
||||
// Match stock icons with names
|
||||
static SHSTOCKICONID GetStockIconIDForName(const nsACString& aStockName) {
|
||||
return aStockName.EqualsLiteral("uac-shield") ? SIID_SHIELD : SIID_INVALID;
|
||||
static mozilla::Maybe<SHSTOCKICONID> GetStockIconIDForName(const nsACString& aStockName) {
|
||||
return aStockName.EqualsLiteral("uac-shield") ? Some(SIID_SHIELD) : Nothing();
|
||||
}
|
||||
|
||||
// Specific to Vista and above
|
||||
@ -269,8 +269,8 @@ static nsresult GetStockHIcon(nsIMozIconURI* aIconURI, HICON* aIcon) {
|
||||
nsAutoCString stockIcon;
|
||||
aIconURI->GetStockIcon(stockIcon);
|
||||
|
||||
SHSTOCKICONID stockIconID = GetStockIconIDForName(stockIcon);
|
||||
if (stockIconID == SIID_INVALID) {
|
||||
Maybe<SHSTOCKICONID> stockIconID = GetStockIconIDForName(stockIcon);
|
||||
if (stockIconID.isNothing()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ static nsresult GetStockHIcon(nsIMozIconURI* aIconURI, HICON* aIcon) {
|
||||
|
||||
SHSTOCKICONINFO sii = {0};
|
||||
sii.cbSize = sizeof(sii);
|
||||
HRESULT hr = SHGetStockIconInfo(stockIconID, infoFlags, &sii);
|
||||
HRESULT hr = SHGetStockIconInfo(*stockIconID, infoFlags, &sii);
|
||||
if (FAILED(hr)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user