diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2012-01-10 16:00:18 +0100 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2012-01-10 16:52:33 +0100 |
commit | 2c3d0ff9f83aab89980529da2aa3837390b84ef7 (patch) | |
tree | a7ff1a3e2271c219b29c4ab3a4e54411c22ed20c /vcl | |
parent | a2dd79d14ee2e76e3b6c13f2880706292ea90c26 (diff) |
Use SAL_N_ELEMENTS
Some more like Thorstens diff 9c59cd15b150638c845bbc275b9b04460afc23bd
Done with some regex magic (and a check if this var is an array):
s/sizeof\(\s*$var\s*\)\s*\/\s*sizeof\(\s*\*$var\s*/SAL_N_ELEMENTS\($var/gs
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 2 | ||||
-rw-r--r-- | vcl/ios/source/gdi/salgdi.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 2 | ||||
-rw-r--r-- | vcl/test/canvasbitmaptest.cxx | 2 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 4 |
6 files changed, 7 insertions, 7 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 307ecfe3d6fd..34b10919e935 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -1966,7 +1966,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac &aVerticalCharacterType }; - static const int nTagCount = sizeof(aTag) / sizeof(*aTag); + static const int nTagCount = SAL_N_ELEMENTS(aTag); OSStatus eStatus = ATSUSetAttributes( maATSUStyle, nTagCount, aTag, aValueSize, aValue ); // reset ATSUstyle if there was an error diff --git a/vcl/ios/source/gdi/salgdi.cxx b/vcl/ios/source/gdi/salgdi.cxx index 76a51eee94d6..f6ffbaa84b2f 100644 --- a/vcl/ios/source/gdi/salgdi.cxx +++ b/vcl/ios/source/gdi/salgdi.cxx @@ -1677,7 +1677,7 @@ sal_uInt16 IosSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallback &aVerticalCharacterType }; - static const int nTagCount = sizeof(aTag) / sizeof(*aTag); + static const int nTagCount = SAL_N_ELEMENTS(aTag); OSStatus eStatus = ATSUSetAttributes( maATSUStyle, nTagCount, aTag, aValueSize, aValue ); // reset ATSUstyle if there was an error diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index fb540ef4e51e..95118bfe2686 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -101,7 +101,7 @@ bool IsDiacritic( sal_UCS4 nChar ) }; // TODO: almost anything is faster than an O(n) search - static const int nCount = sizeof(aRanges) / sizeof(*aRanges); + static const int nCount = SAL_N_ELEMENTS(aRanges); const DiaRange* pRange = &aRanges[0]; for( int i = nCount; --i >= 0; ++pRange ) if( (pRange->mnMin <= nChar) && (nChar < pRange->mnEnd) ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index dfd68ccafffd..54ac8b2ad68d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -276,7 +276,7 @@ bool Window::ImplCheckUIFont( const Font& rFont ) BUTTON_RETRY, BUTTON_HELP }; - const int nTestButtonCount = sizeof(aTestButtons)/sizeof(*aTestButtons); + const int nTestButtonCount = SAL_N_ELEMENTS(aTestButtons); for( int n = 0; n < nTestButtonCount; ++n ) { String aButtonStr = Button::GetStandardText( aTestButtons[n] ); diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx index 66e68c10a93e..9f753ff44923 100644 --- a/vcl/test/canvasbitmaptest.cxx +++ b/vcl/test/canvasbitmaptest.cxx @@ -877,7 +877,7 @@ void TestWindow::Paint( const Rectangle& ) // Testing VclCanvasBitmap wrapper // =============================== - for( unsigned int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i ) + for( unsigned int i=0; i<SAL_N_ELEMENTS(lcl_depths); ++i ) { const sal_Int8 nDepth( lcl_depths[i] ); Bitmap aBitmap(Size(200,200),nDepth); diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 8d86069d72af..6b6b9176cef0 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -449,7 +449,7 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar ) } // change the marked entries to prefered language - static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)); + static const int nCount = SAL_N_ELEMENTS(aLangFromCodeChart); for( int i = 0; i < nCount; ++i ) { if( aLangFromCodeChart[ i].mnLangID == LANGUAGE_DEFAULT_CJK ) @@ -459,7 +459,7 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar ) // binary search int nLow = 0; - int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1; + int nHigh = SAL_N_ELEMENTS(aLangFromCodeChart) - 1; while( nLow <= nHigh ) { int nMiddle = (nHigh + nLow) / 2; |