changeset 5984:532c6ba0156f

octave-launch: Fix error when counting processor cores (bug #61208). * installer-files/octave-launch.c (get_num_physical_cores): Count offset between structures in bytes.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 26 Nov 2021 22:54:08 +0100
parents ffbb9aea3c2a
children 1b5d45d7afd4
files installer-files/octave-launch.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/installer-files/octave-launch.c	Fri Nov 26 17:47:02 2021 +0100
+++ b/installer-files/octave-launch.c	Fri Nov 26 22:54:08 2021 +0100
@@ -41,7 +41,7 @@
 static size_t get_num_physical_cores (void)
 {
   DWORD length;
-  PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX lpi;
+  void *lpi;
   BOOL res;
   size_t num_physical_cores;
   size_t offset;
@@ -52,7 +52,10 @@
     return 0;
 
   lpi = malloc (length);
-  res = GetLogicalProcessorInformationEx (RelationProcessorCore, lpi, &length);
+  res = GetLogicalProcessorInformationEx
+          (RelationProcessorCore,
+           (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) lpi,
+           &length);
   if (! res)
     {
       free (lpi);