Removed "" around linux version number in hardware report,
compiler warning and windows line endings.
This commit is contained in:
parent
9de7d11ee4
commit
6a47c157d2
@ -124,7 +124,6 @@ bool readEtcReleaseFile(const std::string &filename)
|
||||
{
|
||||
std::ifstream in(filename);
|
||||
std::string s, distro, version;
|
||||
int bits = 0;
|
||||
while( (distro.empty() || version.empty()) &&
|
||||
std::getline(in, s) )
|
||||
{
|
||||
@ -135,6 +134,8 @@ bool readEtcReleaseFile(const std::string &filename)
|
||||
}
|
||||
if(!distro.empty() && !version.empty())
|
||||
{
|
||||
distro = StringUtils::replace(distro, "\"", "");
|
||||
version = StringUtils::replace(version, "\"", "");
|
||||
m_os_version = distro + " " + version;
|
||||
return true;
|
||||
}
|
||||
@ -167,36 +168,36 @@ void determineOSVersion()
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
// (C) 2014 by Wildfire Games (0 A.D.), ported by Joerg Henrichs.
|
||||
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
|
||||
KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
m_os_version = "windows-unknown";
|
||||
return;
|
||||
}
|
||||
char windows_version_string[20];
|
||||
DWORD size = sizeof(windows_version_string);
|
||||
RegQueryValueEx(hKey, "CurrentVersion", 0, 0, (LPBYTE)windows_version_string, &size);
|
||||
unsigned major = 0, minor = 0;
|
||||
const int ret = sscanf_s(windows_version_string, "%u.%u", &major, &minor);
|
||||
int windows_version = (major << 8) | minor;
|
||||
RegCloseKey(hKey);
|
||||
|
||||
switch(windows_version)
|
||||
{
|
||||
case 0x0500: m_os_version="Windows 2000"; break;
|
||||
case 0x0501: m_os_version="Windows XP"; break;
|
||||
case 0x0502: m_os_version="Windows XP64"; break;
|
||||
case 0x0600: m_os_version="Windows Vista"; break;
|
||||
case 0x0601: m_os_version="Windows 7"; break;
|
||||
case 0x0602: m_os_version="Windows 8"; break;
|
||||
default: {
|
||||
m_os_version = StringUtils::insertValues("Windows %d",
|
||||
windows_version);
|
||||
break;
|
||||
}
|
||||
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
|
||||
KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
m_os_version = "windows-unknown";
|
||||
return;
|
||||
}
|
||||
char windows_version_string[20];
|
||||
DWORD size = sizeof(windows_version_string);
|
||||
RegQueryValueEx(hKey, "CurrentVersion", 0, 0, (LPBYTE)windows_version_string, &size);
|
||||
unsigned major = 0, minor = 0;
|
||||
const int ret = sscanf_s(windows_version_string, "%u.%u", &major, &minor);
|
||||
int windows_version = (major << 8) | minor;
|
||||
RegCloseKey(hKey);
|
||||
|
||||
switch(windows_version)
|
||||
{
|
||||
case 0x0500: m_os_version="Windows 2000"; break;
|
||||
case 0x0501: m_os_version="Windows XP"; break;
|
||||
case 0x0502: m_os_version="Windows XP64"; break;
|
||||
case 0x0600: m_os_version="Windows Vista"; break;
|
||||
case 0x0601: m_os_version="Windows 7"; break;
|
||||
case 0x0602: m_os_version="Windows 8"; break;
|
||||
default: {
|
||||
m_os_version = StringUtils::insertValues("Windows %d",
|
||||
windows_version);
|
||||
break;
|
||||
}
|
||||
} // switch
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user