summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorjsala <javier.salamanca.munoz@gmail.com>2022-06-24 18:46:25 +0200
committerHossein <hossein@libreoffice.org>2022-09-05 18:57:53 +0200
commit8dc57426c3bd3385c30b9007991af8496b315f9a (patch)
tree4a8d98f17a9e25fa10616b0ed596719af6baf736 /desktop
parent9b7600f547cec9ed1bacca3a1b995b3c33fd5723 (diff)
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Also change some integer by std::size_t Change-Id: Ia51b27bb99b8adda576394f9331345cb11149d6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137274 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/deployment_misc/test_dp_version.cxx2
-rw-r--r--desktop/source/app/officeipcthread.cxx12
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx2
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx2
4 files changed, 9 insertions, 9 deletions
diff --git a/desktop/qa/deployment_misc/test_dp_version.cxx b/desktop/qa/deployment_misc/test_dp_version.cxx
index e896686865be..1b8fb9086769 100644
--- a/desktop/qa/deployment_misc/test_dp_version.cxx
+++ b/desktop/qa/deployment_misc/test_dp_version.cxx
@@ -60,7 +60,7 @@ void Test::test() {
OUString("9223372036854775807"),
::dp_misc::GREATER }
};
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
+ for (std::size_t i = 0; i < std::size(data); ++i) {
CPPUNIT_ASSERT_EQUAL(
data[i].order,
::dp_misc::compareVersions(data[i].version1, data[i].version2));
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index e559f7253e53..6e3e97b06d19 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -72,7 +72,7 @@ char const PROCESSING_DONE[] = "InternalIPC::ProcessingDone";
OString readStringFromPipe(osl::StreamPipe const & pipe) {
for (OStringBuffer str;;) {
char buf[1024];
- sal_Int32 n = pipe.recv(buf, SAL_N_ELEMENTS(buf));
+ sal_Int32 n = pipe.recv(buf, std::size(buf));
if (n <= 0) {
SAL_INFO("desktop.app", "read empty string");
return "";
@@ -1154,10 +1154,10 @@ void PipeIpcThread::execute()
// notify client we're ready to process its args:
SAL_INFO("desktop.app", "writing <" << SEND_ARGUMENTS << ">");
- sal_Int32 n = aStreamPipe.write(
- SEND_ARGUMENTS, SAL_N_ELEMENTS(SEND_ARGUMENTS));
+ std::size_t n = aStreamPipe.write(
+ SEND_ARGUMENTS, std::size(SEND_ARGUMENTS));
// incl. terminating NUL
- if (n != SAL_N_ELEMENTS(SEND_ARGUMENTS)) {
+ if (n != std::size(SEND_ARGUMENTS)) {
SAL_WARN("desktop.app", "short write: " << n);
continue;
}
@@ -1186,9 +1186,9 @@ void PipeIpcThread::execute()
{
// processing finished, inform the requesting end:
SAL_INFO("desktop.app", "writing <" << PROCESSING_DONE << ">");
- n = aStreamPipe.write(PROCESSING_DONE, SAL_N_ELEMENTS(PROCESSING_DONE));
+ n = aStreamPipe.write(PROCESSING_DONE, std::size(PROCESSING_DONE));
// incl. terminating NUL
- if (n != SAL_N_ELEMENTS(PROCESSING_DONE))
+ if (n != std::size(PROCESSING_DONE))
{
SAL_WARN("desktop.app", "short write: " << n);
continue;
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index fc7816f6a4c6..44bd4648eff0 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -296,7 +296,7 @@ std::vector<Reference<css::deployment::XPackage> >
std::vector<Reference<css::deployment::XPackage> > extensionList;
Reference<css::deployment::XPackageManager> lRepos[] = {
getUserRepository(), getSharedRepository(), getBundledRepository() };
- for (int i(0); i != SAL_N_ELEMENTS(lRepos); ++i)
+ for (std::size_t i(0); i != std::size(lRepos); ++i)
{
Reference<css::deployment::XPackage> xPackage;
try
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index f4437711dab5..df94e958292b 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -416,7 +416,7 @@ OUString generateRandomPipeId()
throw RuntimeException( "cannot create random pool!?", nullptr );
sal_uInt8 bytes[ 32 ];
if (rtl_random_getBytes(
- s_hPool, bytes, SAL_N_ELEMENTS(bytes) ) != rtl_Random_E_None) {
+ s_hPool, bytes, std::size(bytes) ) != rtl_Random_E_None) {
throw RuntimeException( "random pool error!?", nullptr );
}
OUStringBuffer buf;