[Libreoffice-commits] .: binfilter/bf_sc binfilter/bf_sfx2 binfilter/bf_so3 binfilter/bf_starmath binfilter/bf_svtools binfilter/bf_svx binfilter/bf_sw binfilter/bf_xmloff filter/source hwpfilter/source lotuswordpro/source writerfilter/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Sat Oct 16 12:57:54 PDT 2010
binfilter/bf_sc/source/core/tool/sc_interpr2.cxx | 4
binfilter/bf_sc/source/ui/app/sc_sclib.cxx | 3
binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx | 4
binfilter/bf_so3/source/ole/helpers.cxx | 12 +-
binfilter/bf_so3/source/ole/socont.cxx | 10 --
binfilter/bf_starmath/source/starmath_cfgitem.cxx | 5 -
binfilter/bf_starmath/source/starmath_parse.cxx | 3
binfilter/bf_svtools/source/config/svt_addxmltostorageoptions.cxx | 3
binfilter/bf_svtools/source/config/svt_lingucfg.cxx | 3
binfilter/bf_svtools/source/config/svt_printoptions.cxx | 3
binfilter/bf_svtools/source/config/svt_searchopt.cxx | 3
binfilter/bf_svx/source/items/svx_paperinf.cxx | 4
binfilter/bf_svx/source/unodraw/svx_unoprov.cxx | 3
binfilter/bf_svx/source/xml/svx_xmlgrhlp.cxx | 3
binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx | 3
binfilter/bf_sw/source/filter/w4w/sw_w4wpar1.cxx | 4
binfilter/bf_sw/source/filter/xml/sw_xmlimp.cxx | 16 +--
binfilter/bf_sw/source/ui/app/sw_docshini.cxx | 5 -
binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx | 46 +++++-----
filter/source/msfilter/countryid.cxx | 3
filter/source/placeware/tempfile.cxx | 7 -
hwpfilter/source/hcode.cpp | 7 -
hwpfilter/source/hwpeq.cpp | 3
hwpfilter/source/mapping.h | 3
lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 3
lotuswordpro/source/filter/LotusWordProImportFilter.cxx.orig | 3
writerfilter/source/dmapper/CellColorHandler.cxx | 3
writerfilter/source/rtftok/RTFScanner.lex | 3
28 files changed, 97 insertions(+), 75 deletions(-)
New commits:
commit c40c4248864330fd18ef46aa023ea2cffe756de2
Author: Kenneth Venken <kenneth.venken at gmail.com>
Date: Sat Oct 16 20:56:58 2010 +0100
some patches that replace sizeof(a)/sizeof(a[0]) with SAL_N_ELEMENTS(a)
diff --git a/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx b/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
index 209dd49..52bdf1d 100644
--- a/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
+++ b/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
@@ -36,6 +36,7 @@
#include <bf_svtools/zforlist.hxx>
#include <string.h>
#include <math.h>
+#include <sal/macros.h>
#include "interpre.hxx"
#include "bf_sc.hrc"
@@ -45,6 +46,7 @@
#include "unitconv.hxx"
#include "globstr.hrc"
#include "hints.hxx"
+
namespace binfilter {
// STATIC DATA -----------------------------------------------------------
@@ -2024,7 +2026,7 @@ void ScInterpreter::ScRoman()
{
static const sal_Unicode pChars[] = { 'M', 'D', 'C', 'L', 'X', 'V', 'I' };
static const USHORT pValues[] = { 1000, 500, 100, 50, 10, 5, 1 };
- static const USHORT nMaxIndex = (USHORT)(sizeof(pValues) / sizeof(pValues[0]) - 1);
+ static const USHORT nMaxIndex = (USHORT)(SAL_N_ELEMENTS(pValues) - 1);
String aRoman;
USHORT nVal = (USHORT) fVal;
diff --git a/binfilter/bf_sc/source/ui/app/sc_sclib.cxx b/binfilter/bf_sc/source/ui/app/sc_sclib.cxx
index c50f1b6..1d3dc24 100644
--- a/binfilter/bf_sc/source/ui/app/sc_sclib.cxx
+++ b/binfilter/bf_sc/source/ui/app/sc_sclib.cxx
@@ -43,6 +43,7 @@
#include <bf_sfx2/app.hxx>
#include <unotools/configitem.hxx>
#include <comphelper/types.hxx>
+#include <sal/macros.h>
#include <sot/formats.hxx>
#define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
@@ -515,7 +516,7 @@ BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
/*N*/ pSylk,
/*N*/ pLotus2
/*N*/ };
-/*N*/ const UINT16 nAnzMuster = sizeof(ppMuster) / sizeof(ppMuster[0]);
+/*N*/ const UINT16 nAnzMuster = SAL_N_ELEMENTS(ppMuster);
/*N*/ #endif
/*N*/
/*N*/ const sal_Char* pFilterName[ nAnzMuster ] = // zugehoerige Filter
diff --git a/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx b/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx
index dbfd2a0..4dc3a33 100644
--- a/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx
+++ b/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx
@@ -30,7 +30,7 @@
#include "bf_basic/sbxvar.hxx"
#include <bf_svtools/searchopt.hxx>
-
+#include <sal/macros.h>
#include <bf_svtools/memberid.hrc>
@@ -88,7 +88,7 @@ using namespace ::com::sun::star::uno;
/*N*/ "Japanese/IsIgnoreMiddleDot" // 18
/*N*/ };
/*N*/
-/*N*/ const int nCount = sizeof( aTranslitNames ) / sizeof( aTranslitNames[0] );
+/*N*/ const int nCount = SAL_N_ELEMENTS( aTranslitNames );
/*N*/ Sequence< OUString > aNames( nCount );
/*N*/ OUString* pNames = aNames.getArray();
/*N*/ for (INT32 i = 0; i < nCount; ++i)
diff --git a/binfilter/bf_so3/source/ole/helpers.cxx b/binfilter/bf_so3/source/ole/helpers.cxx
index 91127ae..68026f0 100644
--- a/binfilter/bf_so3/source/ole/helpers.cxx
+++ b/binfilter/bf_so3/source/ole/helpers.cxx
@@ -31,7 +31,7 @@
#include <systools/win32/snprintf.h>
-#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
+#include <sal/macros.h>
namespace binfilter {
static BOOL GetFileTimes(LPTSTR pszFileName, FILETIME *pft);
@@ -300,10 +300,10 @@ STDAPI_(UINT) StarObject_GetUserTypeOfClass(REFCLSID clsID, UINT iName
StarObject_StringFromCLSID(clsID, &pszCLSID);
if (0==iName)
- sntprintf(szKey, ARRAYSIZE(szKey), TEXT("CLSID\\%s"), pszCLSID);
+ sntprintf(szKey, SAL_N_ELEMENTS(szKey), TEXT("CLSID\\%s"), pszCLSID);
else
{
- sntprintf(szKey, ARRAYSIZE(szKey), TEXT("CLSID\\%s\\AuxUserType\\%u")
+ sntprintf(szKey, SAL_N_ELEMENTS(szKey), TEXT("CLSID\\%s\\AuxUserType\\%u")
, pszCLSID, iName);
}
@@ -370,7 +370,7 @@ STDAPI StarObject_DoConvert(IStorage *pIStorage, REFCLSID clsID)
//Get new user type
if (0==StarObject_GetUserTypeOfClass(clsID, 0, szNew, 256))
- lstrcpyn(szNew, TEXT(""), ARRAYSIZE(szNew));
+ lstrcpyn(szNew, TEXT(""), SAL_N_ELEMENTS(szNew));
//Write new class into the storage
if (SUCCEEDED(WriteClassStg(pIStorage, clsID)))
@@ -487,9 +487,9 @@ STDAPI_(HGLOBAL) StarObject_ObjectDescriptorFromOleObject
#endif
if (fLink && NULL!=pszName)
- sntprintf(szName, ARRAYSIZE(szName), TEXT("Linked %s"), pszName);
+ sntprintf(szName, SAL_N_ELEMENTS(szName), TEXT("Linked %s"), pszName);
else
- lstrcpyn(szName, pszName, ARRAYSIZE(szName));
+ lstrcpyn(szName, pszName, SAL_N_ELEMENTS(szName));
#ifndef WIN32ANSI
//#ifdef UNICODE
diff --git a/binfilter/bf_so3/source/ole/socont.cxx b/binfilter/bf_so3/source/ole/socont.cxx
index 9eab0cd..10cfbe5 100644
--- a/binfilter/bf_so3/source/ole/socont.cxx
+++ b/binfilter/bf_so3/source/ole/socont.cxx
@@ -28,7 +28,7 @@
#include "socont.h"
#include <bf_so3/svstor.hxx>
-
+#include <sal/macros.h>
#define LOMETRIC_PER_INCH 254
@@ -38,8 +38,6 @@
#define MAP_PIX_TO_LOGHIM(x,ppli) MulDiv(HIMETRIC_PER_INCH, (x), (ppli))
#define MAP_LOGHIM_TO_PIX(x,ppli) MulDiv((ppli), (x), HIMETRIC_PER_INCH)
-#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
-
namespace binfilter {
void SO_MetricRectInPixelsToHimetric( LPRECT prcPix, LPRECT prcHiMetric)
@@ -1507,13 +1505,13 @@ void CSO_Cont::NotifyOfRename(LPTSTR pszFile, LPVOID)
if (TEXT('\0')==*pszFile)
{
// MM ???
- lstrcpyn( szObj, "untitled", ARRAYSIZE(szObj) );
+ lstrcpyn( szObj, "untitled", SAL_N_ELEMENTS(szObj) );
//LoadString(m_pPG->m_hInst, IDS_UNTITLED, szObj, sizeof(szObj));
}
else
{
// MM ???
- lstrcpyn( szObj, "untitled", ARRAYSIZE(szObj) );
+ lstrcpyn( szObj, "untitled", SAL_N_ELEMENTS(szObj) );
//GetFileTitle(pszFile, szObj, sizeof(szObj));
#ifndef WIN32
@@ -1523,7 +1521,7 @@ void CSO_Cont::NotifyOfRename(LPTSTR pszFile, LPVOID)
}
// MM ???
- lstrcpyn( szApp, "app name", ARRAYSIZE(szApp) );
+ lstrcpyn( szApp, "app name", SAL_N_ELEMENTS(szApp) );
//LoadString(m_pPG->m_hInst, IDS_CAPTION, szApp, sizeof(szApp));
#ifdef WIN32ANSI
OLECHAR szObjW[40], szAppW[40];
diff --git a/binfilter/bf_starmath/source/starmath_cfgitem.cxx b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
index b1a4883..acd6159 100644
--- a/binfilter/bf_starmath/source/starmath_cfgitem.cxx
+++ b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
@@ -31,6 +31,7 @@
#endif
#include <vcl/svapp.hxx>
+#include <sal/macros.h>
#include "cfgitem.hxx"
@@ -190,14 +191,14 @@ static const char* aRootName = "Office.Math";
/*N*/ Sequence< OUString > SmMathConfigItem::GetFormatPropertyNames()
/*N*/ {
-/*N*/ USHORT nCnt = sizeof(aFormatPropNames) / sizeof(aFormatPropNames[0]);
+/*N*/ USHORT nCnt = SAL_N_ELEMENTS(aFormatPropNames);
/*N*/ return lcl_GetPropertyNames( aFormatPropNames, nCnt );
/*N*/ }
/*N*/ Sequence< OUString > SmMathConfigItem::GetOtherPropertyNames()
/*N*/ {
-/*N*/ USHORT nCnt = sizeof(aMathPropNames) / sizeof(aMathPropNames[0]);
+/*N*/ USHORT nCnt = SAL_N_ELEMENTS(aMathPropNames);
/*N*/ return lcl_GetPropertyNames( aMathPropNames, nCnt );
/*N*/ }
diff --git a/binfilter/bf_starmath/source/starmath_parse.cxx b/binfilter/bf_starmath/source/starmath_parse.cxx
index 7ea4ff0..6f2bcd4 100644
--- a/binfilter/bf_starmath/source/starmath_parse.cxx
+++ b/binfilter/bf_starmath/source/starmath_parse.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <bf_svtools/syslocale.hxx>
+#include <sal/macros.h>
#include "starmath.hrc"
#include "config.hxx"
@@ -327,7 +328,7 @@ using namespace ::com::sun::star::i18n;
/*N*/ const SmTokenTableEntry * pRes = 0;
/*N*/ if (rName.Len())
/*N*/ {
-/*N*/ INT32 nEntries = sizeof( aTokenTable ) / sizeof( aTokenTable[0] );
+/*N*/ INT32 nEntries = SAL_N_ELEMENTS( aTokenTable );
/*N*/ for (INT32 i = 0; i < nEntries; ++i)
/*N*/ {
/*N*/ if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
diff --git a/binfilter/bf_svtools/source/config/svt_addxmltostorageoptions.cxx b/binfilter/bf_svtools/source/config/svt_addxmltostorageoptions.cxx
index d6800d9..1daf3b3 100644
--- a/binfilter/bf_svtools/source/config/svt_addxmltostorageoptions.cxx
+++ b/binfilter/bf_svtools/source/config/svt_addxmltostorageoptions.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/logfile.hxx>
+#include <sal/macros.h>
#include "itemholder1.hxx"
//_________________________________________________________________________________________________________________
@@ -207,7 +208,7 @@ Sequence< OUString > SvtAddXMLToStorageOptions_Impl::GetPropertyNames()
"Draw"
};
- const sal_uInt16 nCnt = sizeof(pProperties) / sizeof( pProperties[0] );
+ const sal_uInt16 nCnt = SAL_N_ELEMENTS(pProperties);
Sequence<OUString> aNames( nCnt );
OUString* pNames = aNames.getArray();
for( sal_uInt16 n = 0; n < nCnt; ++n )
diff --git a/binfilter/bf_svtools/source/config/svt_lingucfg.cxx b/binfilter/bf_svtools/source/config/svt_lingucfg.cxx
index e413a42..7b73d28 100644
--- a/binfilter/bf_svtools/source/config/svt_lingucfg.cxx
+++ b/binfilter/bf_svtools/source/config/svt_lingucfg.cxx
@@ -35,6 +35,7 @@
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
#include <vcl/svapp.hxx>
+#include <sal/macros.h>
#include <bf_svtools/lingucfg.hxx>
#include <linguprops.hxx>
@@ -261,7 +262,7 @@ const Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames()
if (!bInitialized)
{
- INT32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]);
+ INT32 nMax = SAL_N_ELEMENTS(aNamesToHdl);
aNames.realloc( nMax );
OUString *pNames = aNames.getArray();
diff --git a/binfilter/bf_svtools/source/config/svt_printoptions.cxx b/binfilter/bf_svtools/source/config/svt_printoptions.cxx
index c9c1bf8..f028858 100644
--- a/binfilter/bf_svtools/source/config/svt_printoptions.cxx
+++ b/binfilter/bf_svtools/source/config/svt_printoptions.cxx
@@ -36,6 +36,7 @@
#include <unotools/configitem.hxx>
#include <tools/debug.hxx>
#include <vcl/print.hxx>
+#include <sal/macros.h>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -48,7 +49,7 @@
namespace binfilter
{
-#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ]))
+#define DPI_COUNT (SAL_N_ELEMENTS(aDPIArray))
// -----------
// - Defines -
diff --git a/binfilter/bf_svtools/source/config/svt_searchopt.cxx b/binfilter/bf_svtools/source/config/svt_searchopt.cxx
index 4dc48b9..545c3ed 100644
--- a/binfilter/bf_svtools/source/config/svt_searchopt.cxx
+++ b/binfilter/bf_svtools/source/config/svt_searchopt.cxx
@@ -34,6 +34,7 @@
#include <tools/solar.h>
#include <tools/debug.hxx>
#include <unotools/configitem.hxx>
+#include <sal/macros.h>
#include <com/sun/star/i18n/TransliterationModules.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -173,7 +174,7 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const
"Japanese/IsIgnoreMiddleDot" // 24
};
- const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] );
+ const int nCount = SAL_N_ELEMENTS( aPropNames );
Sequence< OUString > aNames( nCount );
OUString* pNames = aNames.getArray();
for (INT32 i = 0; i < nCount; ++i)
diff --git a/binfilter/bf_svx/source/items/svx_paperinf.cxx b/binfilter/bf_svx/source/items/svx_paperinf.cxx
index 6201262..bf0e181 100644
--- a/binfilter/bf_svx/source/items/svx_paperinf.cxx
+++ b/binfilter/bf_svx/source/items/svx_paperinf.cxx
@@ -30,7 +30,7 @@
#include <limits.h>
-
+#include <sal/macros.h>
#include "dialogs.hrc"
#include "paperinf.hxx"
namespace binfilter {
@@ -82,7 +82,7 @@ static Size __FAR_DATA aDinTab[] =
Size(lJISB6Width, lJISB6Height) // B6 (JIS)
};
-static const int nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
+static const int nTabSize = SAL_N_ELEMENTS(aDinTab);
// -----------------------------------------------------------------------
diff --git a/binfilter/bf_svx/source/unodraw/svx_unoprov.cxx b/binfilter/bf_svx/source/unodraw/svx_unoprov.cxx
index cdcf1b9..b83c8b2 100644
--- a/binfilter/bf_svx/source/unodraw/svx_unoprov.cxx
+++ b/binfilter/bf_svx/source/unodraw/svx_unoprov.cxx
@@ -37,6 +37,7 @@
#include <tools/shl.hxx>
#include <vcl/svapp.hxx>
+#include <sal/macros.h>
#include <hash_map>
@@ -704,7 +705,7 @@ namespace {
{ RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG },
{ RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG }
};
- for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++)
+ for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++)
aImpl[rtl::OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id;
bInited = true;
}
diff --git a/binfilter/bf_svx/source/xml/svx_xmlgrhlp.cxx b/binfilter/bf_svx/source/xml/svx_xmlgrhlp.cxx
index be83f49..0e67454 100644
--- a/binfilter/bf_svx/source/xml/svx_xmlgrhlp.cxx
+++ b/binfilter/bf_svx/source/xml/svx_xmlgrhlp.cxx
@@ -30,6 +30,7 @@
#include <unotools/streamwrap.hxx>
#include <unotools/tempfile.hxx>
#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <sal/macros.h>
#include "impgrf.hxx"
#include "xmlgrhlp.hxx"
@@ -433,7 +434,7 @@ public:
/*N*/ {
/*N*/ const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US );
/*N*/
-/*N*/ for( long i = 0, nCount = sizeof( aMapper ) / sizeof( aMapper[ 0 ] ); ( i < nCount ) && !aMimeType.Len(); i++ )
+/*N*/ for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ )
/*N*/ if( aExt == aMapper[ i ].pExt )
/*N*/ aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US );
/*N*/ }
diff --git a/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx b/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx
index 901a203..5161dd3 100644
--- a/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx
+++ b/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx
@@ -36,6 +36,7 @@
#include <bf_svx/ulspitem.hxx>
#include <bf_svx/lrspitem.hxx>
#include <bf_svx/fhgtitem.hxx>
+#include <sal/macros.h>
#include <horiornt.hxx>
@@ -208,7 +209,7 @@ namespace binfilter {
/*N*/ }
/*N*/
/*N*/
-/*N*/ for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]);
+/*N*/ for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr);
/*N*/ nC < nArrLen; ++nC )
/*N*/ {
/*N*/ SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
diff --git a/binfilter/bf_sw/source/filter/w4w/sw_w4wpar1.cxx b/binfilter/bf_sw/source/filter/w4w/sw_w4wpar1.cxx
index 0852643..9c6ccf7 100644
--- a/binfilter/bf_sw/source/filter/w4w/sw_w4wpar1.cxx
+++ b/binfilter/bf_sw/source/filter/w4w/sw_w4wpar1.cxx
@@ -97,6 +97,8 @@
#include <flddat.hxx> // class SwDateTimeField
#include <swunohelper.hxx>
+#include <sal/macros.h>
+
#include <swerror.h>
#include <mdiexp.hxx> // ...SetPercent()
#include <statstr.hrc> // ResId fuer Statusleiste
@@ -108,7 +110,7 @@ namespace binfilter {
#define MOGEL_WW6 // Bei WW6 werden PGW und SFL ignoriert, da falsch
-#define CHARBUF_SIZE (sizeof( aCharBuffer )/sizeof( aCharBuffer[0]))
+#define CHARBUF_SIZE (SAL_N_ELEMENTS( aCharBuffer ))
// #define bInsertMode FALSE
diff --git a/binfilter/bf_sw/source/filter/xml/sw_xmlimp.cxx b/binfilter/bf_sw/source/filter/xml/sw_xmlimp.cxx
index 6de6cf4..1245671 100644
--- a/binfilter/bf_sw/source/filter/xml/sw_xmlimp.cxx
+++ b/binfilter/bf_sw/source/filter/xml/sw_xmlimp.cxx
@@ -80,7 +80,7 @@
// for locking SolarMutex: svapp + mutex
#include <vcl/svapp.hxx>
-
+#include <sal/macros.h>
#include <vos/mutex.hxx>
namespace binfilter {
@@ -909,6 +909,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
#include <stdio.h>
#include <string.h>
+#include <sal/macros.h>
+
const char* aNmArr[] = {
"ForbiddenCharacters" ,
"IsKernAsianPunctuation" ,
@@ -950,20 +952,20 @@ int Chk_Unique_hashValue( unsigned short nTblSize )
{
memset( aArr, 0, sizeof( aArr ) );
unsigned long ii;
- for( int n = 0; n < sizeof( aNmArr ) / sizeof( aNmArr[0] ); ++n )
+ for( int n = 0; n < SAL_N_ELEMENTS( aNmArr ); ++n )
{
ii = calc_hash( aNmArr[ n ] ) % nTblSize;
if( aArr[ ii ] )
break;
aArr[ ii ] = 1;
}
- return n == ( sizeof( aNmArr ) / sizeof( aNmArr[0] ) );
+ return n == SAL_N_ELEMENTS( aNmArr );
}
void Show_Result( unsigned short nTblSize )
{
printf( "\nTblSz = %d\n", nTblSize );
- for( int n = 0; n < sizeof( aNmArr ) / sizeof( aNmArr[0] ); ++n )
+ for( int n = 0; n < SAL_N_ELEMENTS( aNmArr ); ++n )
{
unsigned long ii = calc_hash( aNmArr[ n ] ) % nTblSize;
printf( "%-30s -> %3d\n", aNmArr[ n ], ii );
@@ -977,7 +979,7 @@ void main()
for( nSub = ' '; nSub < 127; ++nSub )
for( nPrime = 13 ; nPrime < 99; ++nPrime )
- for( nTblSize = sizeof( aNmArr ) / sizeof( aNmArr[0] );
+ for( nTblSize = SAL_N_ELEMENTS( aNmArr );
nTblSize < TBL_MAX; ++nTblSize )
if( Chk_Unique_hashValue( nTblSize ))
{
@@ -996,7 +998,7 @@ void main()
Show_Result( nTblSize );
printf( "\nPrime: %d, nSub: %d, TblSz = %d - %d", nPrime, nSub,
- sizeof( aNmArr ) / sizeof( aNmArr[0] ), nTblSize );
+ SAL_N_ELEMENTS( aNmArr ), nTblSize );
}
-----------------------------------------------------------------
*/
@@ -1069,7 +1071,7 @@ void main()
const sal_Unicode* p = pValues->Name;
for( ULONG nLen = pValues->Name.getLength(); nLen; --nLen, ++p )
nHash = (nHash * nPrime) ^ ( *p - nSub );
- nHash %= sizeof( aNotSetArr ) / sizeof( aNotSetArr[0] );
+ nHash %= SAL_N_ELEMENTS( aNotSetArr );
bSet = 0 == aNotSetArr[ nHash ].pName ||
!pValues->Name.equalsAsciiL(
aNotSetArr[ nHash ].pName,
diff --git a/binfilter/bf_sw/source/ui/app/sw_docshini.cxx b/binfilter/bf_sw/source/ui/app/sw_docshini.cxx
index 0be3a31..5c85ecb 100644
--- a/binfilter/bf_sw/source/ui/app/sw_docshini.cxx
+++ b/binfilter/bf_sw/source/ui/app/sw_docshini.cxx
@@ -38,6 +38,7 @@
//Statt uiparam.hxx selbst definieren, das spart keys
#include <bf_svx/dialogs.hrc>
+#include <sal/macros.h>
#define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST
#include <sot/storinfo.hxx>
@@ -742,8 +743,8 @@ using namespace ::rtl;
/*M*/ 0, 0, 0 };
/*M*/ if(!bWeb)
/*M*/ {
-/*M*/ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP;
-/*M*/ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE;
+/*M*/ nRange[ SAL_N_ELEMENTS(nRange) - 3 ] = RES_PARATR_TABSTOP;
+/*M*/ nRange[ SAL_N_ELEMENTS(nRange) - 2 ] = RES_PARATR_HYPHENZONE;
/*M*/ }
/*M*/ SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange );
/*M*/
diff --git a/binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx b/binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx
index dbe9e1d..f227e06 100644
--- a/binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx
+++ b/binfilter/bf_xmloff/source/forms/xmloff_elementexport.cxx
@@ -28,6 +28,7 @@
#include <stdio.h>
+#include <sal/macros.h>
#include <xmlexp.hxx>
#include "elementexport.hxx"
#include "xmluconv.hxx"
@@ -399,11 +400,10 @@ namespace xmloff
{
PROPERTY_LABEL, PROPERTY_TITLE
};
- OSL_ENSURE( sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) ==
- sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
+ OSL_ENSURE( SAL_N_ELEMENTS(aStringPropertyNames) == SAL_N_ELEMENTS(nStringPropertyAttributeIds),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
- for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
+ for (i = 0; i < SAL_N_ELEMENTS(nStringPropertyAttributeIds); ++i)
if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportStringPropertyAttribute(
@@ -434,13 +434,13 @@ namespace xmloff
BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID
};
#ifdef DBG_UTIL
- sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
- sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
#endif
- for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
+ for (i=0; i<SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); ++i)
if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportBooleanPropertyAttribute(
@@ -477,13 +477,13 @@ namespace xmloff
exportedProperty(PROPERTY_MAXTEXTLENGTH);
#ifdef DBG_UTIL
- sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
- sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
- sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nIntegerPropertyAttributeIds);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pIntegerPropertyNames);
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nIntegerPropertyAttrDefaults);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
#endif
- for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
+ for (i=0; i<SAL_N_ELEMENTS(nIntegerPropertyAttributeIds); ++i)
if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
{
exportInt16PropertyAttribute(
@@ -771,9 +771,9 @@ namespace xmloff
{ // property names
&PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE
};
- sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds);
#ifdef DBG_UTIL
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
OSL_ENSURE((nIdCount == nNameCount),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
#endif
@@ -1545,9 +1545,9 @@ namespace xmloff
{
PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_DATASOURCENAME, PROPERTY_FILTER, PROPERTY_ORDER
};
- sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eStringPropertyIds);
#ifdef DBG_UTIL
- sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(aStringPropertyNames);
OSL_ENSURE((nIdCount == nNameCount),
"OFormExport::exportAttributes: somebody tampered with the maps (1)!");
#endif
@@ -1573,10 +1573,10 @@ namespace xmloff
{
BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
};
- sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds);
#ifdef DBG_UTIL
- sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
- sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pBooleanPropertyNames);
+ sal_Int32 nFlagsCount = SAL_N_ELEMENTS(nBooleanPropertyAttrFlags);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
"OFormExport::exportAttributes: somebody tampered with the maps (2)!");
#endif
@@ -1612,12 +1612,12 @@ namespace xmloff
{
sal_False, sal_False, sal_False, sal_False, sal_True
};
- sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
+ sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds);
#ifdef DBG_UTIL
- sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]);
- sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]);
- sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]);
- sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]);
+ sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames);
+ sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults);
+ sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags);
+ sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps);
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
"OFormExport::exportAttributes: somebody tampered with the maps (3)!");
#endif
diff --git a/filter/source/msfilter/countryid.cxx b/filter/source/msfilter/countryid.cxx
index e1681d7..c534e8e 100644
--- a/filter/source/msfilter/countryid.cxx
+++ b/filter/source/msfilter/countryid.cxx
@@ -33,6 +33,7 @@
#include "filter/msfilter/countryid.hxx"
#include <algorithm>
+#include <sal/macros.h>
// ----------------------------------------------------------------------------
@@ -258,7 +259,7 @@ static const CountryEntry pTable[] =
{ COUNTRY_UZBEKISTAN, LANGUAGE_UZBEK_LATIN, false }
};
-const CountryEntry * const pEnd = pTable + sizeof( pTable ) / sizeof( pTable[ 0 ] );
+const CountryEntry * const pEnd = pTable + SAL_N_ELEMENTS( pTable );
// ----------------------------------------------------------------------------
diff --git a/filter/source/placeware/tempfile.cxx b/filter/source/placeware/tempfile.cxx
index 407bd09..48758fd 100644
--- a/filter/source/placeware/tempfile.cxx
+++ b/filter/source/placeware/tempfile.cxx
@@ -31,6 +31,7 @@
#include <osl/file.h>
+#include <sal/macros.h>
#if defined( UNX) || defined(OS2)
@@ -88,20 +89,18 @@ oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir )
#pragma warning(pop)
#endif
-#define elementsof(arr) (sizeof(arr)/sizeof(arr[0]))
-
oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir )
{
WCHAR szBuffer[MAX_PATH];
LPWSTR lpBuffer = szBuffer;
- DWORD nBufferLength = elementsof(szBuffer) - 1;
+ DWORD nBufferLength = SAL_N_ELEMENTS(szBuffer) - 1;
DWORD nLength;
oslFileError error;
do
{
- nLength = GetTempPathW( elementsof(szBuffer), lpBuffer );
+ nLength = GetTempPathW( SAL_N_ELEMENTS(szBuffer), lpBuffer );
if ( nLength > nBufferLength )
{
nLength++;
diff --git a/hwpfilter/source/hcode.cpp b/hwpfilter/source/hcode.cpp
index acb8c33..e87bdc0 100644
--- a/hwpfilter/source/hcode.cpp
+++ b/hwpfilter/source/hcode.cpp
@@ -34,6 +34,7 @@
*/
#include "precompile.h"
#include <sal/types.h>
+#include <sal/macros.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -596,7 +597,7 @@ static int is_jaso(hchar hh)
{
unsigned int i;
- for (i = 0; i < sizeof(jaso_hh_code) / sizeof(jaso_hh_code[0]); i++)
+ for (i = 0; i < SAL_N_ELEMENTS(jaso_hh_code); i++)
if (hh == jaso_hh_code[i])
return 1;
return 0;
@@ -607,7 +608,7 @@ static hchar jaso2ks(hchar hh)
{
unsigned int i;
- for (i = 0; i < sizeof(jaso_hh_code) / sizeof(jaso_hh_code[0]); i++)
+ for (i = 0; i < SAL_N_ELEMENTS(jaso_hh_code); i++)
if (hh == jaso_hh_code[i])
{
return sal::static_int_cast<hchar>(0xa4a1 + i);
@@ -1117,7 +1118,7 @@ int kssm_hangul_to_ucs2(hchar ch, hchar *dest)
}
else{ /* °í¾îÆ÷ÇÔ ÀÚ¸ðÁ¶ÇÕ : Å×ÀÌºí ¹Ì¿Ï¼º */
unsigned int index = choseong * 32 + jongseong - 308;
- if( index < sizeof(jamocomp1_to_unicode)/sizeof(jamocomp1_to_unicode[0])){
+ if( index < SAL_N_ELEMENTS(jamocomp1_to_unicode) ){
dest[0] = jamocomp1_to_unicode[index].v1;
dest[1] = jamocomp1_to_unicode[index].v2;
dest[2] = jamocomp1_to_unicode[index].v3;
diff --git a/hwpfilter/source/hwpeq.cpp b/hwpfilter/source/hwpeq.cpp
index e75f674..cc0cafa 100644
--- a/hwpfilter/source/hwpeq.cpp
+++ b/hwpfilter/source/hwpeq.cpp
@@ -38,6 +38,7 @@ using namespace std;
#include "mzstring.h"
#include "hwpeq.h"
#include <sal/types.h>
+#include <sal/macros.h>
//#define TEST
//#define DEBUG
@@ -392,7 +393,7 @@ static hwpeq eq_tbl[] = {
static hwpeq *lookup_eqn(char *str)
{
- static int eqCount = sizeof(eq_tbl) / sizeof(eq_tbl[0]);
+ static int eqCount = SAL_N_ELEMENTS(eq_tbl);
int m, k, l = 0, r = eqCount;
hwpeq *result = 0;
diff --git a/hwpfilter/source/mapping.h b/hwpfilter/source/mapping.h
index 276e5c7..2e52051 100644
--- a/hwpfilter/source/mapping.h
+++ b/hwpfilter/source/mapping.h
@@ -30,6 +30,7 @@
#include <string.h>
#include <stdio.h>
+#include <sal/macros.h>
typedef unsigned short hchar;
@@ -369,7 +370,7 @@ const struct FormulaEntry FormulaMapTab[] = {
#ifndef DEBUG
hchar *getMathMLEntity(const char *tex, hchar *buf)
{
- static int tabSize = sizeof( FormulaMapTab ) / sizeof( FormulaMapTab[0] );
+ static int tabSize = SAL_N_ELEMENTS( FormulaMapTab );
int i, len;
for( i = 0 ; i < tabSize ; i++ ){
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index 5465f55..f10ab48 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -1,5 +1,6 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <osl/diagnose.h>
+#include <sal/macros.h>
#include <rtl/tencinfo.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -318,7 +319,7 @@ OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequenc
}
Sequence< ::sal_Int8 > aData;
- sal_Int32 nLen = sizeof( header ) / sizeof( header[0] );
+ sal_Int32 nLen = SAL_N_ELEMENTS( header );
if ( ( nLen == xInputStream->readBytes( aData, nLen ) ) )
if ( memcmp( ( void* )header, (void*) aData.getConstArray(), nLen ) == 0 )
sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_LotusWordPro_Document" ) );
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx.orig b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx.orig
index 481e214..ed4481b 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx.orig
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx.orig
@@ -1,4 +1,5 @@
#include <osl/diagnose.h>
+#include <sal/macros.h>
#include <rtl/tencinfo.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -317,7 +318,7 @@ OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequenc
}
Sequence< ::sal_Int8 > aData;
- sal_Int32 nLen = sizeof( header ) / sizeof( header[0] );
+ sal_Int32 nLen = SAL_N_ELEMENTS( header );
if ( ( nLen == xInputStream->readBytes( aData, nLen ) ) )
if ( memcmp( ( void* )header, (void*) aData.getConstArray(), nLen ) == 0 )
sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_LotusWordPro_Document" ) );
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index 3046157..8c8cfe9 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -30,6 +30,7 @@
#include <doctok/resourceids.hxx>
#include <ConversionHelper.hxx>
#include <ooxml/resourceids.hxx>
+#include <sal/macros.h>
#define OOXML_COLOR_AUTO 0x0a //todo: AutoColor needs symbol
@@ -203,7 +204,7 @@ TablePropertyMapPtr CellColorHandler::getProperties()
// und zu guter Letzt:
970
};// 62
- if( m_nShadowType >= (sal_Int32)(sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] )) )
+ if( m_nShadowType >= (sal_Int32)SAL_N_ELEMENTS( eMSGrayScale ) )
m_nShadowType = 0;
sal_Int32 nWW8BrushStyle = eMSGrayScale[m_nShadowType];
diff --git a/writerfilter/source/rtftok/RTFScanner.lex b/writerfilter/source/rtftok/RTFScanner.lex
index f3c81a1..1cbc636 100644
--- a/writerfilter/source/rtftok/RTFScanner.lex
+++ b/writerfilter/source/rtftok/RTFScanner.lex
@@ -31,6 +31,7 @@
#include <math.h>
#include <string.h>
#include <osl/file.h>
+#include <sal/macros.h>
#include <assert.h>
#include <vector>
@@ -102,7 +103,7 @@ void yyFlexLexer::split_ctrl(char *_yytext, char* token, char *value)
eventHandler.dest(token, value);
}
-#define _num_of_destctrls (sizeof(_destctrls)/sizeof(_destctrls[0]))
+#define _num_of_destctrls (SAL_N_ELEMENTS(_destctrls))
static const char* _destctrls[] = {
"aftncn",
"aftnsep",
More information about the Libreoffice-commits
mailing list