diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2018-05-13 16:30:52 +0200 |
---|---|---|
committer | Arnaud Versini <arnaud.versini@libreoffice.org> | 2018-05-31 20:09:25 +0200 |
commit | e93c3662b31d14b75ebca90802848e9021b1f3d2 (patch) | |
tree | 100474349fe097594d09df6ec668bae803f95f21 /cppuhelper | |
parent | 6ebe8b9068be019d9e8ce4f558eb07304e2023f6 (diff) |
cppuhelper : use rtl::isAlphaNumeric instead of recreate the method.
Change-Id: I30bd9e0bf99c2a115b67a59377b2d2ef6fdefef0
Reviewed-on: https://gerrit.libreoffice.org/54194
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/unourl.cxx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/cppuhelper/source/unourl.cxx b/cppuhelper/source/unourl.cxx index cfd62ef23e6f..22250e5568eb 100644 --- a/cppuhelper/source/unourl.cxx +++ b/cppuhelper/source/unourl.cxx @@ -27,6 +27,7 @@ #include <rtl/uri.hxx> #include <rtl/ustring.h> #include <rtl/ustring.hxx> +#include <rtl/character.hxx> #include <sal/types.h> #include <map> @@ -35,17 +36,6 @@ using cppu::UnoUrl; using cppu::UnoUrlDescriptor; -namespace { - -inline bool isAlphanum(sal_Unicode c) -{ - return (c >= 0x30 && c <= 0x39) // '0'--'9' - || (c >= 0x41 && c <= 0x5A) // 'A'--'Z' - || (c >= 0x61 && c <= 0x7A); // 'a'--'z' -} - -} - class UnoUrlDescriptor::Impl { public: @@ -76,7 +66,7 @@ inline UnoUrlDescriptor::Impl::Impl(rtl::OUString const & rDescriptor) switch (eState) { case STATE_NAME0: - if (bEnd || !isAlphanum(c)) + if (bEnd || !rtl::isAsciiAlphanumeric(c)) throw rtl::MalformedUriException( "UNO URL contains bad descriptor name"); nStart = i; @@ -90,13 +80,13 @@ inline UnoUrlDescriptor::Impl::Impl(rtl::OUString const & rDescriptor) = rDescriptor.copy(nStart, i - nStart).toAsciiLowerCase(); eState = STATE_KEY0; } - else if (!isAlphanum(c)) + else if (!rtl::isAsciiAlphanumeric(c)) throw rtl::MalformedUriException( "UNO URL contains bad descriptor name"); break; case STATE_KEY0: - if (bEnd || !isAlphanum(c)) + if (bEnd || !rtl::isAsciiAlphanumeric(c)) throw rtl::MalformedUriException( "UNO URL contains bad parameter key"); nStart = i; @@ -110,7 +100,7 @@ inline UnoUrlDescriptor::Impl::Impl(rtl::OUString const & rDescriptor) nStart = i + 1; eState = STATE_VALUE; } - else if (bEnd || !isAlphanum(c)) + else if (bEnd || !rtl::isAsciiAlphanumeric(c)) throw rtl::MalformedUriException( "UNO URL contains bad parameter key"); break; @@ -222,7 +212,7 @@ inline UnoUrl::Impl * UnoUrl::Impl::create(rtl::OUString const & rUrl) for (j = i; j < rUrl.getLength(); ++j) { sal_Unicode c = rUrl[j]; - if (!isAlphanum(c) && c != 0x21 && c != 0x24 // '!', '$' + if (!rtl::isAsciiAlphanumeric(c) && c != 0x21 && c != 0x24 // '!', '$' && c != 0x26 && c != 0x27 && c != 0x28 // '&', ''', '(' && c != 0x29 && c != 0x2A && c != 0x2B // ')', '*', '+' && c != 0x2C && c != 0x2D && c != 0x2E // ',', '-', '.' |