diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 09:35:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 14:17:14 +0200 |
commit | b70fa47aec65fe95da94fc17640dda27650e9677 (patch) | |
tree | 7e54f37342fd57c324f43d54659335554a9c8e72 /vcl/unx/gtk/a11y/atktextattributes.cxx | |
parent | 6db84250d1c4e7ec5a54ff75e124ea9a84ff89d9 (diff) |
use more SAL_N_ELEMENTS part 1
- teach comphelper::containerToSequence to handle sized arrays
- also use range based for-loop where appropriate.
Change-Id: I73ba9b6295e7b29c872ee53de7a9340969e07f99
Reviewed-on: https://gerrit.libreoffice.org/38769
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/gtk/a11y/atktextattributes.cxx')
-rw-r--r-- | vcl/unx/gtk/a11y/atktextattributes.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 5a1819b2319f..840106a6d5db 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -448,14 +448,12 @@ const gchar * const font_strikethrough[] = { "with X" // FontStrikeout::X }; -const sal_Int16 n_strikeout_constants = sizeof(font_strikethrough) / sizeof(gchar*); - static gchar* Strikeout2String(const uno::Any& rAny) { sal_Int16 n = rAny.get<sal_Int16>(); - if( n >= 0 && n < n_strikeout_constants ) + if( n >= 0 && n < sal_Int16(SAL_N_ELEMENTS(font_strikethrough)) ) return g_strdup( font_strikethrough[n] ); return nullptr; @@ -464,7 +462,7 @@ Strikeout2String(const uno::Any& rAny) static bool String2Strikeout( uno::Any& rAny, const gchar * value ) { - for( sal_Int16 n=0; n < n_strikeout_constants; ++n ) + for( sal_Int16 n=0; n < sal_Int16(SAL_N_ELEMENTS(font_strikethrough)); ++n ) { if( ( nullptr != font_strikethrough[n] ) && 0 == strncmp( value, font_strikethrough[n], strlen( font_strikethrough[n] ) ) ) @@ -1340,8 +1338,6 @@ const AtkTextAttrMapping g_TextAttrMap[] = { "CharPosture", Style2FontSlant } // ATK_TEXT_ATTR_STYLE }; -static const sal_Int32 g_TextAttrMapSize = sizeof( g_TextAttrMap ) / sizeof( AtkTextAttrMapping ); - /*****************************************************************************/ bool @@ -1350,7 +1346,7 @@ attribute_set_map_to_property_values( uno::Sequence< beans::PropertyValue >& rValueList ) { // Ensure enough space .. - uno::Sequence< beans::PropertyValue > aAttributeList (g_TextAttrMapSize); + uno::Sequence< beans::PropertyValue > aAttributeList (SAL_N_ELEMENTS(g_TextAttrMap)); sal_Int32 nIndex = 0; for( GSList * item = attribute_set; item != nullptr; item = g_slist_next( item ) ) @@ -1358,7 +1354,7 @@ attribute_set_map_to_property_values( AtkAttribute* attribute = reinterpret_cast<AtkAttribute *>(item); AtkTextAttribute text_attr = atk_text_attribute_for_name( attribute->name ); - if( text_attr < g_TextAttrMapSize ) + if( text_attr < SAL_N_ELEMENTS(g_TextAttrMap) ) { if( g_TextAttrMap[text_attr].name[0] != '\0' ) { |