From 57af2ee947feb06caaa8ffca1320a950bb049605 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 15 Oct 2013 22:46:05 +0200 Subject: Allow starts-/endsWith* to also return the rest of the matched string ...as there are many cases where the code later wants to obtain this part, and esp. for the string literal variants it is awkward to calculate the length of the literal again if this is coded with a following copy() call. Adapt some code to use this new feature. (Strictly speaking, the @since tags for the---backwards-compatibly---modified functions are no longer accurate of course. Also, clean up some sal_Bool and SAL_THROWS(()) that are unnecesssary cargo-cult here, and where the clean-up should have no practical compatibility consequences.) Change-Id: I43e5c578c8c4b44cb47fd08f170b5c69322ad641 --- configmgr/source/components.cxx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'configmgr/source/components.cxx') diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index b5b38b5b9371..85865fd00e7d 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -43,9 +43,7 @@ #include "osl/mutex.hxx" #include "rtl/bootstrap.hxx" #include "rtl/ref.hxx" -#include "rtl/string.h" #include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "rtl/instance.hxx" #include "sal/log.hxx" @@ -639,9 +637,7 @@ void Components::parseFiles( parseFiles(layer, extension, parseFile, stat.getFileURL(), true); } else { OUString file(stat.getFileName()); - if (file.getLength() >= extension.getLength() && - file.match(extension, file.getLength() - extension.getLength())) - { + if (file.endsWith(extension)) { try { parseFileLeniently( parseFile, stat.getFileURL(), layer, data_, 0, 0, 0); @@ -718,14 +714,8 @@ void Components::parseXcdFiles(int layer, OUString const & url) { } if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: symlinks OUString file(stat.getFileName()); - if (file.getLength() >= RTL_CONSTASCII_LENGTH(".xcd") && - file.matchAsciiL( - RTL_CONSTASCII_STRINGPARAM(".xcd"), - file.getLength() - RTL_CONSTASCII_LENGTH(".xcd"))) - { - OUString name( - file.copy( - 0, file.getLength() - RTL_CONSTASCII_LENGTH(".xcd"))); + OUString name; + if (file.endsWith(".xcd", &name)) { existingDeps.insert(name); rtl::Reference< ParseManager > manager; try { -- cgit