diff options
author | Kenneth Venken <kenneth.venken@gmail.com> | 2010-10-18 12:28:33 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2010-10-18 12:28:33 +0200 |
commit | bbe30ed8144fbfee7500b98a67224731c581663e (patch) | |
tree | 69c3c4238eb51d2be523c9eb9e1e2a498c36b9cf /vcl/unx/source | |
parent | 309b89b93489c785a7ed2460ad5064ff0422dfd3 (diff) |
replace sizeof(foo)/sizeof(foo[0]) by SAL_N_ELEMENTS
Diffstat (limited to 'vcl/unx/source')
-rw-r--r-- | vcl/unx/source/app/keysymnames.cxx | 107 | ||||
-rw-r--r-- | vcl/unx/source/app/salinst.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/source/app/wmadaptor.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_selection.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/bmp.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/source/fontmanager/fontmanager.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/source/gdi/xlfd_attr.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/source/printer/ppdparser.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/source/printer/printerinfomanager.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/source/printergfx/printerjob.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/source/window/salframe.cxx | 3 |
11 files changed, 86 insertions, 79 deletions
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) ); } } |