From 6439005484bdf6754b910b1ce025b3fb33b6623f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 29 Mar 2016 10:25:17 +0200 Subject: use SAL_N_ELEMENTS more widely found using git grep -n 'sizeof.*/.*sizeof.*[0]' Change-Id: Icd4a6cc1ca8ec8ebd68e1701a02789c74cf0eb2a --- setup_native/source/win32/wintools/makecab/makecab.c | 2 +- setup_native/source/win32/wintools/msidb/msidb.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'setup_native') diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c index 4acdc9fc315d..a5c7acda1a8e 100644 --- a/setup_native/source/win32/wintools/makecab/makecab.c +++ b/setup_native/source/win32/wintools/makecab/makecab.c @@ -61,7 +61,7 @@ void cabLogErr(PERF erf, char * msg) if (erf->erfOper >= 0) { - if (erf->erfOper < (sizeof(FCI_ERRS)/sizeof(FCI_ERRS[0]))) + if (erf->erfOper < SAL_N_ELEMENTS(FCI_ERRS)) cabLog(CABLOG_ERR, "%s: %s", msg, FCI_ERRS[erf->erfOper]); else cabLog(CABLOG_ERR, "%s: Unknown error", msg); diff --git a/setup_native/source/win32/wintools/msidb/msidb.c b/setup_native/source/win32/wintools/msidb/msidb.c index 733fe58b1205..2c100975fe7b 100644 --- a/setup_native/source/win32/wintools/msidb/msidb.c +++ b/setup_native/source/win32/wintools/msidb/msidb.c @@ -441,7 +441,7 @@ static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[]) MSIHANDLE dbhandle, tableListView, rec; LPWSTR tableFile = 0; WCHAR tableName[MAX_TABLE_NAME]; - DWORD size = sizeof(tableName) / sizeof(tableName[0]); + DWORD size = SAL_N_ELEMENTS(tableName); int i = 0; r = MsiOpenDatabaseW(dbfile, (LPCWSTR) MSIDBOPEN_READONLY, &dbhandle); @@ -456,7 +456,7 @@ static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[]) while (r == ERROR_SUCCESS) { - size = sizeof(tableName) / sizeof(tableName[0]); + size = SAL_N_ELEMENTS(tableName); r = MsiRecordGetStringW(rec, 1, tableName, &size); if (r == ERROR_SUCCESS) { -- cgit