Bug 1671598 [wpt PR 26128] - [AspectRatio] Fix divide by zero with a small float...
[gecko.git] / mozglue / misc / WindowsUnicode.h
blob77fc376b9208763ad174566e73a4226f5c33edc2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_glue_WindowsUnicode_h
8 #define mozilla_glue_WindowsUnicode_h
10 #include "mozilla/UniquePtr.h"
12 #include <string>
14 struct _UNICODE_STRING;
16 namespace mozilla {
17 namespace glue {
19 mozilla::UniquePtr<char[]> WideToUTF8(const wchar_t* aStr,
20 const size_t aStrLenExclNul);
22 mozilla::UniquePtr<char[]> WideToUTF8(const wchar_t* aStr);
23 mozilla::UniquePtr<char[]> WideToUTF8(const std::wstring& aStr);
24 mozilla::UniquePtr<char[]> WideToUTF8(const _UNICODE_STRING* aStr);
26 #if defined(bstr_t)
27 inline mozilla::UniquePtr<char[]> WideToUTF8(const _bstr_t& aStr) {
28 return WideToUTF8(static_cast<const wchar_t*>(aStr), aStr.length());
30 #endif // defined(bstr_t)
32 } // namespace glue
33 } // namespace mozilla
35 #endif // mozilla_glue_WindowsUnicode_h