From 10fccbd6cfad95e46ab2fd37ed6ab96f9b0fda1e Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 26 Apr 2017 12:15:59 -0400 Subject: [PATCH] Windows: Fix VS2008 compile error (issue #2155) --- include/internal/cef_ptr.h | 3 +++ .../ctocpp/test/translator_test_scoped_client_ctocpp.cc | 3 ++- .../test/translator_test_scoped_library_child_ctocpp.cc | 3 ++- .../ctocpp/test/translator_test_scoped_library_ctocpp.cc | 6 ++++-- tools/make_ctocpp_impl.py | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/internal/cef_ptr.h b/include/internal/cef_ptr.h index 25ce74557..7883c98cb 100644 --- a/include/internal/cef_ptr.h +++ b/include/internal/cef_ptr.h @@ -186,10 +186,13 @@ using CefOwnPtr = scoped_ptr; // A CefRawPtr is the same as T* /// #if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT) +#define CEF_RAW_PTR_GET(r) r template using CefRawPtr = T*; #else // 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 CefRawPtr { public: diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc index 7908e4a4f..810c50ae8 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc @@ -58,7 +58,8 @@ template<> cef_translator_test_scoped_client_t* CefCToCppScoped( CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast(c)))); + reinterpret_cast(CEF_RAW_PTR_GET( + c))))); } NOTREACHED() << "Unexpected class type: " << type; return NULL; diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc index af2fd8bcb..b437f92fc 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc @@ -117,7 +117,8 @@ template<> cef_translator_test_scoped_library_child_t* CefCToCppScoped( CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast(c)))); + reinterpret_cast( + CEF_RAW_PTR_GET(c))))); } NOTREACHED() << "Unexpected class type: " << type; return NULL; diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc index c120dd626..1a7db5f24 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc @@ -94,13 +94,15 @@ template<> cef_translator_test_scoped_library_t* CefCToCppScoped( CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast(c)))); + reinterpret_cast(CEF_RAW_PTR_GET( + c))))); } if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) { return reinterpret_cast( CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast(c)))); + reinterpret_cast( + CEF_RAW_PTR_GET(c))))); } NOTREACHED() << "Unexpected class type: " << type; return NULL; diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py index f6d13db63..36e7eed8c 100644 --- a/tools/make_ctocpp_impl.py +++ b/tools/make_ctocpp_impl.py @@ -550,7 +550,7 @@ def make_ctocpp_unwrap_derived(header, cls, base_scoped): ' }\n' impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\ ' 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' else: impl = ''