diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-11-25 16:42:23 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-25 16:42:23 +0100 |
commit | 1800862c700428e74aa500c9dee41237b8991932 (patch) | |
tree | 8d1019148d5c4a565fec82d73a2e773dd3fc9883 /sc | |
parent | b33b441341abcdaa6e208bee7f0af528620055c5 (diff) |
loplugin:stringconstant: look into 'char const * const var = "..."'
Change-Id: I52a97b8ec273509131c2200e47527221cb62d7ee
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/oox/defnamesbuffer.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 79457ab57e5f..9bbaf5381ffb 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -59,7 +59,7 @@ const sal_uInt16 BIFF_REFFLAG_ROW1REL = 0x0002; const sal_uInt16 BIFF_REFFLAG_COL2REL = 0x0004; const sal_uInt16 BIFF_REFFLAG_ROW2REL = 0x0008; -const sal_Char* const spcOoxPrefix = "_xlnm."; +const OUStringLiteral spcOoxPrefix("_xlnm."); const sal_Char* const sppcBaseNames[] = { @@ -92,21 +92,19 @@ OUString lclGetBaseName( sal_Unicode cBuiltinId ) OUString lclGetPrefixedName( sal_Unicode cBuiltinId ) { - return OUStringBuffer().appendAscii( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear(); + return OUStringBuffer( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear(); } /** returns the built-in name identifier from a prefixed built-in name, e.g. '_xlnm.Print_Area'. */ sal_Unicode lclGetBuiltinIdFromPrefixedName( const OUString& rModelName ) { - OUString aPrefix = OUString::createFromAscii( spcOoxPrefix ); - sal_Int32 nPrefixLen = aPrefix.getLength(); - if( rModelName.matchIgnoreAsciiCase( aPrefix ) ) + if( rModelName.matchIgnoreAsciiCase( spcOoxPrefix ) ) { for( sal_Unicode cBuiltinId = 0; cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ); ++cBuiltinId ) { OUString aBaseName = lclGetBaseName( cBuiltinId ); sal_Int32 nBaseNameLen = aBaseName.getLength(); - if( (rModelName.getLength() == nPrefixLen + nBaseNameLen) && rModelName.matchIgnoreAsciiCase( aBaseName, nPrefixLen ) ) + if( (rModelName.getLength() == spcOoxPrefix.size + nBaseNameLen) && rModelName.matchIgnoreAsciiCase( aBaseName, spcOoxPrefix.size ) ) return cBuiltinId; } } diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index c29ee100ead7..f4c746906144 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2326,7 +2326,6 @@ void Dxf::fillToItemSet( SfxItemSet& rSet ) const namespace { -const sal_Char* const spcStyleNamePrefix = "Excel Built-in "; const sal_Char* const sppcStyleNames[] = { "Normal", @@ -2389,8 +2388,7 @@ const sal_Int32 snStyleNamesCount = static_cast< sal_Int32 >( SAL_N_ELEMENTS( sp OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sal_Int32 nLevel = 0 ) { OSL_ENSURE( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount), "lclGetBuiltinStyleName - unknown built-in style" ); - OUStringBuffer aStyleName; - aStyleName.appendAscii( spcStyleNamePrefix ); + OUStringBuffer aStyleName("Excel Built-in "); if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ] != nullptr) ) aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] ); else if( !rName.isEmpty() ) |