Windows: Fix VS2008 compile error (issue #2155)

This commit is contained in:
Marshall Greenblatt 2017-04-26 12:15:59 -04:00
parent 3f71138d64
commit 10fccbd6cf
5 changed files with 12 additions and 5 deletions

View File

@ -186,10 +186,13 @@ using CefOwnPtr = scoped_ptr<T, D>;
// A CefRawPtr<T> is the same as T* // A CefRawPtr<T> is the same as T*
/// ///
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT) #if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
#define CEF_RAW_PTR_GET(r) r
template <class T> template <class T>
using CefRawPtr = T*; using CefRawPtr = T*;
#else #else
// Simple wrapper implementation that behaves as much like T* as possible. // Simple wrapper implementation that behaves as much like T* as possible.
// CEF_RAW_PTR_GET is required for VS2008 compatibility (Issue #2155).
#define CEF_RAW_PTR_GET(r) r.get()
template <class T> template <class T>
class CefRawPtr { class CefRawPtr {
public: public:

View File

@ -58,7 +58,8 @@ template<> cef_translator_test_scoped_client_t* CefCToCppScoped<CefTranslatorTes
return reinterpret_cast<cef_translator_test_scoped_client_t*>( return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw( CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedClientChild>( CefRawPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c)))); reinterpret_cast<CefTranslatorTestScopedClientChild*>(CEF_RAW_PTR_GET(
c)))));
} }
NOTREACHED() << "Unexpected class type: " << type; NOTREACHED() << "Unexpected class type: " << type;
return NULL; return NULL;

View File

@ -117,7 +117,8 @@ template<> cef_translator_test_scoped_library_child_t* CefCToCppScoped<CefTransl
return reinterpret_cast<cef_translator_test_scoped_library_child_t*>( return reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw( CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>( CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c)))); reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
} }
NOTREACHED() << "Unexpected class type: " << type; NOTREACHED() << "Unexpected class type: " << type;
return NULL; return NULL;

View File

@ -94,13 +94,15 @@ template<> cef_translator_test_scoped_library_t* CefCToCppScoped<CefTranslatorTe
return reinterpret_cast<cef_translator_test_scoped_library_t*>( return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw( CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChild>( CefRawPtr<CefTranslatorTestScopedLibraryChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(c)))); reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(CEF_RAW_PTR_GET(
c)))));
} }
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) { if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>( return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw( CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>( CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c)))); reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
} }
NOTREACHED() << "Unexpected class type: " << type; NOTREACHED() << "Unexpected class type: " << type;
return NULL; return NULL;

View File

@ -550,7 +550,7 @@ def make_ctocpp_unwrap_derived(header, cls, base_scoped):
' }\n' ' }\n'
impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\ impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\ ' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\
clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(c))));\n'+\ clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(CEF_RAW_PTR_GET(c)))));\n'+\
' }\n' ' }\n'
else: else:
impl = '' impl = ''