diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-03-29 10:25:17 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-03-31 11:30:36 +0200 |
commit | 6439005484bdf6754b910b1ce025b3fb33b6623f (patch) | |
tree | 1a00f48ae11d3da3d928f2d3d68b3e299216328c /shell | |
parent | 1aa4df615fa5599d05e9dd5e925b5852676185fa (diff) |
use SAL_N_ELEMENTS more widely
found using
git grep -n 'sizeof.*/.*sizeof.*[0]'
Change-Id: Icd4a6cc1ca8ec8ebd68e1701a02789c74cf0eb2a
Diffstat (limited to 'shell')
5 files changed, 10 insertions, 10 deletions
diff --git a/shell/inc/internal/fileextensions.hxx b/shell/inc/internal/fileextensions.hxx index 119c626da881..53c91064b2a8 100644 --- a/shell/inc/internal/fileextensions.hxx +++ b/shell/inc/internal/fileextensions.hxx @@ -39,9 +39,9 @@ struct FileExtensionEntry const char* RegistryForwardKey; // e.g. "soffice.StarWriterDocument.6" }; -extern FileExtensionEntry OOFileExtensionTable[]; +extern const FileExtensionEntry OOFileExtensionTable[]; -extern size_t OOFileExtensionTableSize; +extern const size_t OOFileExtensionTableSize; /** Return the extension of a file diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx index 8f3f11e5a4b7..c72c298f2edf 100644 --- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx +++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx @@ -29,7 +29,7 @@ namespace /* private */ { - SHCOLUMNINFO ColumnInfoTable[] = + const SHCOLUMNINFO ColumnInfoTable[] = { {{PSGUID_SUMMARYINFORMATION, PIDSI_TITLE}, VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Title", L"Title"}, {{PSGUID_SUMMARYINFORMATION, PIDSI_AUTHOR}, VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Author", L"Author"}, @@ -39,7 +39,7 @@ namespace /* private */ {{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT},VT_BSTR, LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"} }; - size_t ColumnInfoTableSize = sizeof(ColumnInfoTable)/sizeof(ColumnInfoTable[0]); + size_t ColumnInfoTableSize = SAL_N_ELEMENTS(ColumnInfoTable); } @@ -114,7 +114,7 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO psci->scid.pid = ColumnInfoTable[dwIndex].scid.pid; ZeroMemory(psci->wszTitle, sizeof(psci->wszTitle)); wcsncpy(psci->wszTitle, ColumnInfoTable[dwIndex].wszTitle, - (sizeof(psci->wszTitle) / sizeof(psci->wszTitle[0]) - 1)); + SAL_N_ELEMENTS(psci->wszTitle) - 1); return S_OK; } diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index b842234bfba1..1f8e7aacf4ea 100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -47,7 +47,7 @@ struct PROPERTYMAP PCWSTR pszValueNodeName; }; -PROPERTYMAP g_rgPROPERTYMAP[] = +const PROPERTYMAP g_rgPROPERTYMAP[] = { { PKEY_Title, L"LibreOffice", L"Title" }, { PKEY_Author, L"LibreOffice", L"Author" }, @@ -56,7 +56,7 @@ PROPERTYMAP g_rgPROPERTYMAP[] = { PKEY_Comment, L"LibreOffice", L"Comments" }, }; -size_t gPropertyMapTableSize = sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]); +size_t gPropertyMapTableSize = SAL_N_ELEMENTS(g_rgPROPERTYMAP); CPropertyHdl::CPropertyHdl( long nRefCnt ) : diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx index b827e5c896c8..8d0028d42fdf 100644 --- a/shell/source/win32/shlxthandler/util/fileextensions.cxx +++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx @@ -30,7 +30,7 @@ const std::string MATH_FILE_EXTENSIONS = "sxmodf"; const std::string WEB_FILE_EXTENSIONS = "oth"; const std::string DATABASE_FILE_EXTENSIONS = "odb"; -FileExtensionEntry OOFileExtensionTable[] = { +const FileExtensionEntry OOFileExtensionTable[] = { { ".sxw", L".sxw", "soffice.StarWriterDocument.6" }, { ".sxc", L".sxc", "soffice.StarCalcDocument.6" }, { ".sxi", L".sxi", "soffice.StarImpressDocument.6" }, @@ -56,7 +56,7 @@ FileExtensionEntry OOFileExtensionTable[] = { }; -size_t OOFileExtensionTableSize = sizeof(OOFileExtensionTable)/sizeof(OOFileExtensionTable[0]); +const size_t OOFileExtensionTableSize = SAL_N_ELEMENTS(OOFileExtensionTable); /** Return the extension of a file diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index a17df2161114..6c0b14e7117d 100644 --- a/shell/source/win32/simplemail/senddoc.cxx +++ b/shell/source/win32/simplemail/senddoc.cxx @@ -183,7 +183,7 @@ const char* KnownParameter[] = "--mapi-logon-ui" }; -const size_t nKnownParameter = (sizeof(KnownParameter)/sizeof(KnownParameter[0])); +const size_t nKnownParameter = SAL_N_ELEMENTS(KnownParameter); /** @internal */ bool isKnownParameter(const char* aParameterName) |