diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Toaster/src/string_reference_wrapper.h | 2 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 29 |
2 files changed, 16 insertions, 15 deletions
diff --git a/plugins/Toaster/src/string_reference_wrapper.h b/plugins/Toaster/src/string_reference_wrapper.h index 4ce37d5245..6daeb0fee1 100644 --- a/plugins/Toaster/src/string_reference_wrapper.h +++ b/plugins/Toaster/src/string_reference_wrapper.h @@ -25,7 +25,7 @@ public: template <size_t _>
StringReferenceWrapper(_In_reads_(_) wchar_t(&stringRef)[_]) throw()
{
- size_t length = wcslen(stringRef);
+ size_t length = mir_wstrlen(stringRef);
WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
}
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index b681d3ce85..2e9bf89596 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -27,18 +27,19 @@ HRESULT ToastNotification::GetNodeByTag(_In_ HSTRING tagName, _Outptr_ ABI::Wind {
Microsoft::WRL::ComPtr<ABI::Windows::Data::Xml::Dom::IXmlNodeList> nodeList;
HRESULT hr = xml->GetElementsByTagName(tagName, &nodeList);
- if (FAILED(hr))
- return hr;
-
- UINT32 length;
- hr = nodeList->get_Length(&length);
- if (FAILED(hr))
- return hr;
-
- if (length == 0)
- return E_INVALIDARG;
-
- return nodeList->Item(0, node);
+ if (SUCCEEDED(hr))
+ {
+ UINT32 length;
+ hr = nodeList->get_Length(&length);
+ if (SUCCEEDED(hr))
+ {
+ if (length)
+ hr = nodeList->Item(0, node);
+ else
+ hr = E_INVALIDARG;
+ }
+ }
+ return hr;
}
HRESULT ToastNotification::AddNode(_In_ HSTRING name, _Outptr_ ABI::Windows::Data::Xml::Dom::IXmlNode **node, _In_ ABI::Windows::Data::Xml::Dom::IXmlNode *rootNode, _In_ ABI::Windows::Data::Xml::Dom::IXmlDocument* xml)
@@ -92,14 +93,14 @@ HRESULT ToastNotification::SetTextValues(_In_reads_(textValuesCount) wchar_t** t if (FAILED(hr))
return hr;
- for (UINT32 i = 0; i < textValuesCount; i++)
+ for (UINT i = 0; i < textValuesCount; i++)
{
Microsoft::WRL::ComPtr<ABI::Windows::Data::Xml::Dom::IXmlNode> textNode;
hr = nodeList->Item(i, &textNode);
if (FAILED(hr))
return hr;
- hr = SetNodeValueString(StringReferenceWrapper(textValues[i], (UINT32)wcslen(textValues[i])).Get(), textNode.Get(), xml);
+ hr = SetNodeValueString(StringReferenceWrapper(textValues[i], (UINT32)(mir_wstrlen(textValues[i]))).Get(), textNode.Get(), xml);
if (FAILED(hr))
return hr;
}
|