diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-19 09:50:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-24 13:23:59 +0100 |
commit | a069fac4a08f93db74799d00f047e04f1a0735cd (patch) | |
tree | b16c457bab72bd6bc69435ba1a4b610b3cc8d6a0 /sot | |
parent | d9c85f5059000b129ca627df9f971396e4ee30d2 (diff) |
loplugin:stringliteraldefine in comphelper
Change-Id: I60ccd6049db65fef2397798ab916b0d1e24c0fdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125531
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/base/exchange.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 6594fcde6156..18c5cd291f9a 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -43,7 +43,7 @@ namespace { */ struct DataFlavorRepresentation { - const char* pMimeType; + OUString pMimeType; const char* pName; const css::uno::Type* pType; }; @@ -261,11 +261,11 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( const OUString& rMimeT const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); // test the default first - name for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // then in the dynamic list @@ -320,7 +320,7 @@ bool SotExchange::GetFormatDataFlavor( SotClipboardFormatId nFormat, DataFlavor& if( SotClipboardFormatId::USER_END >= nFormat ) { const DataFlavorRepresentation& rData = FormatArray_Impl()[static_cast<int>(nFormat)]; - rFlavor.MimeType = OUString::createFromAscii( rData.pMimeType ); + rFlavor.MimeType = rData.pMimeType; rFlavor.HumanPresentableName = OUString::createFromAscii( rData.pName ); rFlavor.DataType = *rData.pType; @@ -359,7 +359,7 @@ OUString SotExchange::GetFormatMimeType( SotClipboardFormatId nFormat ) { OUString sMimeType; if( SotClipboardFormatId::USER_END >= nFormat ) - sMimeType = OUString::createFromAscii( FormatArray_Impl()[static_cast<int>(nFormat)].pMimeType ); + sMimeType = FormatArray_Impl()[static_cast<int>(nFormat)].pMimeType; else { tDataFlavorList& rL = InitFormats_Impl(); @@ -385,14 +385,14 @@ SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( const OUString& rMime { const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // BM: the chart format 105 ("StarChartDocument 5.0") was written // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0") // The registry only contains the entry for the 42 format id. for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) ? SotClipboardFormatId::STARCHART_50 : i ); @@ -423,7 +423,7 @@ SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor ) const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // BM: the chart format 105 ("StarChartDocument 5.0") was written @@ -431,9 +431,9 @@ SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor ) // The registry only contains the entry for the 42 format id. for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) { - const char* const pFormatMimeType = pFormatArray_Impl[ static_cast<int>(i) ].pMimeType; - const sal_Int32 nFormatMimeTypeLen = rtl_str_getLength( pFormatMimeType ); - if( rMimeType.matchAsciiL( pFormatMimeType, nFormatMimeTypeLen ) && + const OUString& pFormatMimeType = pFormatArray_Impl[ static_cast<int>(i) ].pMimeType; + const sal_Int32 nFormatMimeTypeLen = pFormatMimeType.getLength(); + if( rMimeType.match( pFormatMimeType ) && ( rMimeType.getLength() == nFormatMimeTypeLen || rMimeType[ nFormatMimeTypeLen ] == ';' ) ) return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) |