[Spice-devel] [PATCH] Use enumeration for supported_system_version return type

Frediano Ziglio fziglio at redhat.com
Wed Aug 10 07:17:57 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 common/vdcommon.cpp | 6 +++---
 common/vdcommon.h   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/vdcommon.cpp b/common/vdcommon.cpp
index 4f80a2c..b5b18ac 100644
--- a/common/vdcommon.cpp
+++ b/common/vdcommon.cpp
@@ -17,7 +17,7 @@
 
 #include "vdcommon.h"
 
-int supported_system_version()
+SystemVersion supported_system_version()
 {
     OSVERSIONINFOEX osvi;
 
@@ -25,14 +25,14 @@ int supported_system_version()
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
     if (!GetVersionEx((OSVERSIONINFO*)&osvi)) {
         vd_printf("GetVersionEx() failed: %lu", GetLastError());
-        return 0;
+        return SYS_VER_UNSUPPORTED;
     }
     if (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion == 1 || osvi.dwMinorVersion == 2)) {
         return SYS_VER_WIN_XP_CLASS;
     } else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 0 && osvi.dwMinorVersion <= 2) {
         return SYS_VER_WIN_7_CLASS;
     }
-    return 0;
+    return SYS_VER_UNSUPPORTED;
 }
 
 #ifndef HAVE_STRCAT_S
diff --git a/common/vdcommon.h b/common/vdcommon.h
index bc8ce33..970e6cc 100644
--- a/common/vdcommon.h
+++ b/common/vdcommon.h
@@ -99,7 +99,7 @@ enum SystemVersion {
     SYS_VER_WIN_7_CLASS,  // also Windows 8, Server 2012, Server 2008/R2 & Vista
 };
 
-int supported_system_version();
+SystemVersion supported_system_version();
 
 #endif
 
-- 
2.7.4



More information about the Spice-devel mailing list