mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	win: Fix MSVC compile errors in registry.cc (fixes #3519)
This commit is contained in:
		@@ -521,6 +521,12 @@ patches = [
 | 
			
		||||
    # Avoid usage of PartitionAlloc assertions (PA_BASE_CHECK) in raw_ptr.h.
 | 
			
		||||
    'name': 'base_sandbox_2743',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    # Windows: Fix MSVC compile errors using base::MakeFixedFlatMapSorted
 | 
			
		||||
    # in registry.cc when building cef_sandbox.
 | 
			
		||||
    # https://github.com/chromiumembedded/cef/issues/3519
 | 
			
		||||
    'name': 'base_sandbox_3519',
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    # Add RenderWidgetHostImpl::SetCompositorForFlingScheduler to fix fling
 | 
			
		||||
    # scrolling in OSR mode.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										62
									
								
								patch/patches/base_sandbox_3519.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								patch/patches/base_sandbox_3519.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
diff --git base/ranges/ranges.h base/ranges/ranges.h
 | 
			
		||||
index 641bbaf2c7576..afdd641e38452 100644
 | 
			
		||||
--- base/ranges/ranges.h
 | 
			
		||||
+++ base/ranges/ranges.h
 | 
			
		||||
@@ -30,12 +30,14 @@ constexpr T* begin(std::array<T, N>& array, priority_tag<2> tag) {
 | 
			
		||||
   return const_cast<T*>(begin(const_cast<const std::array<T, N>&>(array), tag));
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#if !defined(CEF_EXCLUDE_PROBLEMATIC_CONST_ARRAY_OVERLOADS)
 | 
			
		||||
 // Overload for const std::array. Required since std::array::begin is not
 | 
			
		||||
 // constexpr prior to C++17.
 | 
			
		||||
 template <typename T, size_t N>
 | 
			
		||||
 constexpr const T* begin(const std::array<T, N>& array, priority_tag<2>) {
 | 
			
		||||
   return N != 0 ? &array[0] : nullptr;
 | 
			
		||||
 }
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 // Generic container overload.
 | 
			
		||||
 template <typename Range>
 | 
			
		||||
@@ -65,12 +67,14 @@ constexpr T* end(std::array<T, N>& array, priority_tag<2> tag) {
 | 
			
		||||
   return const_cast<T*>(end(const_cast<const std::array<T, N>&>(array), tag));
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#if !defined(CEF_EXCLUDE_PROBLEMATIC_CONST_ARRAY_OVERLOADS)
 | 
			
		||||
 // Overload for const std::array. Required since std::array::end is not
 | 
			
		||||
 // constexpr prior to C++17.
 | 
			
		||||
 template <typename T, size_t N>
 | 
			
		||||
 constexpr const T* end(const std::array<T, N>& array, priority_tag<2>) {
 | 
			
		||||
   return N != 0 ? (&array[0]) + N : nullptr;
 | 
			
		||||
 }
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 // Generic container overload.
 | 
			
		||||
 template <typename Range>
 | 
			
		||||
diff --git base/win/registry.cc base/win/registry.cc
 | 
			
		||||
index 473f5fdc861ce..eb85a31611560 100644
 | 
			
		||||
--- base/win/registry.cc
 | 
			
		||||
+++ base/win/registry.cc
 | 
			
		||||
@@ -13,6 +13,14 @@
 | 
			
		||||
 #include <utility>
 | 
			
		||||
 #include <vector>
 | 
			
		||||
 
 | 
			
		||||
+#include "cef/libcef/features/features.h"
 | 
			
		||||
+
 | 
			
		||||
+#if BUILDFLAG(IS_CEF_SANDBOX_BUILD)
 | 
			
		||||
+// Avoid overloads for const std::array in base/ranges/ranges.h that don't
 | 
			
		||||
+// compile with MSVC. See issue #3519.
 | 
			
		||||
+#define CEF_EXCLUDE_PROBLEMATIC_CONST_ARRAY_OVERLOADS 1
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 #include "base/check_op.h"
 | 
			
		||||
 #include "base/containers/fixed_flat_map.h"
 | 
			
		||||
 #include "base/functional/callback.h"
 | 
			
		||||
@@ -314,7 +322,7 @@ class ExportDerived {
 | 
			
		||||
             {"RegSetValueExW", reinterpret_cast<void**>(®_set_value_ex_)},
 | 
			
		||||
         });
 | 
			
		||||
 
 | 
			
		||||
-    auto* entry = kMap.find(name);
 | 
			
		||||
+    auto entry = kMap.find(name);
 | 
			
		||||
     if (entry == kMap.end()) {
 | 
			
		||||
       return true;
 | 
			
		||||
     }
 | 
			
		||||
		Reference in New Issue
	
	Block a user