diff options
author | Philip Kelley <phkelley@hotmail.com> | 2013-03-31 22:22:33 -0400 |
---|---|---|
committer | Philip Kelley <phkelley@hotmail.com> | 2013-03-31 22:22:33 -0400 |
commit | 5c5eeba6fda50e350c5e007ed5d59f8ca92ad0d8 (patch) | |
tree | 2160f5a4a1ef45e64c4ec1a09ff792fd50088e81 /src/win32 | |
parent | 8cc2f2d86fa8a54b1ba87564c046e2e431e4ced0 (diff) | |
download | libgit2-5c5eeba6fda50e350c5e007ed5d59f8ca92ad0d8.tar.gz |
Add git_has_win32_version helper
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/error.c | 2 | ||||
-rw-r--r-- | src/win32/version.h | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/win32/error.c b/src/win32/error.c index 4f169cf4d..4a9a0631f 100644 --- a/src/win32/error.c +++ b/src/win32/error.c @@ -45,7 +45,7 @@ char *git_win32_get_error_message(DWORD error_code) (LPWSTR)&lpMsgBuf, 0, NULL)) { /* Invalid code point check supported on Vista+ only */ - if (LOBYTE(LOWORD(GetVersion())) >= 6) + if (git_has_win32_version(6, 0)) dwFlags = WC_ERR_INVALID_CHARS; else dwFlags = 0; diff --git a/src/win32/version.h b/src/win32/version.h new file mode 100644 index 000000000..803cc60e2 --- /dev/null +++ b/src/win32/version.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_win32_version_h__ +#define INCLUDE_win32_version_h__ + +#include <windows.h> + +GIT_INLINE(int) git_has_win32_version(int major, int minor) +{ + WORD wVersion = LOWORD(GetVersion()); + + return LOBYTE(wVersion) > major || + (LOBYTE(wVersion) == major && HIBYTE(wVersion) >= minor); +} + +#endif
\ No newline at end of file |