summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKenneth Venken <kenneth.venken@gmail.com>2010-10-18 12:28:33 +0200
committerDavid Tardon <dtardon@redhat.com>2010-10-18 12:28:33 +0200
commitbbe30ed8144fbfee7500b98a67224731c581663e (patch)
tree69c3c4238eb51d2be523c9eb9e1e2a498c36b9cf /vcl
parent309b89b93489c785a7ed2460ad5064ff0422dfd3 (diff)
replace sizeof(foo)/sizeof(foo[0]) by SAL_N_ELEMENTS
Diffstat (limited to 'vcl')
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx5
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm5
-rw-r--r--vcl/source/control/edit.cxx7
-rw-r--r--vcl/source/gdi/font.cxx3
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx3
-rw-r--r--vcl/source/window/window.cxx5
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx4
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx9
-rw-r--r--vcl/unx/source/app/keysymnames.cxx107
-rw-r--r--vcl/unx/source/app/salinst.cxx3
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx7
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx11
-rw-r--r--vcl/unx/source/dtrans/bmp.cxx3
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx10
-rw-r--r--vcl/unx/source/gdi/xlfd_attr.cxx12
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx3
-rw-r--r--vcl/unx/source/printer/printerinfomanager.cxx3
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx3
-rw-r--r--vcl/unx/source/window/salframe.cxx3
20 files changed, 112 insertions, 98 deletions
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index 76f3fe5d1756..2efd6f7bb8ef 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -38,6 +38,7 @@
#include "vcl/salptype.hxx"
#include "vcl/print.hxx"
#include "vcl/unohelp.hxx"
+#include <sal/macros.h>
#include <boost/bind.hpp>
@@ -203,7 +204,7 @@ static struct PaperSizeEntry
static bool getPaperSize( double& o_fWidth, double& o_fHeight, const Paper i_ePaper )
{
- for(unsigned int i = 0; i < sizeof(aPaperSizes)/sizeof(aPaperSizes[0]); i++ )
+ for(unsigned int i = 0; i < SAL_N_ELEMENTS(aPaperSizes); i++ )
{
if( aPaperSizes[i].nPaper == i_ePaper )
{
@@ -237,7 +238,7 @@ static Paper recognizePaper( double i_fWidth, double i_fHeight )
if( aPaper == PAPER_USER )
{
// search with fuzz factor
- for( unsigned int i = 0; i < sizeof(aPaperSizes)/sizeof(aPaperSizes[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(aPaperSizes); i++ )
{
double w = (i_fWidth > aPaperSizes[i].fWidth) ? i_fWidth - aPaperSizes[i].fWidth : aPaperSizes[i].fWidth - i_fWidth;
double h = (i_fHeight > aPaperSizes[i].fHeight) ? i_fHeight - aPaperSizes[i].fHeight : aPaperSizes[i].fHeight - i_fHeight;
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 2f9959ab43f4..ca9ef4a5e263 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -34,6 +34,7 @@
#include "salframeview.h"
#include "aqua11yfactory.h"
#include <sal/alloca.h>
+#include <sal/macros.h>
#include "vcl/window.hxx"
#include "vcl/svapp.hxx"
@@ -105,7 +106,7 @@ static USHORT ImplMapCharCode( sal_Unicode aCode )
};
USHORT nKeyCode = 0;
- if( aCode < sizeof( aKeyCodeMap) / sizeof( aKeyCodeMap[0] ) )
+ if( aCode < SAL_N_ELEMENTS( aKeyCodeMap) )
nKeyCode = aKeyCodeMap[ aCode ];
else if( aCode >= 0xf700 && aCode < 0xf780 )
nKeyCode = aFunctionKeyCodeMap[ aCode - 0xf700 ];
@@ -878,7 +879,7 @@ private:
// Caution: should the table grow to more than 5 or 6 entries,
// we must consider moving it to a kind of hash map
- const unsigned int nExceptions = sizeof( aExceptionalKeys ) / sizeof( aExceptionalKeys[0] );
+ const unsigned int nExceptions = SAL_N_ELEMENTS( aExceptionalKeys );
for( unsigned int i = 0; i < nExceptions; i++ )
{
if( nKeyCode == aExceptionalKeys[i].nKeyCode &&
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 92d97fb762e1..7ef7e49f0be0 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -73,6 +73,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <rtl/memory.h>
+#include <sal/macros.h>
#include <vcl/unohelp.hxx>
#include <vcl/unohelp2.hxx>
@@ -508,7 +509,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
if( aText.Len() )
{
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
@@ -1172,7 +1173,7 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
if( aText.Len() )
{
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
@@ -1296,7 +1297,7 @@ xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos ) const
sal_Int32 nDXBuffer[256];
sal_Int32* pDXBuffer = NULL;
sal_Int32* pDX = nDXBuffer;
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index db471b74a1be..61db9f110a9e 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -38,6 +38,7 @@
#include "vcl/impfont.hxx"
#include "vcl/outfont.hxx"
#include "unotools/fontcfg.hxx"
+#include <sal/macros.h>
#include <algorithm>
@@ -1034,7 +1035,7 @@ namespace
aEnt.string = pOpen+1;
aEnt.string_len = (pClose-pOpen)-1;
aEnt.weight = WEIGHT_NORMAL;
- const int nEnt = sizeof( weight_table ) / sizeof( weight_table[0] );
+ const int nEnt = SAL_N_ELEMENTS( weight_table );
WeightSearchEntry* pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt );
if( pFound != (weight_table+nEnt) )
o_rResult.SetWeight( pFound->weight );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1bd453b6136d..78c84d579698 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2210,7 +2210,7 @@ ImplDevFontList* PDFWriterImpl::filterDevFontList( ImplDevFontList* pFontList )
// append the PDF builtin fonts
if( !m_bIsPDF_A1 && !m_bEmbedStandardFonts)
- for( unsigned int i = 0; i < sizeof(m_aBuiltinFonts)/sizeof(m_aBuiltinFonts[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aBuiltinFonts); i++ )
{
ImplFontData* pNewData = new ImplPdfBuiltinFontData( m_aBuiltinFonts[i] );
pFiltered->Add( pNewData );
@@ -3610,7 +3610,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
if( nFontDescriptor )
{
if( pEncoding )
- nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, sizeof(nEncoding)/sizeof(nEncoding[0]) );
+ nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, SAL_N_ELEMENTS(nEncoding) );
// write font object
sal_Int32 nObject = createObject();
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 702fa1d7db4f..95b8419a8131 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -44,6 +44,7 @@
#include "rtl/digest.h"
#include "com/sun/star/util/XURLTransformer.hpp"
#include "com/sun/star/lang/Locale.hpp"
+#include <sal/macros.h>
#include <vcl/sallayout.hxx>
#include "pdffontcache.hxx"
@@ -292,7 +293,7 @@ public:
GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0)
{
rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) );
- m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]);
+ m_nMaxUnicodes = SAL_N_ELEMENTS(m_aBufferedUnicodes);
}
~GlyphEmit()
{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 52a876d82563..ffc447b09172 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -90,7 +90,7 @@
#include "vcl/impbmpconv.hxx"
#include "unotools/confignode.hxx"
#include "vcl/gdimtf.hxx"
-
+#include <sal/macros.h>
#include "vcl/pdfextoutdevdata.hxx"
#include "vcl/lazydelete.hxx"
@@ -393,8 +393,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl )
};
static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet(
eBrokenSystemFontSizeLanguages,
- eBrokenSystemFontSizeLanguages +
- (sizeof(eBrokenSystemFontSizeLanguages)/sizeof(eBrokenSystemFontSizeLanguages[0]))
+ eBrokenSystemFontSizeLanguages + SAL_N_ELEMENTS(eBrokenSystemFontSizeLanguages)
);
LanguageType aLang = Application::GetSettings().GetUILanguage();
if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() )
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 235b3d96b2ac..0ef9b2d54248 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -516,6 +516,8 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
/*****************************************************************************/
#if 0
+
+#include <sal/macros.h>
struct {
sal_Int16 value;
const sal_Char* name;
@@ -556,7 +558,7 @@ struct {
static void printStates(const uno::Sequence<sal_Int16>& rStates)
{
sal_Int32 n = rStates.getLength();
- size_t nTypes = sizeof(aStateTypeTable)/sizeof(aStateTypeTable[0]);
+ size_t nTypes = SAL_N_ELEMENTS(aStateTypeTable);
for (sal_Int32 i = 0; i < n; ++i)
{
for (size_t j = 0; j < nTypes; ++j)
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index a2befa16f317..7a8dac3d26ac 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -52,6 +52,7 @@
#include <vcl/bitmapex.hxx>
#include <vcl/impbmp.hxx>
#include <vcl/svids.hrc>
+#include <sal/macros.h>
#include <algorithm>
@@ -418,7 +419,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
GtkSalFrame::~GtkSalFrame()
{
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); ++i )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); ++i )
{
if( !m_aGraphics[i].pGraphics )
continue;
@@ -1739,7 +1740,7 @@ void GtkSalFrame::moveToScreen( int nScreen )
m_aSystemData.pAppContext = NULL;
m_aSystemData.aShellWindow = m_aSystemData.aWindow;
// update graphics if necessary
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
{
if( m_aGraphics[i].bInUse )
m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(m_pWindow->window), m_nScreen );
@@ -2400,7 +2401,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc
}
// free xrender resources
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
if( m_aGraphics[i].bInUse )
m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen );
@@ -2435,7 +2436,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc
}
// update graphics
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
{
if( m_aGraphics[i].bInUse )
{
diff --git a/vcl/unx/source/app/keysymnames.cxx b/vcl/unx/source/app/keysymnames.cxx
index c65ee071683b..3ea61eb86bdc 100644
--- a/vcl/unx/source/app/keysymnames.cxx
+++ b/vcl/unx/source/app/keysymnames.cxx
@@ -37,6 +37,7 @@
#include <saldisp.hxx>
#include <X11/keysym.h>
+#include <sal/macros.h>
#if !defined (SunXK_Undo)
#define SunXK_Undo 0x0000FF65 // XK_Undo
@@ -360,70 +361,70 @@ namespace vcl_sal {
static const struct KeyboardReplacements aKeyboards[] =
{
#ifdef SOLARIS
- { "Germany5", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "Germany4", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "France5", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "France6", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "France_x86", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "Italy5", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy5-Hobo", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy4", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy6", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy_x86", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Netherland4", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland5", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland5-Hobo", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland6", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland_x86", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Norway5", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway5-Hobo", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway4", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway6", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway_x86", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Portugal5", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal5-Hobo", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal4", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal6", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal_x86", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Spain5", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain5-Hobo", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain4", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain6", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain_x86", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Sweden5", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden5-Hobo", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden4", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden6", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden_x86", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
+ { "Germany5", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "Germany4", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "France5", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "France6", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "France_x86", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "Italy5", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy5-Hobo", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy4", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy6", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy_x86", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Netherland4", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland5", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland5-Hobo", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland6", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland_x86", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Norway5", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway5-Hobo", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway4", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway6", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway_x86", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Portugal5", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal5-Hobo", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal4", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal6", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal_x86", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Spain5", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain5-Hobo", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain4", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain6", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain_x86", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Sweden5", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden5-Hobo", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden4", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden6", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden_x86", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
#endif
- { "U.S. English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) },
- { "United Kingdom", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) },
+ { "U.S. English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) },
+ { "United Kingdom", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) },
// Germany, German
- { "German", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "France", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "French", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
+ { "German", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "France", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "French", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
// Italy, Italian
- { "Ital", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
+ { "Ital", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
// Norway, Norwegian
- { "Norw", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
+ { "Norw", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
// Portugal, Portuguese
- { "Portu", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Spain", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spanish", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
+ { "Portu", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Spain", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spanish", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
// Sweden, Swedish
- { "Swed", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Netherland", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Dutch", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
+ { "Swed", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Netherland", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Dutch", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
// Turkish, Turkey
- { "Turk", aImplReplacements_Turkish, sizeof(aImplReplacements_Turkish)/sizeof(aImplReplacements_Turkish[0]) },
+ { "Turk", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) },
// Russian, Russia
- { "Russia", aImplReplacements_Russian, sizeof(aImplReplacements_Russian)/sizeof(aImplReplacements_Russian[0]) },
- { "English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) }
+ { "Russia", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) },
+ { "English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }
};
String getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol )
{
- for( unsigned int n = 0; n < sizeof(aKeyboards)/sizeof(aKeyboards[0]); n++ )
+ for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ )
{
if( ! strncasecmp( pKeyboard, aKeyboards[n].pKeyboardName, strlen( aKeyboards[n].pKeyboardName ) ) )
{
@@ -437,7 +438,7 @@ namespace vcl_sal {
}
// try english fallbacks
const struct KeysymNameReplacement* pRepl = aImplReplacements_English;
- for( int m = sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) ; m ; )
+ for( int m = SAL_N_ELEMENTS(aImplReplacements_English); m ; )
{
if( nSymbol == pRepl[--m].aSymbol )
return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 );
diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx
index ca23fd6fc1ea..20b23ae571b9 100644
--- a/vcl/unx/source/app/salinst.cxx
+++ b/vcl/unx/source/app/salinst.cxx
@@ -50,6 +50,7 @@
#include "vcl/helper.hxx"
#include <tools/solarmutex.hxx>
#include "vos/mutex.hxx"
+#include <sal/macros.h>
// -------------------------------------------------------------------------
//
@@ -301,7 +302,7 @@ static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths )
};
::std::list< ByteString > aLines;
- for( unsigned int i = 0; i < sizeof(pCommands)/sizeof(pCommands[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCommands); i++ )
{
FILE* pPipe = popen( pCommands[i], "r" );
aLines.clear();
diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index 77ae674bd36e..955d7098192f 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -41,6 +41,7 @@
#include <osl/thread.h>
#include <rtl/locale.h>
#include <osl/process.h>
+#include <sal/macros.h>
#include <tools/prex.h>
#include <X11/X.h>
@@ -493,7 +494,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
bsearch( &aSearch,
aProtocolTab,
- sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ),
+ SAL_N_ELEMENTS( aProtocolTab ),
sizeof( struct WMAdaptorProtocol ),
compareProtocol );
if( pMatch )
@@ -749,7 +750,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
bsearch( &aSearch,
aProtocolTab,
- sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ),
+ SAL_N_ELEMENTS( aProtocolTab ),
sizeof( struct WMAdaptorProtocol ),
compareProtocol );
if( pMatch )
@@ -1006,7 +1007,7 @@ bool GnomeWMAdaptor::isValid() const
void WMAdaptor::initAtoms()
{
// get basic atoms
- for( unsigned int i = 0; i < sizeof( aAtomTab )/sizeof( aAtomTab[0] ); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAtomTab ); i++ )
m_aWMAtoms[ aAtomTab[i].nProtocol ] = XInternAtom( m_pDisplay, aAtomTab[i].pProtocol, False );
m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] = XInternAtom( m_pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
m_aWMAtoms[ NET_WM_NAME ] = XInternAtom( m_pDisplay, "_NET_WM_NAME", True );
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 8e303433f896..d569d5c40e79 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -48,6 +48,7 @@
#include <poll.h>
#endif
#include <sal/alloca.h>
+#include <sal/macros.h>
#include <X11_selection.hxx>
#include <X11_clipboard.hxx>
@@ -816,9 +817,7 @@ bool SelectionManager::requestOwnership( Atom selection )
void SelectionManager::convertTypeToNative( const OUString& rType, Atom selection, int& rFormat, ::std::list< Atom >& rConversions, bool bPushFront )
{
NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab;
- int nTabEntries = selection == m_nXdndSelection
- ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) :
- sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]);
+ int nTabEntries = selection == m_nXdndSelection ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab);
OString aType( OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ) );
rFormat = 0;
@@ -891,10 +890,8 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes,
OUString SelectionManager::convertTypeFromNative( Atom nType, Atom selection, int& rFormat )
{
- NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab;
- int nTabEntries = selection == m_nXdndSelection
- ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) :
- sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]);
+ NativeTypeEntry* pTab = (selection == m_nXdndSelection) ? aXdndConversionTab : aNativeConversionTab;
+ int nTabEntries = (selection == m_nXdndSelection) ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab);
for( int i = 0; i < nTabEntries; i++ )
{
diff --git a/vcl/unx/source/dtrans/bmp.cxx b/vcl/unx/source/dtrans/bmp.cxx
index 52b91af526ab..9b0bb2729c95 100644
--- a/vcl/unx/source/dtrans/bmp.cxx
+++ b/vcl/unx/source/dtrans/bmp.cxx
@@ -36,6 +36,7 @@
#include <bmp.hxx>
#include <X11_selection.hxx>
+#include <sal/macros.h>
using namespace x11;
using namespace com::sun::star::uno;
@@ -424,7 +425,7 @@ PixmapHolder::PixmapHolder( Display* pDisplay ) :
{ "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" };
fprintf( stderr, "PixmapHolder visual: id = 0x%lx, class = %s (%d), depth=%d; color map = 0x%lx\n",
m_aInfo.visualid,
- (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < sizeof(pClasses)/sizeof(pClasses[0])) ? pClasses[m_aInfo.c_class] : "<unknown>",
+ (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < SAL_N_ELEMENTS(pClasses)) ? pClasses[m_aInfo.c_class] : "<unknown>",
m_aInfo.c_class,
m_aInfo.depth,
m_aColormap );
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 7e12ad2ad8f9..e64740e367ed 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -59,6 +59,8 @@
#include "rtl/ustrbuf.hxx"
#include "rtl/strbuf.hxx"
+#include <sal/macros.h>
+
#include "i18npool/mslangid.hxx"
@@ -854,7 +856,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
RTL_TEXTENCODING_JIS_X_0208
};
- for( unsigned int enc = 0; enc < sizeof( aEncs )/sizeof(aEncs[0]) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ )
+ for( unsigned int enc = 0; enc < SAL_N_ELEMENTS( aEncs ) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ )
{
sal_Int32 nIndex = 0, nOffset = 1;
do
@@ -1187,7 +1189,7 @@ PrintFontManager::PrintFontManager() :
m_pFontCache( NULL ),
m_bFontconfigSuccess( false )
{
- for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAdobeCodes ); i++ )
{
m_aUnicodeToAdobename.insert( ::std::hash_multimap< sal_Unicode, ::rtl::OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) );
m_aAdobenameToUnicode.insert( ::std::hash_multimap< ::rtl::OString, sal_Unicode, ::rtl::OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) );
@@ -1297,7 +1299,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
// first look for an adjacent file
static const char* pSuffix[] = { ".afm", ".AFM" };
- for( unsigned int i = 0; i < sizeof(pSuffix)/sizeof(pSuffix[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pSuffix); i++ )
{
ByteString aName( rFontFile );
aName.Erase( aName.Len()-4 );
@@ -2805,7 +2807,7 @@ family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily )
rtl::OString aFamily = rtl::OUStringToOString( rFamily, RTL_TEXTENCODING_ASCII_US );
sal_uInt32 nLower = 0;
- sal_uInt32 nUpper = sizeof(pFamilyMatch) / sizeof(pFamilyMatch[0]);
+ sal_uInt32 nUpper = SAL_N_ELEMENTS(pFamilyMatch);
while( nLower < nUpper )
{
diff --git a/vcl/unx/source/gdi/xlfd_attr.cxx b/vcl/unx/source/gdi/xlfd_attr.cxx
index c67bcabdaa10..eb6dc6372718 100644
--- a/vcl/unx/source/gdi/xlfd_attr.cxx
+++ b/vcl/unx/source/gdi/xlfd_attr.cxx
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <sal/alloca.h>
+#include <sal/macros.h>
#include "xlfd_attr.hxx"
#include <rtl/tencinfo.h>
#include <vcl/vclenum.hxx>
@@ -235,7 +236,6 @@ Attribute::TagFeature( unsigned short nFeature )
// order, since they are treated by binary search algorithm
#define InitializeAttributeWith( p, a ) p, sizeof(p) - 1, a, 0, NULL, NULL
-#define MembersOf( p ) (sizeof(p) / sizeof(p[0]) )
const Attribute pFamilyAttribute[] = {
{ InitializeAttributeWith( "arial", FAMILY_SWISS ) },
@@ -388,7 +388,7 @@ AnnotateSlant( const Attribute& rAttribute )
{ "ot", "Other" }
};
- for ( unsigned int i = 0; i < MembersOf(pTranslation); i++ )
+ for ( unsigned int i = 0; i < SAL_N_ELEMENTS(pTranslation); i++ )
if ( strcmp(pStr, pTranslation[i].pFrom) == 0 )
{
return new String( pTranslation[i].pTo,
@@ -638,16 +638,16 @@ AttributeProvider::AddClassification()
/* mpField[ eXLFDFoundry ] doesn't need classification */
mpField[ eXLFDFamilyName ]->AddClassification(
(Attribute*)pFamilyAttribute,
- MembersOf(pFamilyAttribute) );
+ SAL_N_ELEMENTS(pFamilyAttribute) );
mpField[ eXLFDWeightName ]->AddClassification(
(Attribute*)pWeightAttribute,
- MembersOf(pWeightAttribute) );
+ SAL_N_ELEMENTS(pWeightAttribute) );
mpField[ eXLFDSlant ]->AddClassification(
(Attribute*)pSlantAttribute,
- MembersOf(pSlantAttribute) );
+ SAL_N_ELEMENTS(pSlantAttribute) );
mpField[ eXLFDSetwidthName ]->AddClassification(
(Attribute*)pSetwidthAttribute,
- MembersOf(pSetwidthAttribute) );
+ SAL_N_ELEMENTS(pSetwidthAttribute) );
mpField[ eXLFDAddstyleName ]->AddClassification(
GetTextEncodingFromAddStylename );
mpField[ eXLFDCharset ]->AddClassification(
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index 516a040c971b..c10f8aca8664 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -49,6 +49,7 @@
#include "osl/thread.h"
#include "rtl/strbuf.hxx"
#include "rtl/ustrbuf.hxx"
+#include <sal/macros.h>
#include "com/sun/star/lang/Locale.hpp"
@@ -403,7 +404,7 @@ void PPDParser::scanPPDDir( const String& rDir )
} const pSuffixes[] =
{ { ".PS", 3 }, { ".PPD", 4 }, { ".PS.GZ", 6 }, { ".PPD.GZ", 7 } };
- const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]);
+ const int nSuffixes = SAL_N_ELEMENTS(pSuffixes);
osl::Directory aDir( rDir );
aDir.open();
diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index efee6a4a07cd..ecf3f78a49cb 100644
--- a/vcl/unx/source/printer/printerinfomanager.cxx
+++ b/vcl/unx/source/printer/printerinfomanager.cxx
@@ -45,6 +45,7 @@
#include "i18npool/paper.hxx"
#include "rtl/strbuf.hxx"
+#include <sal/macros.h>
#include "osl/thread.hxx"
#include "osl/mutex.hxx"
@@ -1370,7 +1371,7 @@ void SystemQueueInfo::run()
std::list< rtl::OString > aLines;
/* Discover which command we can use to get a list of all printer queues */
- for( unsigned int i = 0; i < sizeof(aParms)/sizeof(aParms[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(aParms); i++ )
{
aLines.clear();
rtl::OStringBuffer aCmdLine( 128 );
diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx
index 94427353fc9b..e565a0e2355f 100644
--- a/vcl/unx/source/printergfx/printerjob.cxx
+++ b/vcl/unx/source/printergfx/printerjob.cxx
@@ -51,6 +51,7 @@
#include "osl/thread.h"
#include "sal/alloca.h"
+#include <sal/macros.h>
#include <algorithm>
#include <vector>
@@ -428,7 +429,7 @@ PrinterJob::StartJob (
sal_Char pCreationDate [256];
WritePS (mpJobHeader, "%%CreationDate: (");
getLocalTime(pCreationDate);
- for( unsigned int i = 0; i < sizeof(pCreationDate)/sizeof(pCreationDate[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCreationDate); i++ )
{
if( pCreationDate[i] == '\n' )
{
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index b495584643ea..05b2b13220b3 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -70,6 +70,7 @@
#include "tools/debug.hxx"
#include "sal/alloca.h"
+#include <sal/macros.h>
#include <com/sun/star/uno/Exception.hpp>
#include <algorithm>
@@ -180,7 +181,7 @@ void X11SalFrame::setXEmbedInfo()
32,
PropModeReplace,
reinterpret_cast<unsigned char*>(aInfo),
- sizeof(aInfo)/sizeof(aInfo[0]) );
+ SAL_N_ELEMENTS(aInfo) );
}
}