Bug 1189967 - Avoid including <string> from Char16.h. r=nfroyd

Since Char16.h is included everywhere, and MSVC 2015 uses the char16ptr_t trick
it contains, we include <string> everywhere, but that has the side effect of
breaking the build in subtle ways. One way around this would be to avoid including
Char16.h in the first place, but that requires more work than I was ready to put
in. So instead, just avoid including <string> by removing the conversion operator
for std::wstring.
This commit is contained in:
Mike Hommey 2015-08-21 16:05:40 +09:00
parent 8d4c5b336d
commit 672db6ba31
2 changed files with 6 additions and 5 deletions

View File

@ -49,7 +49,7 @@ typedef unsigned int char32_t;
#endif
#ifdef MOZ_USE_CHAR16_WRAPPER
# include <string>
# include <cstdint>
/**
* Win32 API extensively uses wchar_t, which is represented by a separated
* builtin type than char16_t per spec. It's not the case for MSVC prior to
@ -93,10 +93,6 @@ public:
{
return mPtr != nullptr;
}
operator std::wstring() const
{
return std::wstring(static_cast<const wchar_t*>(*this));
}
/* Explicit cast operators to allow things like (char16_t*)str. */
explicit operator char16_t*() const

View File

@ -7,6 +7,11 @@
#include "mozilla/Compression.h"
#include "mozilla/CheckedInt.h"
// Without including <string>, MSVC 2015 complains about e.g. the impossibility
// to convert `const void* const` to `void*` when calling memchr from
// corecrt_memory.h.
#include <string>
using namespace mozilla::Compression;
namespace {