https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a03d1860f219d388f3abb…
commit a03d1860f219d388f3abb34c78bafad3767111d4
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Sat Aug 4 00:22:49 2018 +0300
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Aug 12 14:21:56 2018 +0200
[DXDIAG] Minor code style fixes
---
base/applications/dxdiag/system.c | 50 +++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/base/applications/dxdiag/system.c b/base/applications/dxdiag/system.c
index 849a7a5d4e..c10df851e4 100644
--- a/base/applications/dxdiag/system.c
+++ b/base/applications/dxdiag/system.c
@@ -199,26 +199,26 @@ InitializeSystemPage(HWND hwndDlg)
/* set date/time */
szTime[0] = L'\0';
- Length = GetDateFormat(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL, NULL, szTime,
sizeof(szTime) / sizeof(WCHAR));
+ Length = GetDateFormat(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL, NULL, szTime,
_countof(szTime));
if (Length)
{
szTime[Length-1] = L',';
szTime[Length++] = L' ';
}
- Length = GetTimeFormatW(LOCALE_SYSTEM_DEFAULT,
TIME_FORCE24HOURFORMAT|LOCALE_NOUSEROVERRIDE, NULL, NULL, &szTime[Length],
(sizeof(szTime) / sizeof(WCHAR)));
- szTime[199] = L'\0';
+ Length = GetTimeFormatW(LOCALE_SYSTEM_DEFAULT,
TIME_FORCE24HOURFORMAT|LOCALE_NOUSEROVERRIDE, NULL, NULL, szTime + Length,
_countof(szTime));
+ szTime[_countof(szTime)-1] = L'\0';
SendDlgItemMessageW(hwndDlg, IDC_STATIC_TIME, WM_SETTEXT, 0, (LPARAM)szTime);
/* set computer name */
szTime[0] = L'\0';
- Length = sizeof(szTime) / sizeof(WCHAR);
+ Length = _countof(szTime);
if (GetComputerNameW(szTime, &Length))
SendDlgItemMessageW(hwndDlg, IDC_STATIC_COMPUTER, WM_SETTEXT, 0,
(LPARAM)szTime);
/* set product name */
if (GetRegValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion", L"ProductName", REG_SZ, szOSName, sizeof(szOSName)))
{
- if (LoadStringW(hInst, IDS_OS_VERSION, szFormat, sizeof(szFormat) /
sizeof(WCHAR)))
+ if (LoadStringW(hInst, IDS_OS_VERSION, szFormat, _countof(szFormat)))
{
WCHAR szCpuName[50];
@@ -229,14 +229,14 @@ InitializeSystemPage(HWND hwndDlg)
if (GetVersionEx(&VersionInfo))
{
- szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0';
+ szTime[_countof(szTime)-1] = L'\0';
wsprintfW(szTime, szFormat, szOSName, szCpuName,
VersionInfo.dwMajorVersion, VersionInfo.dwMinorVersion, VersionInfo.dwBuildNumber);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_OS, WM_SETTEXT, 0,
(LPARAM)szTime);
}
else
{
/* If the version of the OS cannot be retrieved for some reason, then
just give the OS Name and Architecture */
- szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0';
+ szTime[_countof(szTime)-1] = L'\0';
wsprintfW(szTime, L"%s %s", szOSName, szCpuName);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_OS, WM_SETTEXT, 0,
(LPARAM)szTime);
}
@@ -244,15 +244,15 @@ InitializeSystemPage(HWND hwndDlg)
}
else
{
- if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, sizeof(szTime) /
sizeof(WCHAR)))
+ if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, _countof(szTime)))
{
- szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0';
+ szTime[_countof(szTime)-1] = L'\0';
SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0,
(LPARAM)szTime);
}
}
/* FIXME set product language/local language */
- if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_SLANGUAGE , szTime, sizeof(szTime) /
sizeof(WCHAR)))
+ if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SLANGUAGE, szTime,
_countof(szTime)))
SendDlgItemMessageW(hwndDlg, IDC_STATIC_LANG, WM_SETTEXT, 0, (LPARAM)szTime);
/* prepare SMBIOS data */
@@ -266,7 +266,7 @@ InitializeSystemPage(HWND hwndDlg)
szTime, _countof(szTime), FALSE);
if (Length > 0)
{
- szTime[199] = L'\0';
+ szTime[_countof(szTime)-1] = L'\0';
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime);
}
@@ -306,13 +306,13 @@ InitializeSystemPage(HWND hwndDlg)
szTime + Index, StrLength, TRUE);
if (Length > 0)
{
- if (Index + StrLength > (sizeof(szTime)/sizeof(WCHAR))- 15)
+ if (Index + StrLength > _countof(szTime) - 15)
{
//FIXME retrieve BiosMajorRelease, BiosMinorRelease
- //StrLength = wcslen(&szTime[Index]);
+ //StrLength = wcslen(szTime + Index);
//szTime[Index+StrLength] = L' ';
- //wcscpy(&szTime[Index+StrLength], L"Ver: "); //FIXME
NON-NLS
- //szTime[(sizeof(szTime)/sizeof(WCHAR))-1] = L'\0';
+ //wcscpy(szTime + Index + StrLength, L"Ver: "); //FIXME
NON-NLS
+ //szTime[_countof(szTime)-1] = L'\0';
}
SendDlgItemMessageW(hwndDlg, IDC_STATIC_BIOS, WM_SETTEXT, 0,
(LPARAM)szTime);
}
@@ -329,11 +329,11 @@ InitializeSystemPage(HWND hwndDlg)
szFormat[0] = L'\0';
GetSystemInfo(&SysInfo);
if (SysInfo.dwNumberOfProcessors > 1)
- LoadStringW(hInst, IDS_FORMAT_MPPROC, szFormat, sizeof(szFormat) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_FORMAT_MPPROC, szFormat, _countof(szFormat));
else
- LoadStringW(hInst, IDS_FORMAT_UNIPROC, szFormat, sizeof(szFormat) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_FORMAT_UNIPROC, szFormat, _countof(szFormat));
- szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
+ szFormat[_countof(szFormat)-1] = L'\0';
wsprintfW(szTime, szFormat, szDesc, SysInfo.dwNumberOfProcessors);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_PROC, WM_SETTEXT, 0, (LPARAM)szTime);
}
@@ -343,36 +343,36 @@ InitializeSystemPage(HWND hwndDlg)
mem.dwLength = sizeof(mem);
if (GlobalMemoryStatusEx(&mem))
{
- if (LoadStringW(hInst, IDS_FORMAT_MB, szFormat, sizeof(szFormat) /
sizeof(WCHAR)))
+ if (LoadStringW(hInst, IDS_FORMAT_MB, szFormat, _countof(szFormat)))
{
/* set total mem string */
- szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0';
+ szFormat[_countof(szFormat)-1] = L'\0';
wsprintfW(szTime, szFormat, (mem.ullTotalPhys/1048576));
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MEM, WM_SETTEXT, 0, (LPARAM)szTime);
}
- if (LoadStringW(hInst, IDS_FORMAT_SWAP, szFormat, sizeof(szFormat) /
sizeof(WCHAR)))
+ if (LoadStringW(hInst, IDS_FORMAT_SWAP, szFormat, _countof(szFormat)))
{
/* set swap string */
AvailableBytes = (mem.ullTotalPageFile-mem.ullTotalPhys)/1048576;
UsedBytes = (mem.ullTotalPageFile-mem.ullAvailPageFile)/1048576;
- szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0';
+ szFormat[_countof(szFormat)-1] = L'\0';
wsprintfW(szTime, szFormat, (UsedBytes), (AvailableBytes));
SendDlgItemMessageW(hwndDlg, IDC_STATIC_SWAP, WM_SETTEXT, 0,
(LPARAM)szTime);
}
}
/* set directx version string */
wcscpy(szTime, L"ReactX ");
- if (GetDirectXVersion(&szTime[7]))
+ if (GetDirectXVersion(szTime + 7))
{
SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0, (LPARAM)szTime);
}
else
{
- if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, sizeof(szTime) /
sizeof(WCHAR)))
+ if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, _countof(szTime)))
{
- szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0';
+ szTime[_countof(szTime)-1] = L'\0';
SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0,
(LPARAM)szTime);
}
}