winsdk: Fix releases showing as older than alphas
authorLenny Komow <lenny@lunarg.com>
Fri, 2 Sep 2016 20:05:45 +0000 (14:05 -0600)
committerLenny Komow <lenny@lunarg.com>
Fri, 2 Sep 2016 20:06:53 +0000 (14:06 -0600)
windowsRuntimeInstaller/configure_runtime.c

index bc5a6b0..a8460a1 100644 (file)
@@ -270,6 +270,7 @@ int add_explicit_layers(FILE* log, const char* install_path, enum Platform platf
 \r
 int compare_versions(const struct SDKVersion* a, const struct SDKVersion* b)\r
 {\r
+    // Compare numerical versions\r
     for(int i = 0; i < 4; ++i) {\r
         long* a_current = ((long*) a) + i;\r
         long* b_current = ((long*) b) + i;\r
@@ -281,6 +282,14 @@ int compare_versions(const struct SDKVersion* a, const struct SDKVersion* b)
         }\r
     }\r
     \r
+    // An empty string should be considered greater (and therefore more recent) than one with test\r
+    if(a->extended[0] == '\0' && b->extended[0] != '\0') {\r
+        return 1;\r
+    } else if(b->extended[0] == '\0' && a->extended[0] != '\0') {\r
+        return -1;\r
+    }\r
+\r
+    // Otherwise, just do a strncmp\r
     return strncmp(a->extended, b->extended, SDK_VERSION_BUFFER_SIZE);\r
 }\r
 \r