Kaydet (Commit) 1ab775bd authored tarafından Michael Stahl's avatar Michael Stahl

onlineupdate: revert SAL_N_ELEMENTS changes

It's not clear if the foreign code in onlineupdate is supposed to
include sal headers, so revert the 2 changes from earlier today there.

Change-Id: I604720b4bd4897204e354ec230582b0fd2036716
üst 51737960
......@@ -191,7 +191,7 @@ BOOL
UACHelper::DisablePrivileges(HANDLE token)
{
static const size_t PrivsToDisableSize =
SAL_N_ELEMENTS(UACHelper::PrivsToDisable);
sizeof(UACHelper::PrivsToDisable) / sizeof(UACHelper::PrivsToDisable[0]);
return DisableUnneededPrivileges(token, UACHelper::PrivsToDisable,
PrivsToDisableSize);
......
......@@ -100,7 +100,7 @@ LaunchWinPostProcess(const WCHAR *installationDir,
if (!GetPrivateProfileStringW(L"PostUpdateWin", L"ExeAsync", L"TRUE",
exeasync,
SAL_N_ELEMENTS(exeasync),
sizeof(exeasync)/sizeof(exeasync[0]),
inifile)) {
return FALSE;
}
......@@ -123,7 +123,7 @@ LaunchWinPostProcess(const WCHAR *installationDir,
}
WCHAR dummyArg[14] = { L'\0' };
wcsncpy(dummyArg, L"argv0ignored ", SAL_N_ELEMENTS(dummyArg) - 1);
wcsncpy(dummyArg, L"argv0ignored ", sizeof(dummyArg) / sizeof(dummyArg[0]) - 1);
size_t len = wcslen(exearg) + wcslen(dummyArg);
WCHAR *cmdline = (WCHAR *) malloc((len + 1) * sizeof(WCHAR));
......@@ -266,7 +266,8 @@ StartServiceUpdate(LPCWSTR installDir)
si.lpDesktop = L"";
PROCESS_INFORMATION pi = {0};
WCHAR cmdLine[64] = { '\0' };
wcsncpy(cmdLine, L"dummyparam.exe upgrade", SAL_N_ELEMENTS(cmdLine) - 1);
wcsncpy(cmdLine, L"dummyparam.exe upgrade",
sizeof(cmdLine) / sizeof(cmdLine[0]) - 1);
BOOL svcUpdateProcessStarted = CreateProcessW(tmpService,
cmdLine,
nullptr, nullptr, FALSE,
......
......@@ -30,11 +30,11 @@ void UpdateLog::Init(NS_tchar* sourcePathParam,
sourcePath = sourcePathParam;
NS_tchar logFile[MAXPATHLEN];
NS_tsnprintf(logFile, SAL_N_ELEMENTS(logFile),
NS_tsnprintf(logFile, sizeof(logFile)/sizeof(logFile[0]),
NS_T("%s/%s"), sourcePathParam, fileName);
if (alternateFileName && NS_taccess(logFile, F_OK)) {
NS_tsnprintf(logFile, SAL_N_ELEMENTS(logFile),
NS_tsnprintf(logFile, sizeof(logFile)/sizeof(logFile[0]),
NS_T("%s/%s"), sourcePathParam, alternateFileName);
}
......
......@@ -90,7 +90,7 @@ struct AutoLoadSystemDependencies
}
// For each known DLL ensure it is loaded from the system32 directory
for (size_t i = 0; i < SAL_N_ELEMENTS(delayDLLs); ++i) {
for (size_t i = 0; i < sizeof(delayDLLs) / sizeof(delayDLLs[0]); ++i) {
size_t fileLen = wcslen(delayDLLs[i]);
wcsncpy(systemDirectory + systemDirLen, delayDLLs[i],
MAX_PATH - systemDirLen);
......
......@@ -111,9 +111,9 @@ InitDialog(HWND hDlg)
WCHAR szwInfo[MAX_TEXT_LEN];
MultiByteToWideChar(CP_UTF8, 0, sUIStrings.title, -1, szwTitle,
SAL_N_ELEMENTS(szwTitle));
sizeof(szwTitle)/sizeof(szwTitle[0]));
MultiByteToWideChar(CP_UTF8, 0, sUIStrings.info, -1, szwInfo,
SAL_N_ELEMENTS(szwInfo));
sizeof(szwInfo)/sizeof(szwInfo[0]));
SetWindowTextW(hDlg, szwTitle);
SetWindowTextW(GetDlgItem(hDlg, IDC_INFO), szwInfo);
......
......@@ -19,8 +19,8 @@ DIR::DIR(const WCHAR* path)
: findHandle(INVALID_HANDLE_VALUE)
{
memset(name, 0, sizeof(name));
wcsncpy(name, path, SAL_N_ELEMENTS(name));
wcsncat(name, L"\\*", SAL_N_ELEMENTS(name) - wcslen(name) - 1);
wcsncpy(name, path, sizeof(name)/sizeof(name[0]));
wcsncat(name, L"\\*", sizeof(name)/sizeof(name[0]) - wcslen(name) - 1);
}
DIR::~DIR()
......@@ -73,7 +73,7 @@ dirent* readdir(DIR* dir)
}
memset(gDirEnt.d_name, 0, sizeof(gDirEnt.d_name));
wcsncpy(gDirEnt.d_name, data.cFileName,
SAL_N_ELEMENTS(gDirEnt.d_name));
sizeof(gDirEnt.d_name)/sizeof(gDirEnt.d_name[0]));
return &gDirEnt;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment