summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/string_reference_wrapper.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-12-29 19:59:31 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-12-29 19:59:31 +0000
commit544fb33475eb7ea1735f9e19f78dcf3c5e1ceb66 (patch)
tree9bcf88888f81aeb7e17ad20d9e7fd6fefa684725 /plugins/Toaster/src/string_reference_wrapper.h
parent99034f294331209fbfa1d5efacf7fb25f88e227d (diff)
Toaster: memleaks fix, code clenup
git-svn-id: http://svn.miranda-ng.org/main/trunk@15967 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Toaster/src/string_reference_wrapper.h')
-rw-r--r--plugins/Toaster/src/string_reference_wrapper.h30
1 files changed, 7 insertions, 23 deletions
diff --git a/plugins/Toaster/src/string_reference_wrapper.h b/plugins/Toaster/src/string_reference_wrapper.h
index 6daeb0fee1..addfb32394 100644
--- a/plugins/Toaster/src/string_reference_wrapper.h
+++ b/plugins/Toaster/src/string_reference_wrapper.h
@@ -1,47 +1,31 @@
-#ifndef _STRING_WRAPPER_H_
-#define _STRING_WRAPPER_H_
+#pragma once
class StringReferenceWrapper
{
public:
StringReferenceWrapper(_In_reads_(length) PCWSTR stringRef, _In_ UINT32 length) throw()
- {
- HRESULT hr = WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
-
- if (FAILED(hr))
- RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+ { WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
}
template <size_t N>
StringReferenceWrapper(_In_reads_(N) wchar_t const (&stringRef)[N]) throw()
- {
- UINT32 length = N - 1;
- HRESULT hr = WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
-
- if (FAILED(hr))
- RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+ { WindowsCreateStringReference(stringRef, (UINT32)(N - 1), &_header, &_hstring);
}
template <size_t _>
StringReferenceWrapper(_In_reads_(_) wchar_t(&stringRef)[_]) throw()
- {
- size_t length = mir_wstrlen(stringRef);
- WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
+ { WindowsCreateStringReference(stringRef, mir_wstrlen(stringRef), &_header, &_hstring);
}
~StringReferenceWrapper()
- {
- WindowsDeleteString(_hstring);
+ { WindowsDeleteString(_hstring);
}
HSTRING Get() const throw()
- {
- return _hstring;
+ { return _hstring;
}
private:
HSTRING _hstring;
HSTRING_HEADER _header;
-};
-
-#endif //_STRING_WRAPPER_H_ \ No newline at end of file
+}; \ No newline at end of file