]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix compilation on windows
authorSean Purcell <me@seanp.xyz>
Thu, 13 Apr 2017 21:03:56 +0000 (14:03 -0700)
committerSean Purcell <me@seanp.xyz>
Thu, 13 Apr 2017 21:04:10 +0000 (14:04 -0700)
programs/util.h

index 104f8dad2741a8835bc2ef634263fb2b7d584dc8..63cfa9647e6ad908e723a394cb6e8eae4c9a4f69 100644 (file)
@@ -536,12 +536,16 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
             }
         }
 
+        ptr = buffer;
+
         while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) {
-            ptr = buffer;
 
-            if (ptr->RelationShip == RelationProcessorCore) {
+            if (ptr->Relationship == RelationProcessorCore) {
                 numPhysicalCores++;
             }
+
+            ptr++;
+            byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
         }
 
         free(buffer);
@@ -551,10 +555,11 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
 
 failed:
     /* try to fall back on GetSystemInfo */
-    SYSTEM_INFO sysinfo;
-    GetSystemInfo(&sysinfo);
-    numPhysicalCores = sysinfo.dwNumberOfProcessors;
-    if (numPhysicalCores == 0) numPhysicalCores = 1; /* just in case */
+    {   SYSTEM_INFO sysinfo;
+        GetSystemInfo(&sysinfo);
+        numPhysicalCores = sysinfo.dwNumberOfProcessors;
+        if (numPhysicalCores == 0) numPhysicalCores = 1; /* just in case */
+    }
     return numPhysicalCores;
 }