hi,
these patches will replace the last occurrences of
sizeof(foo)/sizeof(foo[0]) with SAL_N_ELEMENTS(foo)
-- Kenneth
diff --git a/extensions/source/activex/main/SOActionsApproval.cpp
b/extensions/source/activex/main/SOActionsApproval.cpp
index fd4abb1..c0da27f 100644
--- a/extensions/source/activex/main/SOActionsApproval.cpp
+++ b/extensions/source/activex/main/SOActionsApproval.cpp
@@ -5,6 +5,7 @@
#include "so_activex.h"
#include "SOActionsApproval.h"
+#include <sal/macros.h>
/////////////////////////////////////////////////////////////////////////////
//
@@ -16,7 +17,7 @@ STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid)
&IID_ISOActionsApproval,
};
- for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
+ for (int i=0;i<SAL_N_ELEMENTS(arr);i++)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
if (InlineIsEqualGUID(*arr[i],riid))
diff --git a/extensions/source/activex/main/SOComWindowPeer.cpp
b/extensions/source/activex/main/SOComWindowPeer.cpp
index b6c0986..bf631a4 100644
--- a/extensions/source/activex/main/SOComWindowPeer.cpp
+++ b/extensions/source/activex/main/SOComWindowPeer.cpp
@@ -4,6 +4,7 @@
#include "stdafx2.h"
#include "so_activex.h"
#include "SOComWindowPeer.h"
+#include <sal/macros.h>
/////////////////////////////////////////////////////////////////////////////
//
@@ -15,7 +16,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 defined(_MSC_VER) && (_MSC_VER >= 1300)
if (InlineIsEqualGUID(*arr[i],riid))
diff --git a/extensions/source/activex/main/SODispatchInterceptor.cpp
b/extensions/source/activex/main/SODispatchInterceptor.cpp
index eadce51..1e05354 100644
--- a/extensions/source/activex/main/SODispatchInterceptor.cpp
+++ b/extensions/source/activex/main/SODispatchInterceptor.cpp
@@ -7,6 +7,7 @@
#include "SOActiveX.h"
#include "SODispatchInterceptor.h"
#include "com_uno_helper.h"
+#include <sal/macros.h>
/////////////////////////////////////////////////////////////////////////////
//
@@ -18,7 +19,7 @@ STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid)
&IID_ISODispatchInterceptor,
};
- for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
+ for (int i=0;i<SAL_N_ELEMENTS(arr);i++)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
if (InlineIsEqualGUID(*arr[i],riid))
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 65cd795..91e098f 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -45,6 +45,7 @@
#define S_CYR_B "\xD0\xB1"
#include <math.h>
+#include <sal/macros.h>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/i18n/XTransliteration.hpp>
@@ -558,79 +559,67 @@ DefaultNumberingProvider::makeNumberingString( const
Sequence<beans::PropertyVal
case CHARS_CYRILLIC_UPPER_LETTER_BG:
lcl_formatChars2( table_CyrillicUpperLetter_bg,
table_CyrillicLowerLetter_bg,
- sizeof(table_CyrillicLowerLetter_bg) /
- sizeof(table_CyrillicLowerLetter_bg[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_bg), number-1,
result); // 1=>a, 2=>b, ..., 28=>z, 29=>Aa, 30=>Ab, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_BG:
lcl_formatChars( table_CyrillicLowerLetter_bg,
- sizeof(table_CyrillicLowerLetter_bg) /
- sizeof(table_CyrillicLowerLetter_bg[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_bg), number-1,
result); // 1=>a, 2=>b, ..., 28=>z, 29=>aa, 30=>ab, ...
break;
case CHARS_CYRILLIC_UPPER_LETTER_N_BG:
lcl_formatChars3( table_CyrillicUpperLetter_bg,
table_CyrillicLowerLetter_bg,
- sizeof(table_CyrillicLowerLetter_bg) /
- sizeof(table_CyrillicLowerLetter_bg[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_bg), number-1,
result); // 1=>a, 2=>b, ..., 28=>z, 29=>Aa, 30=>Bb, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_N_BG:
lcl_formatChars1( table_CyrillicLowerLetter_bg,
- sizeof(table_CyrillicLowerLetter_bg) /
- sizeof(table_CyrillicLowerLetter_bg[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_bg), number-1,
result); // 1=>a, 2=>b, ..., 28=>z, 29=>aa, 30=>bb, ...
break;
case CHARS_CYRILLIC_UPPER_LETTER_RU:
lcl_formatChars2( table_CyrillicUpperLetter_ru,
table_CyrillicLowerLetter_ru,
- sizeof(table_CyrillicLowerLetter_ru) /
- sizeof(table_CyrillicLowerLetter_ru[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_ru), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Ab, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_RU:
lcl_formatChars( table_CyrillicLowerLetter_ru,
- sizeof(table_CyrillicLowerLetter_ru) /
- sizeof(table_CyrillicLowerLetter_ru[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_ru), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>ab, ...
break;
case CHARS_CYRILLIC_UPPER_LETTER_N_RU:
lcl_formatChars3( table_CyrillicUpperLetter_ru,
table_CyrillicLowerLetter_ru,
- sizeof(table_CyrillicLowerLetter_ru) /
- sizeof(table_CyrillicLowerLetter_ru[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_ru), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Bb, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_N_RU:
lcl_formatChars1( table_CyrillicLowerLetter_ru,
- sizeof(table_CyrillicLowerLetter_ru) /
- sizeof(table_CyrillicLowerLetter_ru[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_ru), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>bb, ...
break;
case CHARS_CYRILLIC_UPPER_LETTER_SR:
lcl_formatChars2( table_CyrillicUpperLetter_sr,
table_CyrillicLowerLetter_sr,
- sizeof(table_CyrillicLowerLetter_sr) /
- sizeof(table_CyrillicLowerLetter_sr[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_sr), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Ab, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_SR:
lcl_formatChars( table_CyrillicLowerLetter_sr,
- sizeof(table_CyrillicLowerLetter_sr) /
- sizeof(table_CyrillicLowerLetter_sr[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_sr), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>ab, ...
break;
case CHARS_CYRILLIC_UPPER_LETTER_N_SR:
lcl_formatChars3( table_CyrillicUpperLetter_sr,
table_CyrillicLowerLetter_sr,
- sizeof(table_CyrillicLowerLetter_sr) /
- sizeof(table_CyrillicLowerLetter_sr[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_sr), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Bb, ...
break;
case CHARS_CYRILLIC_LOWER_LETTER_N_SR:
lcl_formatChars1( table_CyrillicLowerLetter_sr,
- sizeof(table_CyrillicLowerLetter_sr) /
- sizeof(table_CyrillicLowerLetter_sr[0]), number-1,
+ SAL_N_ELEMENTS(table_CyrillicLowerLetter_sr), number-1,
result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>bb, ...
break;
case CHARS_PERSIAN:
diff --git a/regexp/orig/regex.c b/regexp/orig/regex.c
index 6cde9f4..55be9ac 100644
--- a/regexp/orig/regex.c
+++ b/regexp/orig/regex.c
@@ -5817,8 +5817,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t msg_size;
if (errcode < 0
- || errcode >= (int) (sizeof (re_error_msgid_idx)
- / sizeof (re_error_msgid_idx[0])))
+ || errcode >= (int)SAL_N_ELEMENTS(re_error_msgid_idx))
/* Only error codes returned by the rest of the code should be passed
to this routine. If we are given anything else, or if other regex
code generates an invalid error code, then the program has a bug.
diff --git a/odk/examples/OLE/activex/SOComWindowPeer.cpp
b/odk/examples/OLE/activex/SOComWindowPeer.cpp
index 0b2fabf..c34914c 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/sal/textenc/convertadobe.tab b/sal/textenc/convertadobe.tab
index f676f7c..e63f33c 100644
--- a/sal/textenc/convertadobe.tab
+++ b/sal/textenc/convertadobe.tab
@@ -30,6 +30,7 @@
#include "tenchelp.h"
#include "rtl/tencinfo.h"
+#include <sal/macros.h>
namespace {
@@ -103,8 +104,7 @@ adobeStandardEncodingConverterData = {
0x0141, 0x00D8, 0x0152, 0x00BA, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0x00E6, 0xffff, 0xffff, 0xffff, 0x0131, 0xffff, 0xffff, // 0xF0
0x0142, 0x00F8, 0x0153, 0x00DF, 0xffff, 0xffff, 0xffff, 0xffff },
- (sizeof unicodeToAdobeStandardEncoding
- / sizeof unicodeToAdobeStandardEncoding[0]),
+ SAL_N_ELEMENTS(unicodeToAdobeStandardEncoding),
unicodeToAdobeStandardEncoding };
// RTL_TEXTENCODING_ADOBE_SYMBOL is based on
@@ -225,8 +225,7 @@ adobeSymbolEncodingConverterData = {
0x239D, 0x23A1, 0x23A2, 0x23A3, 0x23A7, 0x23A8, 0x23A9, 0x23AA,
0xffff, 0x232A, 0x222B, 0x2320, 0x23AE, 0x2321, 0x239E, 0x239F, // 0xF0
0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD, 0xffff },
- (sizeof unicodeToAdobeSymbolEncoding
- / sizeof unicodeToAdobeSymbolEncoding[0]),
+ SAL_N_ELEMENTS( unicodeToAdobeSymbolEncoding ),
unicodeToAdobeSymbolEncoding };
// RTL_TEXTENCODING_ADOBE_DINGBATS is based on
Context
- [Libreoffice] [PATCH] final SAL_N_ELEMENTS · Kenneth Venken
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.