diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2014-03-07 13:29:36 -0700 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-12 04:38:10 -0500 |
commit | d37f5fdd7310a031f3946f51133d18317f877dae (patch) | |
tree | 7aeac7fbcf4552a7fe33872d06e9197f9eb251eb /vcl | |
parent | 21ad413aad2c95947cd723073ba59ee3bf332c89 (diff) |
Simplify linear searches in FilterConfigCache
No change in functionality, just eliminated a redundant comparison like
FilterConfigCache::GetImportFormatNumberForExtension already does.
Change-Id: I7b04eae2ae7e79f0804ad958d61771758545bf0a
Reviewed-on: https://gerrit.libreoffice.org/8502
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/FilterConfigCache.cxx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 7576b2bae17c..9d45c268cf94 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -326,9 +326,9 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) { if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } /// get the index of the filter that matches this extension @@ -352,9 +352,9 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumberForMediaType( const OUString& for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) { if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& rShortName ) @@ -364,9 +364,9 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) { if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& rType ) @@ -375,9 +375,9 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) { if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } OUString FilterConfigCache::GetImportFormatName( sal_uInt16 nFormat ) @@ -455,9 +455,9 @@ sal_uInt16 FilterConfigCache::GetExportFormatNumber( const OUString& rFormatName for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) { if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& rMediaType ) @@ -466,9 +466,9 @@ sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) { if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& rShortName ) @@ -478,9 +478,9 @@ sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) { if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& rType ) @@ -489,9 +489,9 @@ sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) { if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) - break; + return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); } - return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin()); + return GRFILTER_FORMAT_NOTFOUND; } OUString FilterConfigCache::GetExportFormatName( sal_uInt16 nFormat ) |