summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorStephan Bergmann <sb@openoffice.org>2001-11-07 07:15:54 +0000
committerStephan Bergmann <sb@openoffice.org>2001-11-07 07:15:54 +0000
commit90ddb0c280ac959481c411ecfc640561a580a3d9 (patch)
treec368f395909f88bd97f58595c0232b184f1db9cd /ucb
parent467918ccaea6d5fc3fee1dd9fa3bfda2f4a9be9d (diff)
#94096# Improved last fix (fixed Regexp::getRegexp()).
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/regexp/regexp.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx
index c58d3163eadd..bfa48a08b8f1 100644
--- a/ucb/source/regexp/regexp.cxx
+++ b/ucb/source/regexp/regexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: regexp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sb $ $Date: 2001-11-02 12:34:11 $
+ * last change: $Author: sb $ $Date: 2001-11-07 08:15:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -235,20 +235,21 @@ inline bool isDigit(sal_Unicode c)
return c >= '0' && c <= '9';
}
-bool isScheme(rtl::OUString const & rString)
+bool isScheme(rtl::OUString const & rString, bool bColon)
{
- // Return true if rString matches <scheme> from RFC 2396:
+ // Return true if rString matches <scheme> (plus a trailing ":" if bColon
+ // is true) from RFC 2396:
sal_Unicode const * p = rString.getStr();
sal_Unicode const * pEnd = p + rString.getLength();
if (p != pEnd && isAlpha(*p))
for (++p;;)
{
if (p == pEnd)
- return true;
+ return !bColon;
sal_Unicode c = *p++;
if (!(isAlpha(c) || isDigit(c)
|| c == '+' || c == '-' || c == '.'))
- break;
+ return bColon && c == ':' && p == pEnd;
}
return false;
}
@@ -322,8 +323,8 @@ rtl::OUString Regexp::getRegexp(bool bReverse) const
aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\\1"));
return aBuffer.makeStringAndClear();
}
- else if (m_eKind == KIND_PREFIX && isScheme(m_aPrefix))
- return m_aPrefix;
+ else if (m_eKind == KIND_PREFIX && isScheme(m_aPrefix, true))
+ return m_aPrefix.copy(0, m_aPrefix.getLength() - 1);
else
{
rtl::OUStringBuffer aBuffer;
@@ -415,7 +416,7 @@ Regexp Regexp::parse(rtl::OUString const & rRegexp)
{
// Detect an input of '<scheme>' as an abbreviation of '"<scheme>:".*'
// where <scheme> is as defined in RFC 2396:
- if (isScheme(rRegexp))
+ if (isScheme(rRegexp, false))
return Regexp(Regexp::KIND_PREFIX,
rRegexp
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":")),