From 0c24b48be8031d56c69d528b93d4454ded06dd4f Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 4 May 2017 11:51:06 +0100 Subject: [PATCH] Fix for detection of number of CPU cores on Windows --- modules/juce_core/native/juce_win32_SystemStats.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 0207014bb4..2361a8d4eb 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -99,10 +99,10 @@ static int findNumberOfPhysicalCores() noexcept { int numPhysicalCores = 0; DWORD bufferSize = 0; + GetLogicalProcessorInformation (nullptr, &bufferSize); - if (GetLogicalProcessorInformation (nullptr, &bufferSize)) + if (auto numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) { - const size_t numBuffers = (size_t) (bufferSize / sizeof (SYSTEM_LOGICAL_PROCESSOR_INFORMATION)); HeapBlock buffer (numBuffers); if (GetLogicalProcessorInformation (buffer, &bufferSize))