summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorKenneth Venken <kenneth.venken@gmail.com>2010-10-18 19:47:47 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-10-18 19:47:47 +0100
commit522faf9ccb25254e3c765425c74aee5c2aa6c950 (patch)
treefb4edb37fb880b3a8394d4b4d926a237a5c8908e /sal
parentc189268e0ab3ec33c02c5dbabfd31b37e0b1f5ab (diff)
cleanup to use SAL_N_ELEMENTS
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/systools/win32/uwinapi.h4
-rw-r--r--sal/osl/os2/tempfile.c3
-rw-r--r--sal/osl/unx/file_volume.cxx3
-rw-r--r--sal/osl/unx/tempfile.c3
-rw-r--r--sal/osl/unx/thread.c5
-rw-r--r--sal/osl/w32/file_dirvol.cxx2
-rw-r--r--sal/osl/w32/file_error.c3
-rw-r--r--sal/osl/w32/profile.cxx3
-rw-r--r--sal/osl/w32/security.c3
-rw-r--r--sal/osl/w32/signal.cxx3
-rw-r--r--sal/qa/osl/process/osl_process.cxx3
-rw-r--r--sal/qa/rtl/math/test_rtl_math.cxx5
-rw-r--r--sal/qa/rtl/oustring/rtl_OUString2.cxx2
-rw-r--r--sal/qa/rtl/strings/test_oustring_convert.cxx3
-rw-r--r--sal/qa/rtl/strings/test_oustring_endswith.cxx3
-rw-r--r--sal/rtl/source/alloc_global.c3
-rw-r--r--sal/rtl/source/hash.cxx5
-rw-r--r--sal/systools/win32/kill/kill.cxx11
-rw-r--r--sal/systools/win32/onlineupdate/onlinecheck.cxx4
-rw-r--r--sal/systools/win32/uwinapi/MoveFileExA.cpp5
-rw-r--r--sal/textenc/textenc.cxx3
-rw-r--r--sal/workben/t_cipher.c3
22 files changed, 43 insertions, 39 deletions
diff --git a/sal/inc/systools/win32/uwinapi.h b/sal/inc/systools/win32/uwinapi.h
index 8c55ae6cf275..25d50a1cc430 100644
--- a/sal/inc/systools/win32/uwinapi.h
+++ b/sal/inc/systools/win32/uwinapi.h
@@ -102,10 +102,6 @@ EXTERN_C WINBASEAPI DWORD WINAPI GetUserDomainW( LPWSTR lpBuffer, DWORD nBuffser
EXTERN_C WINBASEAPI DWORD WINAPI GetProcessId( HANDLE hProcess );
-/* macro that calculates the count of elements of a static array */
-
-#define elementsof(buf) (sizeof(buf) / sizeof((buf)[0]))
-
#ifdef __cplusplus
inline bool IsValidHandle(HANDLE handle)
diff --git a/sal/osl/os2/tempfile.c b/sal/osl/os2/tempfile.c
index 672995563c88..2bb0ca74cef6 100644
--- a/sal/osl/os2/tempfile.c
+++ b/sal/osl/os2/tempfile.c
@@ -39,6 +39,7 @@
#include <osl/thread.h>
#include <rtl/ustrbuf.h>
#include <osl/diagnose.h>
+#include <sal/macros.h>
#ifndef _FILE_URL_H_
#include "file_url.h"
@@ -87,7 +88,7 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
******************************************************************/
static const char LETTERS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-static const int COUNT_OF_LETTERS = sizeof(LETTERS)/sizeof(LETTERS[0]) - 1;
+static const int COUNT_OF_LETTERS = SAL_N_ELEMENTS(LETTERS) - 1;
#define RAND_NAME_LENGTH 6
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index 211c2142ba0e..5e916846e712 100644
--- a/sal/osl/unx/file_volume.cxx
+++ b/sal/osl/unx/file_volume.cxx
@@ -42,6 +42,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <sal/macros.h>
#ifdef HAVE_STATFS_H
#undef HAVE_STATFS_H
@@ -596,7 +597,7 @@ osl_isAFloppyDevice (const char* pDeviceName)
};
int i;
- for (i = 0; i < (sizeof(pFloppyDevice)/sizeof(pFloppyDevice[0])); i++)
+ for (i = 0; i < SAL_N_ELEMENTS(pFloppyDevice); i++)
{
if (strncmp(pDeviceName, pFloppyDevice[i], strlen(pFloppyDevice[i])) == 0)
return sal_True;
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
index 107b1eafcd84..4d8884773adb 100644
--- a/sal/osl/unx/tempfile.c
+++ b/sal/osl/unx/tempfile.c
@@ -42,6 +42,7 @@
#include <osl/thread.h>
#include <rtl/ustrbuf.h>
#include <osl/diagnose.h>
+#include <sal/macros.h>
#ifndef _FILE_URL_H_
#include "file_url.h"
@@ -106,7 +107,7 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
******************************************************************/
static const char LETTERS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-static const int COUNT_OF_LETTERS = sizeof(LETTERS)/sizeof(LETTERS[0]) - 1;
+static const int COUNT_OF_LETTERS = SAL_N_ELEMENTS(LETTERS) - 1;
#define RAND_NAME_LENGTH 6
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c
index fe53915b792f..47ebfe8a443b 100644
--- a/sal/osl/unx/thread.c
+++ b/sal/osl/unx/thread.c
@@ -30,9 +30,8 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <osl/nlsupport.h>
-#ifndef _RTL_TEXTENC_H_
#include <rtl/textenc.h>
-#endif
+#include <sal/macros.h>
/****************************************************************************
* @@@ TODO @@@
@@ -580,7 +579,7 @@ typedef struct _HashEntry
} HashEntry;
static HashEntry* HashTable[31];
-static int HashSize = sizeof(HashTable) / sizeof(HashTable[0]);
+static int HashSize = SAL_N_ELEMENTS(HashTable);
static pthread_mutex_t HashLock = PTHREAD_MUTEX_INITIALIZER;
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 1609015bed98..09253ef932b2 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -50,8 +50,6 @@
#endif
//#####################################################
-#define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
-
static const wchar_t UNC_PREFIX[] = L"\\\\";
static const wchar_t BACKSLASH = '\\';
static const wchar_t SLASH = '/';
diff --git a/sal/osl/w32/file_error.c b/sal/osl/w32/file_error.c
index ff74e6c025f3..d88ec4f5274e 100644
--- a/sal/osl/w32/file_error.c
+++ b/sal/osl/w32/file_error.c
@@ -34,6 +34,7 @@
#include "osl/diagnose.h"
#include "osl/thread.h"
+#include <sal/macros.h>
/* OS error to oslFileError values mapping table */
struct osl_file_error_entry
@@ -108,7 +109,7 @@ static const struct osl_file_error_entry errtable[] = {
oslFileError oslTranslateFileError (/*DWORD*/ unsigned long dwError)
{
- static const int n = sizeof(errtable)/sizeof(errtable[0]);
+ static const int n = SAL_N_ELEMENTS(errtable);
int i;
for (i = 0; i < n; ++i )
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index fe536001a0f6..b2f10a330320 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -37,6 +37,7 @@
#include <osl/file.h>
#include <osl/util.h>
#include <rtl/alloc.h>
+#include <sal/macros.h>
#include <algorithm>
using std::min;
static inline void copy_ustr_n( void *dest, const void *source, size_t length ) { rtl_copyMemory(dest, source, length*sizeof(sal_Unicode)); }
@@ -2556,7 +2557,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
int i = 0;
pStr = aTmpPath + nPos;
- for (i = 0; i < (sizeof(SubDirs) / sizeof(SubDirs[0])); i++)
+ for (i = 0; i < SAL_N_ELEMENTS(SubDirs); i++)
if (strnicmp(pStr + 1, SubDirs[i], strlen(SubDirs[i])) == 0)
{
if ( *strPath == 0)
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index 237ea67dc949..1e0453c9cb2a 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -33,6 +33,7 @@
#include <osl/thread.h>
#include <osl/file.h>
#include <systools/win32/uwinapi.h>
+#include <sal/macros.h>
#include "secimpl.h"
/*****************************************************************************/
@@ -756,7 +757,7 @@ static sal_Bool GetSpecialFolder(rtl_uString **strPath, int nFolder)
&hRegKey) == ERROR_SUCCESS)
{
LONG lRet;
- DWORD lSize = elementsof(PathA);
+ DWORD lSize = SAL_N_ELEMENTS(PathA);
DWORD Type = REG_SZ;
switch (nFolder)
diff --git a/sal/osl/w32/signal.cxx b/sal/osl/w32/signal.cxx
index 3ef86a56d190..de2201f8d8a6 100644
--- a/sal/osl/w32/signal.cxx
+++ b/sal/osl/w32/signal.cxx
@@ -41,6 +41,7 @@
#endif
#include <ErrorRep.h>
#include <systools/win32/uwinapi.h>
+#include <sal/macros.h>
typedef struct _oslSignalHandlerImpl
{
@@ -187,7 +188,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
StartupInfo.cb = sizeof(StartupInfo.cb);
- sntprintf( szBuffer, elementsof(szBuffer),
+ sntprintf( szBuffer, SAL_N_ELEMENTS(szBuffer),
_T("%s -p %u -excp 0x%p -t %u%s"),
static_cast<sal_Char*>( aPath ),
GetCurrentProcessId(),
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 41d8040bcc5b..eaee6bdc72af 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <osl/module.hxx>
+#include <sal/macros.h>
#if ( defined WNT ) // Windows
#include <tools/prewin.h>
@@ -569,7 +570,7 @@ public:
NULL,
suCWD.pData,
child_env,
- sizeof(child_env)/sizeof(child_env[0]),
+ SAL_N_ELEMENTS(child_env),
&process);
CPPUNIT_ASSERT_MESSAGE
diff --git a/sal/qa/rtl/math/test_rtl_math.cxx b/sal/qa/rtl/math/test_rtl_math.cxx
index 8c5baab65ef1..e81e4a12fcb4 100644
--- a/sal/qa/rtl/math/test_rtl_math.cxx
+++ b/sal/qa/rtl/math/test_rtl_math.cxx
@@ -38,6 +38,7 @@
#include <testshl/tresstatewrapper.hxx>
#include "rtl/ustring.hxx"
#include "sal/types.h"
+#include <sal/macros.h>
#include <stdlib.h>
@@ -533,7 +534,7 @@ extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
{ 1.0000000000000002220446049250313080847263336181640625,
rtl_math_StringFormat_F, 53, '.', false,
"1.00000000000000000000000000000000000000000000000000000" } };
- size_t const nCount = sizeof aTest / sizeof aTest[0];
+ size_t const nCount = SAL_N_ELEMENTS(aTest);
//LLA: the float tests are wrong here, due to the fact that
// we calculate with too less digits after the point
@@ -645,7 +646,7 @@ extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
{ "3.14E2000", rtl_math_StringFormat_E, 4, '.', false,
"1.#INF" },
};
- size_t const nCount = sizeof aTest / sizeof aTest[0];
+ size_t const nCount = SAL_N_ELEMENTS(aTest);
bReturn &= testStringToNumberToString< StringTraits >(
pTestResult, aTest, nCount);
bReturn &= testStringToNumberToString< UStringTraits >(
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index d8ce128a3c80..4b05a027b57e 100644
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx
@@ -986,7 +986,7 @@ void convertToString::test() {
static sal_Unicode const utf16[] = { 0x0041, 0x00E4, 0x0061 };
rtl::OString s;
CPPUNIT_ASSERT(
- rtl::OUString(utf16, sizeof utf16 / sizeof utf16[0]).convertToString(
+ rtl::OUString(utf16, SAL_N_ELEMENTS(utf16)).convertToString(
&s, RTL_TEXTENCODING_UTF7,
(RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)));
diff --git a/sal/qa/rtl/strings/test_oustring_convert.cxx b/sal/qa/rtl/strings/test_oustring_convert.cxx
index 5b82b8d9d44e..e045812c810e 100644
--- a/sal/qa/rtl/strings/test_oustring_convert.cxx
+++ b/sal/qa/rtl/strings/test_oustring_convert.cxx
@@ -33,6 +33,7 @@
#include "rtl/strbuf.hxx"
#include "rtl/string.hxx"
#include "rtl/ustring.hxx"
+#include <sal/macros.h>
namespace test { namespace oustring {
@@ -180,7 +181,7 @@ void test::oustring::Convert::convertToString()
OUSTRING_TO_OSTRING_CVTFLAGS,
"A?B",
"A?B" } };
- for (unsigned int i = 0; i < sizeof aTests / sizeof aTests[0]; ++i)
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i)
testConvertToString(aTests[i]);
}
diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx
index 729a631d4877..a17f9a1630a1 100644
--- a/sal/qa/rtl/strings/test_oustring_endswith.cxx
+++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx
@@ -36,6 +36,7 @@
#include "rtl/textenc.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
+#include <sal/macros.h>
namespace test { namespace oustring {
@@ -103,7 +104,7 @@ void test::oustring::EndsWith::endsWith()
RTL_CONSTASCII_STRINGPARAM("b\0c"), true },
{ RTL_CONSTASCII_STRINGPARAM("a\0b\0c"),
RTL_CONSTASCII_STRINGPARAM("b"), false } };
- for (int i = 0; i < sizeof data / sizeof data[0]; ++i) {
+ for (int i = 0; i < SAL_N_ELEMENTS(data); ++i) {
rtl::OStringBuffer msg;
appendString(msg, rtl::OString(data[i].str1, data[i].str1Len));
msg.append(
diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c
index 0e8be8683491..ed81a252cc4d 100644
--- a/sal/rtl/source/alloc_global.c
+++ b/sal/rtl/source/alloc_global.c
@@ -26,6 +26,7 @@
************************************************************************/
#include "rtl/alloc.h"
+#include <sal/macros.h>
#ifndef INCLUDED_STRING_H
#include <string.h>
@@ -72,7 +73,7 @@ static const sal_Size g_alloc_sizes[] =
};
#define RTL_MEMORY_CACHED_LIMIT 4 * 4096
-#define RTL_MEMORY_CACHED_SIZES (sizeof(g_alloc_sizes) / sizeof(g_alloc_sizes[0]))
+#define RTL_MEMORY_CACHED_SIZES (SAL_N_ELEMENTS(g_alloc_sizes))
static rtl_cache_type * g_alloc_caches[RTL_MEMORY_CACHED_SIZES] =
{
diff --git a/sal/rtl/source/hash.cxx b/sal/rtl/source/hash.cxx
index 5fffe72dd4cd..6e8496875dd5 100644
--- a/sal/rtl/source/hash.cxx
+++ b/sal/rtl/source/hash.cxx
@@ -32,6 +32,7 @@
#include "hash.h"
#include "strimp.h"
#include <osl/diagnose.h>
+#include <sal/macros.h>
struct StringHashTableImpl {
sal_uInt32 nEntries;
@@ -68,8 +69,8 @@ getNextSize (sal_uInt32 nSize)
65521, 131071,262139, 524287, 1048573,
2097143, 4194301, 8388593, 16777213,
33554393, 67108859, 134217689 };
- #define NUM_PRIMES (sizeof (nPrimes)/ sizeof (nPrimes[0]))
- for (sal_uInt32 i = 0; i < NUM_PRIMES; i++)
+
+ for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(nPrimes); i++)
{
if (nPrimes[i] > nSize)
return nPrimes[i];
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx
index f10e5e5614f4..56a464c6448b 100644
--- a/sal/systools/win32/kill/kill.cxx
+++ b/sal/systools/win32/kill/kill.cxx
@@ -68,9 +68,6 @@ static inline bool IsValidHandle( HANDLE handle )
return INVALID_HANDLE_VALUE != handle && NULL != handle;
}
-
-#define elementsof( a ) (sizeof(a) / sizeof( (a)[0] ))
-
/////////////////////////////////////////////////////////////////////////////
// Retrieves function adress in another process
/////////////////////////////////////////////////////////////////////////////
@@ -91,7 +88,7 @@ FARPROC WINAPI GetProcAddressEx( HANDLE hProcess, HMODULE hModule, LPCSTR lpProc
FARPROC lpfnRemoteProcAddress = NULL;
TCHAR szBaseName[MAX_PATH];
- if ( GetModuleBaseName( GetCurrentProcess(), hModule, szBaseName, elementsof(szBaseName) ) )
+ if ( GetModuleBaseName( GetCurrentProcess(), hModule, szBaseName, SAL_N_ELEMENTS(szBaseName) ) )
{
HMODULE ahModules[MAX_MODULES];
DWORD cbNeeded = 0;
@@ -105,7 +102,7 @@ FARPROC WINAPI GetProcAddressEx( HANDLE hProcess, HMODULE hModule, LPCSTR lpProc
TCHAR szRemoteBaseName[MAX_PATH];
if ( GetModuleBaseName(
- hProcess, ahModules[n], szRemoteBaseName, elementsof(szRemoteBaseName) ) &&
+ hProcess, ahModules[n], szRemoteBaseName, SAL_N_ELEMENTS(szRemoteBaseName) ) &&
0 == lstrcmpi( szRemoteBaseName, szBaseName )
)
{
@@ -257,7 +254,7 @@ static void ParseCommandArgs( LPDWORD lpProcesses, LPDWORD lpdwNumProcesses, int
SIG_ENTRY( KILL )
};
- const int NumSupportedSignals = elementsof(SupportedSignals);
+ const int NumSupportedSignals = SAL_N_ELEMENTS(SupportedSignals);
DWORD dwMaxProcesses = *lpdwNumProcesses;
int argc = __argc;
@@ -402,7 +399,7 @@ void OutputSystemMessage( DWORD dwErrorCode )
int _tmain()
{
DWORD dwProcessIds[1024];
- DWORD nProcesses = elementsof(dwProcessIds);
+ DWORD nProcesses = SAL_N_ELEMENTS(dwProcessIds);
int sig = SIGTERM;
diff --git a/sal/systools/win32/onlineupdate/onlinecheck.cxx b/sal/systools/win32/onlineupdate/onlinecheck.cxx
index aa33c13a4879..25a2e579481a 100644
--- a/sal/systools/win32/onlineupdate/onlinecheck.cxx
+++ b/sal/systools/win32/onlineupdate/onlinecheck.cxx
@@ -46,8 +46,6 @@
#include <excpt.h>
#endif
-#define elementsof(a) (sizeof(a)/sizeof((a)[0]))
-
// #i71984
extern "C" sal_Bool SAL_CALL hasInternetConnection()
{
@@ -66,7 +64,7 @@ extern "C" sal_Bool SAL_CALL hasInternetConnection()
BOOL fIsConnected = InternetGetConnectedStateEx(
&dwFlags,
szConnectionName,
- elementsof(szConnectionName),
+ SAL_N_ELEMENTS(szConnectionName),
0 );
return fIsConnected ? sal_True : sal_False;
diff --git a/sal/systools/win32/uwinapi/MoveFileExA.cpp b/sal/systools/win32/uwinapi/MoveFileExA.cpp
index ca840c33fb4e..c1e6a3663576 100644
--- a/sal/systools/win32/uwinapi/MoveFileExA.cpp
+++ b/sal/systools/win32/uwinapi/MoveFileExA.cpp
@@ -27,6 +27,7 @@
************************************************************************/
#include "macros.h"
+#include <sal/macros.h>
#define WININIT_FILENAME "wininit.ini"
#define RENAME_SECTION "rename"
@@ -50,7 +51,7 @@ IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExA, ( LPCSTR lpExisti
)
{
CHAR szBuffer[32767]; // The buffer size must not exceed 32K
- DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME );
+ DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
strcpy( szRename, szNewFileNameA );
@@ -58,7 +59,7 @@ IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExA, ( LPCSTR lpExisti
strcat( szRename, szExistingFileNameA );
size_t lnRename = strlen(szRename);
- if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) )
+ if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
{
CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
szBuffer[dwBufLen + lnRename ] = 0;
diff --git a/sal/textenc/textenc.cxx b/sal/textenc/textenc.cxx
index 6db6ba0cbd04..ab98b4bfa625 100644
--- a/sal/textenc/textenc.cxx
+++ b/sal/textenc/textenc.cxx
@@ -35,6 +35,7 @@
#include "gettextencodingdata.h"
#include "tenchelp.h"
#include "rtl/textenc.h"
+#include <sal/macros.h>
#ifndef INCLUDED_STDDEF_H
#include <stddef.h>
@@ -223,7 +224,7 @@ Impl_getTextEncodingData(rtl_TextEncoding nEncoding) SAL_THROW_EXTERN_C()
&aImplPT154TextEncodingData, /* PT154 */
&adobeDingbatsEncodingData }; /* ADOBE_DINGBATS */
return
- nEncoding < sizeof aData / sizeof aData[0] ? aData[nEncoding] : NULL;
+ nEncoding < SAL_N_ELEMENTS(aData) ? aData[nEncoding] : NULL;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/workben/t_cipher.c b/sal/workben/t_cipher.c
index b7126bd46de1..69f080fdfb46 100644
--- a/sal/workben/t_cipher.c
+++ b/sal/workben/t_cipher.c
@@ -25,6 +25,7 @@
*
************************************************************************/
#include <sal/types.h>
+#include <sal/macros.h>
#include <osl/diagnose.h>
#include <rtl/cipher.h>
@@ -327,7 +328,7 @@ int SAL_CALL main (int argc, char *argv)
sal_Size length;
int i, n;
- n = sizeof(arcfour_data_len) / sizeof(arcfour_data_len[0]);
+ n = SAL_N_ELEMENTS(arcfour_data_len);
for (i = 0; i < n; i++)
{
length = arcfour_data_len[i];