Introduce characters utilities in rtl/character.hxx

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, with slight modifications
to sal/inc/rtl/character.hxx:
* Replaced "#pragma once" with explicit include guard for now.
* Missing includes.
* Cosmetic clean-up.

Change-Id: I94d01cd4e766f92c70f941839a67101fa2c97654
This commit is contained in:
Arnaud Versini
2013-04-07 15:54:39 +02:00
committed by Stephan Bergmann
parent 5d67919a58
commit 4976dd85fa
8 changed files with 236 additions and 146 deletions

View File

@@ -20,26 +20,7 @@
#include <tools/errcode.hxx> #include <tools/errcode.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <basic/sbx.hxx> #include <basic/sbx.hxx>
#include <rtl/character.hxx>
static bool isAlpha( sal_Unicode c )
{
bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
return bRet;
}
static bool isDigit( sal_Unicode c )
{
bool bRet = (c >= '0' && c <= '9');
return bRet;
}
static bool isAlphaNumeric( sal_Unicode c )
{
bool bRet = isDigit( c ) || isAlpha( c );
return bRet;
}
static SbxVariable* Element static SbxVariable* Element
@@ -72,7 +53,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym )
else else
{ {
// A symbol had to begin with a alphabetic character or an underline // A symbol had to begin with a alphabetic character or an underline
if( !isAlpha( *p ) && *p != '_' ) if( !rtl::isAsciiAlpha( *p ) && *p != '_' )
{ {
SbxBase::SetError( SbxERR_SYNTAX ); SbxBase::SetError( SbxERR_SYNTAX );
} }
@@ -80,7 +61,7 @@ static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym )
{ {
rSym = p; rSym = p;
// The it can contain alphabetic characters, numbers or underlines // The it can contain alphabetic characters, numbers or underlines
while( *p && (isAlphaNumeric( *p ) || *p == '_') ) while( *p && (rtl::isAsciiAlphanumeric( *p ) || *p == '_') )
{ {
p++, nLen++; p++, nLen++;
} }
@@ -103,7 +84,7 @@ static SbxVariable* QualifiedName
SbxVariableRef refVar; SbxVariableRef refVar;
const sal_Unicode* p = SkipWhitespace( *ppBuf ); const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( isAlpha( *p ) || *p == '_' || *p == '[' ) if( rtl::isAsciiAlpha( *p ) || *p == '_' || *p == '[' )
{ {
// Read in the element // Read in the element
refVar = Element( pObj, pGbl, &p, t ); refVar = Element( pObj, pGbl, &p, t );
@@ -139,8 +120,8 @@ static SbxVariable* Operand
{ {
SbxVariableRef refVar( new SbxVariable ); SbxVariableRef refVar( new SbxVariable );
const sal_Unicode* p = SkipWhitespace( *ppBuf ); const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( !bVar && ( isDigit( *p ) if( !bVar && ( rtl::isAsciiDigit( *p )
|| ( *p == '.' && isDigit( *( p+1 ) ) ) || ( *p == '.' && rtl::isAsciiDigit( *( p+1 ) ) )
|| *p == '-' || *p == '-'
|| *p == '&' ) ) || *p == '&' ) )
{ {

View File

@@ -32,6 +32,7 @@ $(eval $(call gb_ZipPackage_add_files,sal_odk_headers,inc/rtl,include/rtl,\
rtl/bootstrap.hxx \ rtl/bootstrap.hxx \
rtl/byteseq.h \ rtl/byteseq.h \
rtl/byteseq.hxx \ rtl/byteseq.hxx \
rtl/character.hxx \
rtl/cipher.h \ rtl/cipher.h \
rtl/crc.h \ rtl/crc.h \
rtl/digest.h \ rtl/digest.h \

144
sal/inc/rtl/character.hxx Normal file
View File

@@ -0,0 +1,144 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_RTL_CHARACTER_HXX
#define INCLUDED_RTL_CHARACTER_HXX
#include "sal/config.h"
#include "sal/types.h"
namespace rtl
{
/** Check for ASCII character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a ASCII character (0x00--0x7F).
@since LibreOffice 4.1
*/
inline bool isAscii(sal_uInt32 nUtf32)
{
return nUtf32 <= 0x7F;
}
/** Check for ASCII lower case character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a US-ASCII lower case alphabetic character
(ASCII 'a'--'z').
@since LibreOffice 4.1
*/
inline bool isAsciiLowerCase(sal_uInt32 nUtf32)
{
return nUtf32 >= 'a' && nUtf32 <= 'z';
}
/** Check for US-ASCII upper case character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a US-ASCII upper case alphabetic character
(US-ASCII 'A'--'Z').
@since LibreOffice 4.1
*/
inline bool isAsciiUpperCase(sal_uInt32 nUtf32)
{
return nUtf32 >= 'A' && nUtf32 <= 'Z';
}
/** Check for ASCII alphanumeric character.
@param nUtf32 Some UCS-4 character.
@return True if nUtf32 is a US-ASCII alphanumeric character
(ASCII '0'--'9', 'A'--'Z' or 'a'--'z').
@since LibreOffice 4.1
*/
inline bool isAsciiAlpha(sal_uInt32 nUtf32)
{
return isAsciiLowerCase(nUtf32) || isAsciiUpperCase(nUtf32);
}
/** Check for ASCII digit character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a ASCII (decimal) digit character
(ASCII '0'--'9').
@since LibreOffice 4.1
*/
inline bool isAsciiDigit(sal_uInt32 nUtf32)
{
return nUtf32 >= '0' && nUtf32 <= '9';
}
/** Check for US-ASCII alphanumeric character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a US-ASCII alphanumeric character (US-ASCII
'0'--'9', 'A'--'Z' or 'a'--'z').
@since LibreOffice 4.1
*/
inline bool isAsciiAlphanumeric(sal_uInt32 nUtf32)
{
return isAsciiDigit(nUtf32) || isAsciiAlpha(nUtf32);
}
/** Check for US-ASCII canonic hexadecimal digit character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a US-ASCII canonic (i.e., upper case)
hexadecimal digit character (US-ASCII '0'--'9' or 'A'--'F').
@since LibreOffice 4.1
*/
inline bool isAsciiCanonicHexDigit(sal_uInt32 nUtf32)
{
return isAsciiDigit(nUtf32) || (nUtf32 >= 'A' && nUtf32 <= 'F');
}
/** Check for US-ASCII hexadecimal digit character.
@param nUtf32 Some UCS-4 character.
@return True if nChar is a US-ASCII hexadecimal digit character (US-
ASCII '0'--'9', 'A'--'F', 'a'--'f').
@since LibreOffice 4.1
*/
inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
{
return isAsciiCanonicHexDigit(nUtf32) || (nUtf32 >= 'a' && nUtf32 <= 'f');
}
}//rtl namespace
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -22,6 +22,7 @@
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "rtl/alloc.h" #include "rtl/alloc.h"
#include "rtl/character.hxx"
#include "rtl/math.hxx" #include "rtl/math.hxx"
#include "rtl/strbuf.h" #include "rtl/strbuf.h"
#include "rtl/string.h" #include "rtl/string.h"
@@ -689,13 +690,6 @@ inline bool long10Overflow( long& nExp, int nAdd )
return false; return false;
} }
// We are only concerned about ASCII arabic numerical digits here
template< typename CharT >
inline bool isDigit( CharT c )
{
return 0x30 <= c && c <= 0x39;
}
template< typename CharT > template< typename CharT >
inline double stringToDouble(CharT const * pBegin, CharT const * pEnd, inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
CharT cDecSeparator, CharT cGroupSeparator, CharT cDecSeparator, CharT cGroupSeparator,
@@ -755,7 +749,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
for (; p != pEnd; ++p) for (; p != pEnd; ++p)
{ {
CharT c = *p; CharT c = *p;
if (isDigit(c)) if (rtl::isAsciiDigit(c))
{ {
fVal = fVal * 10.0 + static_cast< double >( c - CharT('0') ); fVal = fVal * 10.0 + static_cast< double >( c - CharT('0') );
++nValExp; ++nValExp;
@@ -783,7 +777,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
for (; p != pEnd; ++p) for (; p != pEnd; ++p)
{ {
CharT c = *p; CharT c = *p;
if (!isDigit(c)) if (!rtl::isAsciiDigit(c))
break; break;
if ( nDigs < nSigs ) if ( nDigs < nSigs )
{ // further digits (more than nSigs) don't have any { // further digits (more than nSigs) don't have any
@@ -821,7 +815,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if ( fVal == 0.0 ) if ( fVal == 0.0 )
{ // no matter what follows, zero stays zero, but carry on the { // no matter what follows, zero stays zero, but carry on the
// offset // offset
while (p != pEnd && isDigit(*p)) while (p != pEnd && rtl::isAsciiDigit(*p))
++p; ++p;
} }
else else
@@ -831,7 +825,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
for (; p != pEnd; ++p) for (; p != pEnd; ++p)
{ {
CharT c = *p; CharT c = *p;
if (!isDigit(c)) if (!rtl::isAsciiDigit(c))
break; break;
int i = c - CharT('0'); int i = c - CharT('0');
if ( long10Overflow( nExp, i ) ) if ( long10Overflow( nExp, i ) )
@@ -876,7 +870,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
fVal = HUGE_VAL; fVal = HUGE_VAL;
eStatus = rtl_math_ConversionStatus_OutOfRange; eStatus = rtl_math_ConversionStatus_OutOfRange;
// Eat any further digits: // Eat any further digits:
while (p != pEnd && isDigit(*p)) while (p != pEnd && rtl::isAsciiDigit(*p))
++p; ++p;
} }
else if (pEnd - p >= 4 && p[1] == CharT('N') && p[2] == CharT('A') else if (pEnd - p >= 4 && p[1] == CharT('N') && p[2] == CharT('A')
@@ -897,7 +891,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
bSign = false; // don't negate again bSign = false; // don't negate again
} }
// Eat any further digits: // Eat any further digits:
while (p != pEnd && isDigit(*p)) while (p != pEnd && rtl::isAsciiDigit(*p))
++p; ++p;
} }
} }

View File

@@ -20,6 +20,7 @@
#include "surrogates.hxx" #include "surrogates.hxx"
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "rtl/character.hxx"
#include "rtl/strbuf.hxx" #include "rtl/strbuf.hxx"
#include "rtl/textenc.h" #include "rtl/textenc.h"
#include "rtl/textcvt.h" #include "rtl/textcvt.h"
@@ -39,20 +40,6 @@ std::size_t const nCharClassSize = 128;
sal_Unicode const cEscapePrefix = 0x25; // '%' sal_Unicode const cEscapePrefix = 0x25; // '%'
inline bool isDigit(sal_uInt32 nUtf32)
{
return nUtf32 >= 0x30 && nUtf32 <= 0x39; // '0'--'9'
}
inline bool isAlpha(sal_uInt32 nUtf32)
{
// 'A'--'Z', 'a'--'z'
return (
(nUtf32 >= 0x41 && nUtf32 <= 0x5A) ||
(nUtf32 >= 0x61 && nUtf32 <= 0x7A)
);
}
inline bool isHighSurrogate(sal_uInt32 nUtf16) inline bool isHighSurrogate(sal_uInt32 nUtf16)
{ {
return SAL_RTL_IS_HIGH_SURROGATE(nUtf16); return SAL_RTL_IS_HIGH_SURROGATE(nUtf16);
@@ -376,7 +363,7 @@ void parseUriRef(rtl_uString const * pUriRef, Components * pComponents)
sal_Unicode const * pEnd = pBegin + pUriRef->length; sal_Unicode const * pEnd = pBegin + pUriRef->length;
sal_Unicode const * pPos = pBegin; sal_Unicode const * pPos = pBegin;
if (pPos != pEnd && isAlpha(*pPos)) if (pPos != pEnd && rtl::isAsciiAlpha(*pPos))
{ {
for (sal_Unicode const * p = pPos + 1; p != pEnd; ++p) for (sal_Unicode const * p = pPos + 1; p != pEnd; ++p)
{ {
@@ -387,7 +374,7 @@ void parseUriRef(rtl_uString const * pUriRef, Components * pComponents)
pPos = p; pPos = p;
break; break;
} }
else if (!isAlpha(*p) && !isDigit(*p) && *p != '+' && *p != '-' else if (!rtl::isAsciiAlphanumeric(*p) && *p != '+' && *p != '-'
&& *p != '.') && *p != '.')
{ {
break; break;

View File

@@ -41,6 +41,7 @@
#include "cppuhelper/implbase2.hxx" #include "cppuhelper/implbase2.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "rtl/character.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -56,28 +57,8 @@ namespace {
//TODO: move comphelper::string::misc into something like //TODO: move comphelper::string::misc into something like
//sal/salhelper and use those instead //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) { sal_Unicode toLowerCase(sal_Unicode c) {
return isUpperCase(c) ? c + ('a' - 'A') : c; return rtl::isAsciiUpperCase(c) ? c + ('a' - 'A') : c;
} }
bool equalIgnoreCase(sal_Unicode c1, sal_Unicode c2) { bool equalIgnoreCase(sal_Unicode c1, sal_Unicode c2) {
@@ -88,8 +69,8 @@ bool equalIgnoreEscapeCase(OUString const & s1, OUString const & s2) {
if (s1.getLength() == s2.getLength()) { if (s1.getLength() == s2.getLength()) {
for (sal_Int32 i = 0; i < s1.getLength();) { for (sal_Int32 i = 0; i < s1.getLength();) {
if (s1[i] == '%' && s2[i] == '%' && s1.getLength() - i > 2 if (s1[i] == '%' && s2[i] == '%' && s1.getLength() - i > 2
&& isHexDigit(s1[i + 1]) && isHexDigit(s1[i + 2]) && rtl::isAsciiHexDigit(s1[i + 1]) && rtl::isAsciiHexDigit(s1[i + 2])
&& isHexDigit(s2[i + 1]) && isHexDigit(s2[i + 2]) && rtl::isAsciiHexDigit(s2[i + 1]) && rtl::isAsciiHexDigit(s2[i + 2])
&& equalIgnoreCase(s1[i + 1], s2[i + 1]) && equalIgnoreCase(s1[i + 1], s2[i + 1])
&& equalIgnoreCase(s1[i + 2], s2[i + 2])) && equalIgnoreCase(s1[i + 2], s2[i + 2]))
{ {
@@ -107,12 +88,12 @@ bool equalIgnoreEscapeCase(OUString const & s1, OUString const & s2) {
} }
sal_Int32 parseScheme(OUString const & uriReference) { sal_Int32 parseScheme(OUString const & uriReference) {
if (uriReference.getLength() >= 2 && isAlpha(uriReference[0])) { if (uriReference.getLength() >= 2 && rtl::isAsciiAlpha(uriReference[0])) {
for (sal_Int32 i = 0; i < uriReference.getLength(); ++i) { for (sal_Int32 i = 0; i < uriReference.getLength(); ++i) {
sal_Unicode c = uriReference[i]; sal_Unicode c = uriReference[i];
if (c == ':') { if (c == ':') {
return i; return i;
} else if (!isAlpha(c) && !isDigit(c) && c != '+' && c != '-' } else if (!rtl::isAsciiAlpha(c) && !rtl::isAsciiDigit(c) && c != '+' && c != '-'
&& c != '.') && c != '.')
{ {
break; break;
@@ -381,7 +362,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
RTL_CONSTASCII_STRINGPARAM("com.sun.star.uri.UriSchemeParser_")); RTL_CONSTASCII_STRINGPARAM("com.sun.star.uri.UriSchemeParser_"));
for (sal_Int32 i = 0; i < scheme.getLength(); ++i) { for (sal_Int32 i = 0; i < scheme.getLength(); ++i) {
sal_Unicode c = scheme[i]; sal_Unicode c = scheme[i];
if (isUpperCase(c)) { if (rtl::isAsciiUpperCase(c)) {
buf.append(toLowerCase(c)); buf.append(toLowerCase(c));
} else if (c == '+') { } else if (c == '+') {
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("PLUS")); buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("PLUS"));
@@ -390,7 +371,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
} else if (c == '.') { } else if (c == '.') {
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("DOT")); buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("DOT"));
} else { } else {
OSL_ASSERT(isLowerCase(c) || isDigit(c)); OSL_ASSERT(rtl::isAsciiLowerCase(c) || rtl::isAsciiDigit(c));
buf.append(c); buf.append(c);
} }
} }

View File

@@ -23,6 +23,7 @@
#include "tools/toolsdllapi.h" #include "tools/toolsdllapi.h"
#include <rtl/alloc.h> #include <rtl/alloc.h>
#include <rtl/character.hxx>
#include <rtl/string.hxx> #include <rtl/string.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <rtl/tencinfo.h> #include <rtl/tencinfo.h>
@@ -537,7 +538,7 @@ public:
// static // static
inline bool INetMIME::isUSASCII(sal_uInt32 nChar) inline bool INetMIME::isUSASCII(sal_uInt32 nChar)
{ {
return nChar <= 0x7F; return rtl::isAscii(nChar);
} }
// static // static
@@ -567,74 +568,74 @@ inline bool INetMIME::isVisible(sal_uInt32 nChar)
// static // static
inline bool INetMIME::isDigit(sal_uInt32 nChar) inline bool INetMIME::isDigit(sal_uInt32 nChar)
{ {
return nChar >= '0' && nChar <= '9'; return rtl::isAsciiDigit(nChar);
} }
// static // static
inline bool INetMIME::isCanonicHexDigit(sal_uInt32 nChar) inline bool INetMIME::isCanonicHexDigit(sal_uInt32 nChar)
{ {
return isDigit(nChar) || (nChar >= 'A' && nChar <= 'F'); return rtl::isAsciiCanonicHexDigit(nChar);
} }
// static // static
inline bool INetMIME::isHexDigit(sal_uInt32 nChar) inline bool INetMIME::isHexDigit(sal_uInt32 nChar)
{ {
return isCanonicHexDigit(nChar) || (nChar >= 'a' && nChar <= 'f'); return rtl::isAsciiHexDigit(nChar);
} }
// static // static
inline bool INetMIME::isUpperCase(sal_uInt32 nChar) inline bool INetMIME::isUpperCase(sal_uInt32 nChar)
{ {
return nChar >= 'A' && nChar <= 'Z'; return rtl::isAsciiUpperCase(nChar);
} }
// static // static
inline bool INetMIME::isLowerCase(sal_uInt32 nChar) inline bool INetMIME::isLowerCase(sal_uInt32 nChar)
{ {
return nChar >= 'a' && nChar <= 'z'; return rtl::isAsciiLowerCase(nChar);
} }
// static // static
inline bool INetMIME::isAlpha(sal_uInt32 nChar) inline bool INetMIME::isAlpha(sal_uInt32 nChar)
{ {
return isUpperCase(nChar) || isLowerCase(nChar); return rtl::isAsciiAlpha(nChar);
} }
// static // static
inline bool INetMIME::isAlphanumeric(sal_uInt32 nChar) inline bool INetMIME::isAlphanumeric(sal_uInt32 nChar)
{ {
return isAlpha(nChar) || isDigit(nChar); return rtl::isAsciiAlphanumeric(nChar);
} }
// static // static
inline bool INetMIME::isBase64Digit(sal_uInt32 nChar) inline bool INetMIME::isBase64Digit(sal_uInt32 nChar)
{ {
return isUpperCase(nChar) || isLowerCase(nChar) || isDigit(nChar) return rtl::isAsciiUpperCase(nChar) || rtl::isAsciiLowerCase(nChar) || rtl::isAsciiDigit(nChar)
|| nChar == '+' || nChar == '/'; || nChar == '+' || nChar == '/';
} }
// static // static
inline sal_uInt32 INetMIME::toUpperCase(sal_uInt32 nChar) inline sal_uInt32 INetMIME::toUpperCase(sal_uInt32 nChar)
{ {
return isLowerCase(nChar) ? nChar - ('a' - 'A') : nChar; return rtl::isAsciiLowerCase(nChar) ? nChar - ('a' - 'A') : nChar;
} }
// static // static
inline sal_uInt32 INetMIME::toLowerCase(sal_uInt32 nChar) inline sal_uInt32 INetMIME::toLowerCase(sal_uInt32 nChar)
{ {
return isUpperCase(nChar) ? nChar + ('a' - 'A') : nChar; return rtl::isAsciiUpperCase(nChar) ? nChar + ('a' - 'A') : nChar;
} }
// static // static
inline int INetMIME::getWeight(sal_uInt32 nChar) inline int INetMIME::getWeight(sal_uInt32 nChar)
{ {
return isDigit(nChar) ? int(nChar - '0') : -1; return rtl::isAsciiDigit(nChar) ? int(nChar - '0') : -1;
} }
// static // static
inline int INetMIME::getHexWeight(sal_uInt32 nChar) inline int INetMIME::getHexWeight(sal_uInt32 nChar)
{ {
return isDigit(nChar) ? int(nChar - '0') : return rtl::isAsciiDigit(nChar) ? int(nChar - '0') :
nChar >= 'A' && nChar <= 'F' ? int(nChar - 'A' + 10) : nChar >= 'A' && nChar <= 'F' ? int(nChar - 'A' + 10) :
nChar >= 'a' && nChar <= 'f' ? int(nChar - 'a' + 10) : -1; nChar >= 'a' && nChar <= 'f' ? int(nChar - 'a' + 10) : -1;
} }
@@ -642,9 +643,9 @@ inline int INetMIME::getHexWeight(sal_uInt32 nChar)
// static // static
inline int INetMIME::getBase64Weight(sal_uInt32 nChar) inline int INetMIME::getBase64Weight(sal_uInt32 nChar)
{ {
return isUpperCase(nChar) ? int(nChar - 'A') : return rtl::isAsciiUpperCase(nChar) ? int(nChar - 'A') :
isLowerCase(nChar) ? int(nChar - 'a' + 26) : rtl::isAsciiLowerCase(nChar) ? int(nChar - 'a' + 26) :
isDigit(nChar) ? int(nChar - '0' + 52) : rtl::isAsciiDigit(nChar) ? int(nChar - '0' + 52) :
nChar == '+' ? 62 : nChar == '+' ? 62 :
nChar == '/' ? 63 : nChar == '/' ? 63 :
nChar == '=' ? -1 : -2; nChar == '=' ? -1 : -2;

View File

@@ -24,6 +24,7 @@
#include "com/sun/star/util/XStringWidth.hpp" #include "com/sun/star/util/XStringWidth.hpp"
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "osl/file.hxx" #include "osl/file.hxx"
#include "rtl/character.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/textenc.h" #include "rtl/textenc.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -630,11 +631,11 @@ OUString parseScheme(
sal_uInt32 fragmentDelimiter) sal_uInt32 fragmentDelimiter)
{ {
sal_Unicode const * p = *begin; sal_Unicode const * p = *begin;
if (p != end && INetMIME::isAlpha(*p)) { if (p != end && rtl::isAsciiAlpha(*p)) {
do { do {
++p; ++p;
} while (p != end } while (p != end
&& (INetMIME::isAlphanumeric(*p) || *p == '+' || *p == '-' && (rtl::isAsciiAlphanumeric(*p) || *p == '+' || *p == '-'
|| *p == '.')); || *p == '.'));
// #i34835# To avoid problems with Windows file paths like "C:\foo", // #i34835# To avoid problems with Windows file paths like "C:\foo",
// do not accept generic schemes that are only one character long: // do not accept generic schemes that are only one character long:
@@ -730,7 +731,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
sal_Unicode const * p1 = pPos; sal_Unicode const * p1 = pPos;
if (eStyle & FSYS_DOS if (eStyle & FSYS_DOS
&& pEnd - p1 >= 2 && pEnd - p1 >= 2
&& INetMIME::isAlpha(p1[0]) && rtl::isAsciiAlpha(p1[0])
&& p1[1] == ':' && p1[1] == ':'
&& (pEnd - p1 == 2 || p1[2] == '/' || p1[2] == '\\')) && (pEnd - p1 == 2 || p1[2] == '/' || p1[2] == '\\'))
{ {
@@ -1043,7 +1044,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
bSkippedInitialSlash = true; bSkippedInitialSlash = true;
if ((eStyle & FSYS_DOS) != 0 if ((eStyle & FSYS_DOS) != 0
&& pEnd - pPos >= 2 && pEnd - pPos >= 2
&& INetMIME::isAlpha(pPos[0]) && rtl::isAsciiAlpha(pPos[0])
&& pPos[1] == ':' && pPos[1] == ':'
&& (pEnd - pPos == 2 && (pEnd - pPos == 2
|| pPos[2] == '/' || pPos[2] == '\\')) || pPos[2] == '/' || pPos[2] == '\\'))
@@ -1106,7 +1107,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
// replacing "\" by "/" within <*path> // replacing "\" by "/" within <*path>
if (eStyle & FSYS_DOS if (eStyle & FSYS_DOS
&& pEnd - pPos >= 2 && pEnd - pPos >= 2
&& INetMIME::isAlpha(pPos[0]) && rtl::isAsciiAlpha(pPos[0])
&& pPos[1] == ':' && pPos[1] == ':'
&& (pEnd - pPos == 2 && (pEnd - pPos == 2
|| pPos[2] == '/' || pPos[2] == '/'
@@ -1317,7 +1318,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd ) if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
{ {
sal_Unicode const * p1 = pHostPortEnd - 1; sal_Unicode const * p1 = pHostPortEnd - 1;
while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) while (p1 > pHostPortBegin && rtl::isAsciiDigit(*p1))
--p1; --p1;
if (*p1 == ':') if (*p1 == ':')
pPort = p1; pPort = p1;
@@ -1519,7 +1520,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef,
bool bFSys = false; bool bFSys = false;
sal_Unicode const * q = p; sal_Unicode const * q = p;
if (pEnd - q >= 2 if (pEnd - q >= 2
&& INetMIME::isAlpha(q[0]) && rtl::isAsciiAlpha(q[0])
&& q[1] == ':' && q[1] == ':'
&& (pEnd - q == 2 || q[2] == '/' || q[2] == '\\')) && (pEnd - q == 2 || q[2] == '/' || q[2] == '\\'))
bFSys = true; // 2nd, 3rd bFSys = true; // 2nd, 3rd
@@ -2398,9 +2399,9 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
aTheCanonic.append(sal_Unicode('[')); aTheCanonic.append(sal_Unicode('['));
eState = STATE_IP6; eState = STATE_IP6;
} }
else if (INetMIME::isAlpha(*p) || *p == '_') else if (rtl::isAsciiAlpha(*p) || *p == '_')
eState = STATE_TOPLABEL; eState = STATE_TOPLABEL;
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2416,21 +2417,21 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
eState = STATE_LABEL_DOT; eState = STATE_LABEL_DOT;
else if (*p == '-') else if (*p == '-')
eState = STATE_LABEL_HYPHEN; eState = STATE_LABEL_HYPHEN;
else if (!INetMIME::isAlphanumeric(*p) && *p != '_') else if (!rtl::isAsciiAlphanumeric(*p) && *p != '_')
goto done; goto done;
break; break;
case STATE_LABEL_HYPHEN: case STATE_LABEL_HYPHEN:
if (INetMIME::isAlphanumeric(*p) || *p == '_') if (rtl::isAsciiAlphanumeric(*p) || *p == '_')
eState = STATE_LABEL; eState = STATE_LABEL;
else if (*p != '-') else if (*p != '-')
goto done; goto done;
break; break;
case STATE_LABEL_DOT: case STATE_LABEL_DOT:
if (INetMIME::isAlpha(*p) || *p == '_') if (rtl::isAsciiAlpha(*p) || *p == '_')
eState = STATE_TOPLABEL; eState = STATE_TOPLABEL;
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
eState = STATE_LABEL; eState = STATE_LABEL;
else else
goto done; goto done;
@@ -2441,21 +2442,21 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
eState = STATE_TOPLABEL_DOT; eState = STATE_TOPLABEL_DOT;
else if (*p == '-') else if (*p == '-')
eState = STATE_TOPLABEL_HYPHEN; eState = STATE_TOPLABEL_HYPHEN;
else if (!INetMIME::isAlphanumeric(*p) && *p != '_') else if (!rtl::isAsciiAlphanumeric(*p) && *p != '_')
goto done; goto done;
break; break;
case STATE_TOPLABEL_HYPHEN: case STATE_TOPLABEL_HYPHEN:
if (INetMIME::isAlphanumeric(*p) || *p == '_') if (rtl::isAsciiAlphanumeric(*p) || *p == '_')
eState = STATE_TOPLABEL; eState = STATE_TOPLABEL;
else if (*p != '-') else if (*p != '-')
goto done; goto done;
break; break;
case STATE_TOPLABEL_DOT: case STATE_TOPLABEL_DOT:
if (INetMIME::isAlpha(*p) || *p == '_') if (rtl::isAsciiAlpha(*p) || *p == '_')
eState = STATE_TOPLABEL; eState = STATE_TOPLABEL;
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
eState = STATE_LABEL; eState = STATE_LABEL;
else else
goto done; goto done;
@@ -2475,9 +2476,9 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
eState = STATE_LABEL_DOT; eState = STATE_LABEL_DOT;
else if (*p == '-') else if (*p == '-')
eState = STATE_LABEL_HYPHEN; eState = STATE_LABEL_HYPHEN;
else if (INetMIME::isAlpha(*p) || *p == '_') else if (rtl::isAsciiAlpha(*p) || *p == '_')
eState = STATE_LABEL; eState = STATE_LABEL;
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
if (nDigits < 3) if (nDigits < 3)
{ {
nNumber = 10 * nNumber + INetMIME::getWeight(*p); nNumber = 10 * nNumber + INetMIME::getWeight(*p);
@@ -2490,9 +2491,9 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
break; break;
case STATE_IP4_DOT: case STATE_IP4_DOT:
if (INetMIME::isAlpha(*p) || *p == '_') if (rtl::isAsciiAlpha(*p) || *p == '_')
eState = STATE_TOPLABEL; eState = STATE_TOPLABEL;
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2505,7 +2506,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
case STATE_IP6: case STATE_IP6:
if (*p == ':') if (*p == ':')
eState = STATE_IP6_COLON; eState = STATE_IP6_COLON;
else if (INetMIME::isHexDigit(*p)) else if (rtl::isAsciiHexDigit(*p))
{ {
nNumber = INetMIME::getHexWeight(*p); nNumber = INetMIME::getHexWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2533,13 +2534,13 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
aTheCanonic.append(sal_Unicode(':')); aTheCanonic.append(sal_Unicode(':'));
eState = STATE_IP6_3COLON; eState = STATE_IP6_3COLON;
} }
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
eState = STATE_IP6_HEXSEQ2_MAYBE_IP4; eState = STATE_IP6_HEXSEQ2_MAYBE_IP4;
} }
else if (INetMIME::isHexDigit(*p)) else if (rtl::isAsciiHexDigit(*p))
{ {
nNumber = INetMIME::getHexWeight(*p); nNumber = INetMIME::getHexWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2550,7 +2551,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
break; break;
case STATE_IP6_3COLON: case STATE_IP6_3COLON:
if (INetMIME::isDigit(*p)) if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2575,7 +2576,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
aTheCanonic.append(sal_Unicode(':')); aTheCanonic.append(sal_Unicode(':'));
eState = STATE_IP6_HEXSEQ1_COLON; eState = STATE_IP6_HEXSEQ1_COLON;
} }
else if (INetMIME::isHexDigit(*p) && nDigits < 4) else if (rtl::isAsciiHexDigit(*p) && nDigits < 4)
{ {
nNumber = 16 * nNumber + INetMIME::getHexWeight(*p); nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
++nDigits; ++nDigits;
@@ -2590,13 +2591,13 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
aTheCanonic.append(sal_Unicode(':')); aTheCanonic.append(sal_Unicode(':'));
eState = STATE_IP6_2COLON; eState = STATE_IP6_2COLON;
} }
else if (INetMIME::isDigit(*p)) else if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
eState = STATE_IP6_HEXSEQ1_MAYBE_IP4; eState = STATE_IP6_HEXSEQ1_MAYBE_IP4;
} }
else if (INetMIME::isHexDigit(*p)) else if (rtl::isAsciiHexDigit(*p))
{ {
nNumber = INetMIME::getHexWeight(*p); nNumber = INetMIME::getHexWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2630,12 +2631,12 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
nOctets = 2; nOctets = 2;
eState = STATE_IP6_IP4_DOT; eState = STATE_IP6_IP4_DOT;
} }
else if (INetMIME::isDigit(*p) && nDigits < 3) else if (rtl::isAsciiDigit(*p) && nDigits < 3)
{ {
nNumber = 16 * nNumber + INetMIME::getWeight(*p); nNumber = 16 * nNumber + INetMIME::getWeight(*p);
++nDigits; ++nDigits;
} }
else if (INetMIME::isHexDigit(*p) && nDigits < 4) else if (rtl::isAsciiHexDigit(*p) && nDigits < 4)
{ {
nNumber = 16 * nNumber + INetMIME::getHexWeight(*p); nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
++nDigits; ++nDigits;
@@ -2659,7 +2660,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
aTheCanonic.append(sal_Unicode(':')); aTheCanonic.append(sal_Unicode(':'));
eState = STATE_IP6_HEXSEQ2_COLON; eState = STATE_IP6_HEXSEQ2_COLON;
} }
else if (INetMIME::isHexDigit(*p) && nDigits < 4) else if (rtl::isAsciiHexDigit(*p) && nDigits < 4)
{ {
nNumber = 16 * nNumber + INetMIME::getHexWeight(*p); nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
++nDigits; ++nDigits;
@@ -2669,13 +2670,13 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
break; break;
case STATE_IP6_HEXSEQ2_COLON: case STATE_IP6_HEXSEQ2_COLON:
if (INetMIME::isDigit(*p)) if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
eState = STATE_IP6_HEXSEQ2_MAYBE_IP4; eState = STATE_IP6_HEXSEQ2_MAYBE_IP4;
} }
else if (INetMIME::isHexDigit(*p)) else if (rtl::isAsciiHexDigit(*p))
{ {
nNumber = INetMIME::getHexWeight(*p); nNumber = INetMIME::getHexWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2709,12 +2710,12 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
nOctets = 2; nOctets = 2;
eState = STATE_IP6_IP4_DOT; eState = STATE_IP6_IP4_DOT;
} }
else if (INetMIME::isDigit(*p) && nDigits < 3) else if (rtl::isAsciiDigit(*p) && nDigits < 3)
{ {
nNumber = 16 * nNumber + INetMIME::getWeight(*p); nNumber = 16 * nNumber + INetMIME::getWeight(*p);
++nDigits; ++nDigits;
} }
else if (INetMIME::isHexDigit(*p) && nDigits < 4) else if (rtl::isAsciiHexDigit(*p) && nDigits < 4)
{ {
nNumber = 16 * nNumber + INetMIME::getHexWeight(*p); nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
++nDigits; ++nDigits;
@@ -2745,7 +2746,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
} }
else else
goto done; goto done;
else if (INetMIME::isDigit(*p) && nDigits < 3) else if (rtl::isAsciiDigit(*p) && nDigits < 3)
{ {
nNumber = 10 * nNumber + INetMIME::getWeight(*p); nNumber = 10 * nNumber + INetMIME::getWeight(*p);
++nDigits; ++nDigits;
@@ -2755,7 +2756,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
break; break;
case STATE_IP6_IP4_DOT: case STATE_IP6_IP4_DOT:
if (INetMIME::isDigit(*p)) if (rtl::isAsciiDigit(*p))
{ {
nNumber = INetMIME::getWeight(*p); nNumber = INetMIME::getWeight(*p);
nDigits = 1; nDigits = 1;
@@ -2825,7 +2826,7 @@ bool INetURLObject::parseHostOrNetBiosName(
eEscapeType); eEscapeType);
if (!INetMIME::isVisible(nUTF32)) if (!INetMIME::isVisible(nUTF32))
return false; return false;
if (!INetMIME::isAlphanumeric(nUTF32)) if (!rtl::isAsciiAlphanumeric(nUTF32))
switch (nUTF32) switch (nUTF32)
{ {
case '"': case '"':
@@ -2996,7 +2997,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
|| *pPos == nSegmentDelimiter || *pPos == nSegmentDelimiter
|| *pPos == nAltSegmentDelimiter) || *pPos == nAltSegmentDelimiter)
&& aTheSynPath.getLength() == 2 && aTheSynPath.getLength() == 2
&& INetMIME::isAlpha(aTheSynPath[1])) && rtl::isAsciiAlpha(aTheSynPath[1]))
{ {
// A first segment of <ALPHA "|"> is translated to // A first segment of <ALPHA "|"> is translated to
// <ALPHA ":">: // <ALPHA ":">:
@@ -3041,7 +3042,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
} }
// Match <group>: // Match <group>:
if (INetMIME::isAlpha(*pPos)) if (rtl::isAsciiAlpha(*pPos))
{ {
for (sal_Unicode const * p = pPos + 1;; ++p) for (sal_Unicode const * p = pPos + 1;; ++p)
{ {
@@ -3053,7 +3054,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
pPos = p; pPos = p;
goto done; goto done;
} }
else if (!INetMIME::isAlphanumeric(*p) && *p != '+' else if (!rtl::isAsciiAlphanumeric(*p) && *p != '+'
&& *p != '-' && *p != '.' && *p != '_') && *p != '-' && *p != '.' && *p != '_')
{ {
break; break;
@@ -3291,7 +3292,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets, sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets,
'=', eMechanism, '=', eMechanism,
eCharset, eEscapeType); eCharset, eEscapeType);
if (!INetMIME::isDigit(nUTF32)) if (!rtl::isAsciiDigit(nUTF32))
return false; return false;
aTheSynPath.append(sal_Unicode(nUTF32)); aTheSynPath.append(sal_Unicode(nUTF32));
bEmpty = false; bEmpty = false;
@@ -3614,7 +3615,7 @@ bool INetURLObject::hasDosVolume(FSysStyle eStyle) const
return (eStyle & FSYS_DOS) != 0 return (eStyle & FSYS_DOS) != 0
&& m_aPath.getLength() >= 3 && m_aPath.getLength() >= 3
&& p[0] == '/' && p[0] == '/'
&& INetMIME::isAlpha(p[1]) && rtl::isAsciiAlpha(p[1])
&& p[2] == ':' && p[2] == ':'
&& (m_aPath.getLength() == 3 || p[3] == '/'); && (m_aPath.getLength() == 3 || p[3] == '/');
} }
@@ -4628,7 +4629,7 @@ bool INetURLObject::setFSysPath(OUString const & rFSysPath,
if (eStyle & FSYS_DOS if (eStyle & FSYS_DOS
&& pFSysEnd - pFSysBegin >= 2 && pFSysEnd - pFSysBegin >= 2
&& INetMIME::isAlpha(pFSysBegin[0]) && rtl::isAsciiAlpha(pFSysBegin[0])
&& pFSysBegin[1] == ':' && pFSysBegin[1] == ':'
&& (pFSysEnd - pFSysBegin == 2 && (pFSysEnd - pFSysBegin == 2
|| pFSysBegin[2] == '/' || pFSysBegin[2] == '/'
@@ -4704,7 +4705,7 @@ bool INetURLObject::setFSysPath(OUString const & rFSysPath,
{ {
aSynAbsURIRef.append(sal_Unicode('/')); aSynAbsURIRef.append(sal_Unicode('/'));
if (pFSysEnd - p >= 2 if (pFSysEnd - p >= 2
&& INetMIME::isAlpha(p[0]) && rtl::isAsciiAlpha(p[0])
&& p[1] == ':' && p[1] == ':'
&& (pFSysEnd - p == 2 || p[2] == '\\' || p[2] == '/')) && (pFSysEnd - p == 2 || p[2] == '\\' || p[2] == '/'))
nAltDelimiter = '/'; nAltDelimiter = '/';
@@ -5162,7 +5163,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin,
switch (eState) switch (eState)
{ {
case STATE_DOT: case STATE_DOT:
if (p != pEnd && (INetMIME::isAlphanumeric(*p) || *p == '_')) if (p != pEnd && (rtl::isAsciiAlphanumeric(*p) || *p == '_'))
{ {
++nLabels; ++nLabels;
eState = STATE_LABEL; eState = STATE_LABEL;
@@ -5176,7 +5177,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin,
case STATE_LABEL: case STATE_LABEL:
if (p != pEnd) if (p != pEnd)
{ {
if (INetMIME::isAlphanumeric(*p) || *p == '_') if (rtl::isAsciiAlphanumeric(*p) || *p == '_')
break; break;
else if (*p == '.') else if (*p == '.')
{ {
@@ -5196,7 +5197,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin,
case STATE_HYPHEN: case STATE_HYPHEN:
if (p != pEnd) if (p != pEnd)
{ {
if (INetMIME::isAlphanumeric(*p) || *p == '_') if (rtl::isAsciiAlphanumeric(*p) || *p == '_')
{ {
eState = STATE_LABEL; eState = STATE_LABEL;
break; break;
@@ -5218,7 +5219,7 @@ bool INetURLObject::scanIPv6reference(sal_Unicode const *& rBegin,
if (rBegin != pEnd && *rBegin == '[') { if (rBegin != pEnd && *rBegin == '[') {
sal_Unicode const * p = rBegin + 1; sal_Unicode const * p = rBegin + 1;
//TODO: check for valid IPv6address (RFC 2373): //TODO: check for valid IPv6address (RFC 2373):
while (p != pEnd && (INetMIME::isHexDigit(*p) || *p == ':' || *p == '.')) while (p != pEnd && (rtl::isAsciiHexDigit(*p) || *p == ':' || *p == '.'))
{ {
++p; ++p;
} }