[PATCH 1/2] Added a generic function to check if the current OS is 'old'

Lubomir I. Ivanov neolit123 at gmail.com
Fri Oct 19 12:36:02 PDT 2012


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

Present in window.c, linux.c, macos.c, the function can be used
to set a threshold for a certain set of features.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 dive.h    | 1 +
 linux.c   | 5 +++++
 macos.c   | 5 +++++
 windows.c | 9 +++++++++
 4 files changed, 20 insertions(+)

diff --git a/dive.h b/dive.h
index d88ee1d..8bf47d2 100644
--- a/dive.h
+++ b/dive.h
@@ -441,6 +441,7 @@ extern const char *default_filename;
 extern const char *existing_filename;
 extern const char *subsurface_default_filename(void);
 extern const char *subsurface_gettext_domainpath(char *);
+extern gboolean subsurface_check_old_os(void);
 extern void subsurface_command_line_init(gint *, gchar ***);
 extern void subsurface_command_line_exit(gint *, gchar ***);
 #define AIR_PERMILLE 209
diff --git a/linux.c b/linux.c
index c11bc2f..f499928 100644
--- a/linux.c
+++ b/linux.c
@@ -112,3 +112,8 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
 {
 	/* this is a no-op */
 }
+
+gboolean subsurface_check_old_os(void)
+{
+	return FALSE;
+}
diff --git a/macos.c b/macos.c
index fb76088..7d69897 100644
--- a/macos.c
+++ b/macos.c
@@ -172,3 +172,8 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
 {
 	/* this is a no-op */
 }
+
+gboolean subsurface_check_old_os(void)
+{
+	return FALSE;
+}
diff --git a/windows.c b/windows.c
index 1c8cd0a..3865b44 100644
--- a/windows.c
+++ b/windows.c
@@ -223,3 +223,12 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
 		g_free((*argv)[i]);
 	g_free(*argv);
 }
+
+/* check if we are running a newer OS version */
+gboolean subsurface_check_old_os(void)
+{
+	if ((GetVersion() & 0xff) < 6)
+		return TRUE; /* less than vista */
+	else
+		return FALSE;
+}
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list