Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


Hi,

patches replace sizeof/sizeof[0] with SAL_N_ELEMENTS in testing and sdk

-- Kenneth
diff --git a/odk/examples/OLE/activex/SOComWindowPeer.cpp 
b/odk/examples/OLE/activex/SOComWindowPeer.cpp
index 0b2fabf..a3f4d50 100644
--- a/odk/examples/OLE/activex/SOComWindowPeer.cpp
+++ b/odk/examples/OLE/activex/SOComWindowPeer.cpp
@@ -38,6 +38,7 @@
 #include "stdafx2.h"
 #include "so_activex.h"
 #include "SOComWindowPeer.h"
+#include <sal/macros.h>
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -49,7 +50,7 @@ STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid)
         &IID_ISOComWindowPeer,
     };
 
-    for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
+    for (int i=0; i<SAL_N_ELEMENTS(arr) ;i++)
     {
         if (InlineIsEqualGUID(*arr[i],riid))
             return S_OK;
diff --git a/test/source/cpp/officeconnection.cxx b/test/source/cpp/officeconnection.cxx
index d8198a0..fd71df6 100644
--- a/test/source/cpp/officeconnection.cxx
+++ b/test/source/cpp/officeconnection.cxx
@@ -40,6 +40,7 @@
 #include "osl/process.h"
 #include "osl/time.h"
 #include "sal/types.h"
+#include <sal/macros.h>
 #include "test/getargument.hxx"
 #include "test/officeconnection.hxx"
 #include "test/toabsolutefileurl.hxx"
@@ -109,7 +110,7 @@ void OfficeConnection::setUp() {
             osl_executeProcess(
                 toAbsoluteFileUrl(
                     argSoffice.copy(RTL_CONSTASCII_LENGTH("path:"))).pData,
-                args, sizeof args / sizeof args[0], 0, 0, 0, envs,
+                args, SAL_N_ELEMENTS( args ), 0, 0, 0, envs,
                 envs == 0 ? 0 : 1, &process_));
     } else if (argSoffice.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("connect:"))) {
         desc = argSoffice.copy(RTL_CONSTASCII_LENGTH("connect:"));

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.