[Libreoffice-commits] .: sw/source

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Sat Oct 16 22:26:50 PDT 2010


 sw/source/ui/lingu/olmenu.cxx    |    3 ++-
 sw/source/ui/misc/pgfnote.cxx    |    3 ++-
 sw/source/ui/uiview/viewsrch.cxx |    7 ++++---
 sw/source/ui/vba/vbaborders.cxx  |    3 ++-
 sw/source/ui/vba/vbafont.cxx     |    3 ++-
 sw/source/ui/vba/vbaglobals.cxx  |    4 ++--
 sw/source/ui/vba/vbapalette.cxx  |    2 +-
 7 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 72a83e4c136d41e2923ac9fc5ed882cd0961fcdc
Author: Kenneth Venken <kenneth.venken at gmail.com>
Date:   Sun Oct 17 00:19:29 2010 -0500

    use SAL_N_ELEMENTS macro

diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index e0f99dd..f97c231 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -91,6 +91,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
+#include <sal/macros.h>
 
 #include <map>
 
@@ -179,7 +180,7 @@ LanguageType lcl_CheckLanguage(
         lang::Locale a3( SvxCreateLocale( aLangList[3] ) );
 #endif
 
-        INT32   nCount = sizeof(aLangList) / sizeof(aLangList[0]);
+        INT32   nCount = SAL_N_ELEMENTS(aLangList);
         for (INT32 i = 0;  i < nCount;  i++)
         {
             INT16 nTmpLang = aLangList[i];
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 03ec907..018047d 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -39,6 +39,7 @@
 #include <hintids.hxx>
 #include <tools/ref.hxx>
 #include <svx/dialogs.hrc>
+#include <sal/macros.h>
 #include <vcl/field.hxx>
 #include <vcl/svapp.hxx>
 #include <unotools/localedatawrapper.hxx>
@@ -70,7 +71,7 @@ static const USHORT __FAR_DATA nLines[] = {
     500
 };
 
-static const USHORT nLineCount = sizeof(nLines) / sizeof(nLines[0]);
+static const USHORT nLineCount = SAL_N_ELEMENTS(nLines);
 
 static USHORT __FAR_DATA aPageRg[] = {
     FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO,
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index 9f4323d..97e4ac3 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -43,6 +43,7 @@
 #include <svl/itempool.hxx>
 #include <svl/eitem.hxx>
 #include <svl/srchitem.hxx>
+#include <sal/macros.h>
 #include <sfx2/request.hxx>
 #include <svx/srchdlg.hxx>
 #include <vcl/msgbox.hxx>
@@ -380,16 +381,16 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
 
             SvUShorts aArr( 0, 16 );
             aArr.Insert(	aNormalAttr,
-                            sizeof( aNormalAttr ) / sizeof( aNormalAttr[0] ),
+                            SAL_N_ELEMENTS( aNormalAttr ),
                             0 );
             if( SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
                 aArr.Insert(	aCTLAttr,
-                                sizeof( aCTLAttr ) / sizeof( aCTLAttr[0] ),
+                                SAL_N_ELEMENTS( aCTLAttr ),
                                 14 );
             SvtCJKOptions aCJKOpt;
             if( aCJKOpt.IsAnyEnabled() )
                 aArr.Insert( 	aCJKAttr,
-                                sizeof( aCJKAttr ) / sizeof( aCJKAttr[0] ),
+                                SAL_N_ELEMENTS( aCJKAttr ),
                                 14 );
 
             SfxItemSet aSet( pWrtShell->GetAttrPool(), aArr.GetData() );
diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx
index 43a28b2..0170eb8 100644
--- a/sw/source/ui/vba/vbaborders.cxx
+++ b/sw/source/ui/vba/vbaborders.cxx
@@ -29,6 +29,7 @@
 #include <ooo/vba/word/XBorder.hpp>
 #include <ooo/vba/word/WdBorderType.hpp>
 #include <ooo/vba/word/WdLineStyle.hpp>
+#include <sal/macros.h>
 #include <cppuhelper/implbase3.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
@@ -269,7 +270,7 @@ public:
     // XIndexAccess
     virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
     {
-        return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] );
+        return SAL_N_ELEMENTS( supportedIndexTable );
     }
     virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
     {
diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx
index c7b140d..91fa3d6 100644
--- a/sw/source/ui/vba/vbafont.cxx
+++ b/sw/source/ui/vba/vbafont.cxx
@@ -3,6 +3,7 @@
 #include <com/sun/star/awt/FontUnderline.hpp>
 #include <ooo/vba/word/WdUnderline.hpp>
 #include <hash_map>
+#include <sal/macros.h>
 #include <ooo/vba/word/WdColorIndex.hpp>
 
 using namespace ::ooo::vba;
@@ -46,7 +47,7 @@ class UnderLineMapper
 private:
     UnderLineMapper()
     {
-        sal_Int32 nLen = sizeof( UnderLineTable )/ sizeof( UnderLineTable[0] );
+        sal_Int32 nLen = SAL_N_ELEMENTS( UnderLineTable );
 
         for ( sal_Int32 index=0; index<nLen; ++index )
         {
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index 54edbcd..efc42e0 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -27,7 +27,7 @@
  ************************************************************************/
 #include <vbahelper/helperdecl.hxx>
 #include "vbaglobals.hxx"
-
+#include <sal/macros.h>
 #include <comphelper/unwrapargs.hxx>
 
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -178,7 +178,7 @@ SwVbaGlobals::getAvailableServiceNames(  ) throw (uno::RuntimeException)
 //            #FIXME #TODO make Application a proper service
 //            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Application" ) ),
         };
-        sal_Int32 nWordServices = ( sizeof( names )/ sizeof( names[0] ) );
+        sal_Int32 nWordServices = SAL_N_ELEMENTS( names );
         sal_Int32 startIndex = serviceNames.getLength();
         serviceNames.realloc( serviceNames.getLength() + nWordServices );
         for ( sal_Int32 index = 0; index < nWordServices; ++index )
diff --git a/sw/source/ui/vba/vbapalette.cxx b/sw/source/ui/vba/vbapalette.cxx
index 8a7da2d..e99349d 100644
--- a/sw/source/ui/vba/vbapalette.cxx
+++ b/sw/source/ui/vba/vbapalette.cxx
@@ -40,7 +40,7 @@ public:
     // Methods XIndexAccess
     virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
     {
-        return sizeof(ColorTable) / sizeof(ColorTable[0]);
+        return SAL_N_ELEMENTS(ColorTable);
     }
 
     virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)


More information about the Libreoffice-commits mailing list