diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 12:05:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 12:10:15 +0100 |
commit | 7c658039e89e0dc7ec46236b8eb3b207e0c8d9e8 (patch) | |
tree | 8805299f45e0e44b3d03e2fd40670566fef07fd0 /stoc | |
parent | c565e0c6414766e93ae6861955edf135365f9860 (diff) |
fix this up, revert using comphelper stuff, but modify to-dos
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/prj/build.lst | 2 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReferenceFactory.cxx | 47 | ||||
-rw-r--r-- | stoc/util/makefile.mk | 1 |
3 files changed, 32 insertions, 18 deletions
diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index f55be3005116..c7a1fe693919 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -1,4 +1,4 @@ -tc stoc : DESKTOP:rdbmaker cppuhelper comphelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt registry NULL +tc stoc : DESKTOP:rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt registry NULL tc stoc usr1 - all tc_mkout NULL tc stoc\inc nmake - all tc_inc NULL tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index afba3ca4da7c..e277d4727558 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -51,7 +51,6 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" -#include "comphelper/string.hxx" #include "osl/diagnose.h" #include "rtl/string.h" #include "rtl/ustrbuf.hxx" @@ -65,20 +64,36 @@ namespace css = com::sun::star; -using comphelper::string::isalphaAscii; -using comphelper::string::isdigitAscii; -using comphelper::string::isxdigitAscii; -using comphelper::string::islowerAscii; -using comphelper::string::isupperAscii; - namespace { -sal_Unicode toLowerCase(sal_Unicode c) { //TODO: generally available? - return isupperAscii(c) ? c + ('a' - 'A') : c; +//TODO: move comphelper::string::misc into something like +//sal/salhelper and use those instead + +bool isDigit(sal_Unicode c) { + return c >= '0' && c <= '9'; +} + +bool isUpperCase(sal_Unicode c) { + return c >= 'A' && c <= 'Z'; +} + +bool isLowerCase(sal_Unicode c) { + return c >= 'a' && c <= 'z'; +} + +bool isAlpha(sal_Unicode c) { + return isUpperCase(c) || isLowerCase(c); +} + +bool isHexDigit(sal_Unicode c) { + return isDigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); +} + +sal_Unicode toLowerCase(sal_Unicode c) { + return isUpperCase(c) ? c + ('a' - 'A') : c; } bool equalIgnoreCase(sal_Unicode c1, sal_Unicode c2) { - //TODO: generally available? return toLowerCase(c1) == toLowerCase(c2); } @@ -86,8 +101,8 @@ bool equalIgnoreEscapeCase(rtl::OUString const & s1, rtl::OUString const & s2) { if (s1.getLength() == s2.getLength()) { for (sal_Int32 i = 0; i < s1.getLength();) { if (s1[i] == '%' && s2[i] == '%' && s1.getLength() - i > 2 - && isxdigitAscii(s1[i + 1]) && isxdigitAscii(s1[i + 2]) - && isxdigitAscii(s2[i + 1]) && isxdigitAscii(s2[i + 2]) + && isHexDigit(s1[i + 1]) && isHexDigit(s1[i + 2]) + && isHexDigit(s2[i + 1]) && isHexDigit(s2[i + 2]) && equalIgnoreCase(s1[i + 1], s2[i + 1]) && equalIgnoreCase(s1[i + 2], s2[i + 2])) { @@ -105,12 +120,12 @@ bool equalIgnoreEscapeCase(rtl::OUString const & s1, rtl::OUString const & s2) { } sal_Int32 parseScheme(rtl::OUString const & uriReference) { - if (uriReference.getLength() >= 2 && isalphaAscii(uriReference[0])) { + if (uriReference.getLength() >= 2 && isAlpha(uriReference[0])) { for (sal_Int32 i = 0; i < uriReference.getLength(); ++i) { sal_Unicode c = uriReference[i]; if (c == ':') { return i; - } else if (!isalphaAscii(c) && !isdigitAscii(c) && c != '+' && c != '-' + } else if (!isAlpha(c) && !isDigit(c) && c != '+' && c != '-' && c != '.') { break; @@ -379,7 +394,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uri.UriSchemeParser_")); for (sal_Int32 i = 0; i < scheme.getLength(); ++i) { sal_Unicode c = scheme[i]; - if (isupperAscii(c)) { + if (isUpperCase(c)) { buf.append(toLowerCase(c)); } else if (c == '+') { buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("PLUS")); @@ -388,7 +403,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( } else if (c == '.') { buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("DOT")); } else { - OSL_ASSERT(islowerAscii(c) || isdigitAscii(c)); + OSL_ASSERT(isLowerCase(c) || isDigit(c)); buf.append(c); } } diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index 272d76fef9ad..32f229cc3d14 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -81,7 +81,6 @@ SHL2VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL2STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ - $(COMPHELPERLIB) \ $(SALLIB) SHL2DEPN= |