summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/app
diff options
context:
space:
mode:
authorjsala <javier.salamanca.munoz@gmail.com>2022-06-24 18:44:20 +0200
committerHossein <hossein@libreoffice.org>2022-09-05 17:16:42 +0200
commit35a7e40d372d3211061465346825cf543a095f6d (patch)
tree11f4008f6a93fdc8bc5ecbb036bc927c807b36a8 /dbaccess/source/ui/app
parent599158b6dcc45a7579f73f3d94f6956e00128bee (diff)
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Also change some integer by std::size_t Change-Id: I6a0fda3ba44815aac3312d523be04f4f973ce84f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137142 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'dbaccess/source/ui/app')
-rw-r--r--dbaccess/source/ui/app/templwin.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/dbaccess/source/ui/app/templwin.cxx b/dbaccess/source/ui/app/templwin.cxx
index e9940782d630..224d8be0aed9 100644
--- a/dbaccess/source/ui/app/templwin.cxx
+++ b/dbaccess/source/ui/app/templwin.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <algorithm>
#include <core_resource.hxx>
#include <templwin.hrc>
#include "templwin.hxx"
@@ -25,13 +26,9 @@ namespace SvtDocInfoTable_Impl
{
OUString GetString(int nId)
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(STRARY_SVT_DOCINFO); ++i)
- {
- if (STRARY_SVT_DOCINFO[i].second == nId)
- return DBA_RES(STRARY_SVT_DOCINFO[i].first);
- }
-
- return OUString();
+ auto const found = std::find_if(std::begin(STRARY_SVT_DOCINFO), std::end(STRARY_SVT_DOCINFO)
+ , [nId](auto const & docinfo){ return docinfo.second == nId; });
+ return (found != std::end(STRARY_SVT_DOCINFO)) ? DBA_RES(found->first) : OUString();
}
}