[Libreoffice-commits] core.git: 3 commits - include/rtl include/tools sal/rtl svl/source sw/source tools/source ucb/Library_ucpgio1.mk
Stephan Bergmann
sbergman at redhat.com
Mon Sep 30 02:49:51 PDT 2013
include/rtl/character.hxx | 160 ++++++++++++++++++-------------
include/tools/inetmime.hxx | 151 -----------------------------
sal/rtl/strtmpl.cxx | 84 +++-------------
svl/source/misc/inettype.cxx | 4
svl/source/misc/urihelper.cxx | 4
sw/source/ui/sidebar/PageSizeControl.cxx | 4
tools/source/fsys/urlobj.cxx | 16 +--
tools/source/inet/inetmime.cxx | 51 +++++----
ucb/Library_ucpgio1.mk | 2
9 files changed, 160 insertions(+), 316 deletions(-)
New commits:
commit cfb09f556d7bc4d7341abf86c6e61af657235432
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Sep 30 11:43:59 2013 +0200
Indirect dependency on boost_headers
...since 2eb36dc4b846ab5886ae71fd2978b56b2a2d1d08 "Hack to not leave SolarMutex
released after g_main_loop_run call."
Change-Id: Ib4eb92002531af423b3ed4f24f6f4b71dc9cdc0d
diff --git a/ucb/Library_ucpgio1.mk b/ucb/Library_ucpgio1.mk
index 000f557..b67c9bb 100644
--- a/ucb/Library_ucpgio1.mk
+++ b/ucb/Library_ucpgio1.mk
@@ -12,6 +12,8 @@ $(eval $(call gb_Library_Library,ucpgio1))
$(eval $(call gb_Library_set_componentfile,ucpgio1,ucb/source/ucp/gio/ucpgio))
+$(eval $(call gb_Library_use_external,ucpgio1,boost_headers))
+
$(eval $(call gb_Library_use_sdk_api,ucpgio1))
$(eval $(call gb_Library_use_libraries,ucpgio1,\
commit edecc4e9af189ff8f4c95d4b89a713facb368d71
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Sep 30 11:37:54 2013 +0200
Clean up rtl/character.hxx
It is probably best to base the functions on Unicode code points instead of
scalar values, now that they are also used from sal/rtl/strtmpl.cxx with UTF-16
code units and with arbitrary bytes (with values assumed to be a superset of
ASCII, though). Rename compareAsciiIgnoreCase to compareIgnoreAsciiCase. Also,
the corresponding tools::INetMIME functions can be removed completely; no need
to keep them around as deprecated.
Change-Id: I8d322177f4909e70a946e8186e3e0f7fa6d9a43e
diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx
index 2218158..4379ecb 100644
--- a/include/rtl/character.hxx
+++ b/include/rtl/character.hxx
@@ -21,179 +21,182 @@
#define INCLUDED_RTL_CHARACTER_HXX
#include "sal/config.h"
-#include "sal/types.h"
-#include "sal/log.hxx"
-#include <assert.h>
+#include <cassert>
+
+#include "sal/types.h"
namespace rtl
{
+
/** Check for ASCII character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a ASCII character (0x00--0x7F).
+ @return True if code is an ASCII character (0x00--0x7F).
@since LibreOffice 4.1
*/
-inline bool isAscii(sal_uInt32 nUtf32)
+inline bool isAscii(sal_uInt32 code)
{
- return nUtf32 <= 0x7F;
+ assert(code <= 0x10FFFF);
+ return code <= 0x7F;
}
/** Check for ASCII lower case character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a US-ASCII lower case alphabetic character
- (ASCII 'a'--'z').
+ @return True if code is an ASCII lower case alphabetic character (ASCII
+ 'a'--'z').
@since LibreOffice 4.1
*/
-inline bool isAsciiLowerCase(sal_uInt32 nUtf32)
+inline bool isAsciiLowerCase(sal_uInt32 code)
{
- return nUtf32 >= 'a' && nUtf32 <= 'z';
+ assert(code <= 0x10FFFF);
+ return code >= 'a' && code <= 'z';
}
-/** Check for US-ASCII upper case character.
+/** Check for ASCII upper case character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a US-ASCII upper case alphabetic character
- (US-ASCII 'A'--'Z').
+ @return True if code is an ASCII upper case alphabetic character (ASCII
+ 'A'--'Z').
@since LibreOffice 4.1
*/
-inline bool isAsciiUpperCase(sal_uInt32 nUtf32)
+inline bool isAsciiUpperCase(sal_uInt32 code)
{
- return nUtf32 >= 'A' && nUtf32 <= 'Z';
+ assert(code <= 0x10FFFF);
+ return code >= 'A' && code <= 'Z';
}
-/** Check for ASCII alphanumeric character.
+/** Check for ASCII alphabetic character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nUtf32 is a US-ASCII alphanumeric character
- (ASCII '0'--'9', 'A'--'Z' or 'a'--'z').
+ @return True if code is an ASCII alphabetic character (ASCII 'A'--'Z' or
+ 'a'--'z').
@since LibreOffice 4.1
*/
-inline bool isAsciiAlpha(sal_uInt32 nUtf32)
+inline bool isAsciiAlpha(sal_uInt32 code)
{
- return isAsciiLowerCase(nUtf32) || isAsciiUpperCase(nUtf32);
+ assert(code <= 0x10FFFF);
+ return isAsciiLowerCase(code) || isAsciiUpperCase(code);
}
/** Check for ASCII digit character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a ASCII (decimal) digit character
- (ASCII '0'--'9').
+ @return True if code is an ASCII (decimal) digit character (ASCII
+ '0'--'9').
@since LibreOffice 4.1
*/
-inline bool isAsciiDigit(sal_uInt32 nUtf32)
+inline bool isAsciiDigit(sal_uInt32 code)
{
- return nUtf32 >= '0' && nUtf32 <= '9';
+ assert(code <= 0x10FFFF);
+ return code >= '0' && code <= '9';
}
-/** Check for US-ASCII alphanumeric character.
+/** Check for ASCII alphanumeric character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a US-ASCII alphanumeric character (US-ASCII
- '0'--'9', 'A'--'Z' or 'a'--'z').
+ @return True if code is an ASCII alphanumeric character (ASCII '0'--'9',
+ 'A'--'Z', or 'a'--'z').
@since LibreOffice 4.1
*/
-inline bool isAsciiAlphanumeric(sal_uInt32 nUtf32)
+inline bool isAsciiAlphanumeric(sal_uInt32 code)
{
- return isAsciiDigit(nUtf32) || isAsciiAlpha(nUtf32);
+ assert(code <= 0x10FFFF);
+ return isAsciiDigit(code) || isAsciiAlpha(code);
}
-/** Check for US-ASCII canonic hexadecimal digit character.
+/** Check for ASCII canonic hexadecimal digit character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a US-ASCII canonic (i.e., upper case)
- hexadecimal digit character (US-ASCII '0'--'9' or 'A'--'F').
+ @return True if code is an ASCII canonic (i.e., upper case) hexadecimal
+ digit character (ASCII '0'--'9' or 'A'--'F').
@since LibreOffice 4.1
*/
-inline bool isAsciiCanonicHexDigit(sal_uInt32 nUtf32)
+inline bool isAsciiCanonicHexDigit(sal_uInt32 code)
{
- return isAsciiDigit(nUtf32) || (nUtf32 >= 'A' && nUtf32 <= 'F');
+ assert(code <= 0x10FFFF);
+ return isAsciiDigit(code) || (code >= 'A' && code <= 'F');
}
-/** Check for US-ASCII hexadecimal digit character.
+/** Check for ASCII hexadecimal digit character.
- @param nUtf32 A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return True if nChar is a US-ASCII hexadecimal digit character (US-
- ASCII '0'--'9', 'A'--'F', 'a'--'f').
+ @return True if code is an ASCII hexadecimal digit character (ASCII
+ '0'--'9', 'A'--'F', or 'a'--'f').
@since LibreOffice 4.1
*/
-inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
+inline bool isAsciiHexDigit(sal_uInt32 code)
{
- return isAsciiCanonicHexDigit(nUtf32) || (nUtf32 >= 'a' && nUtf32 <= 'f');
+ assert(code <= 0x10FFFF);
+ return isAsciiCanonicHexDigit(code) || (code >= 'a' && code <= 'f');
}
/** Convert a character, if ASCII, to upper case.
- @param nChar A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return
- nChar converted to ASCII upper case
+ @return code converted to ASCII upper case.
@since LibreOffice 4.2
*/
-inline sal_uInt32 toAsciiUpperCase(sal_uInt32 nChar)
+inline sal_uInt32 toAsciiUpperCase(sal_uInt32 code)
{
- if( isAsciiLowerCase(nChar) )
- nChar -= 32;
-
- return nChar;
+ assert(code <= 0x10FFFF);
+ return isAsciiLowerCase(code) ? code - 32 : code;
}
/** Convert a character, if ASCII, to lower case.
- @param nChar A Unicode scalar value (represented as a UTF-32 code unit).
+ @param code A Unicode code point.
- @return
- nChar converted to ASCII lower case
+ @return code converted to ASCII lower case.
@since LibreOffice 4.2
*/
-inline sal_uInt32 toAsciiLowerCase(sal_uInt32 nChar)
+inline sal_uInt32 toAsciiLowerCase(sal_uInt32 code)
{
- if( isAsciiUpperCase(nChar) )
- nChar += 32;
-
- return nChar;
+ assert(code <= 0x10FFFF);
+ return isAsciiUpperCase(code) ? code + 32 : code;
}
-/** Compare two US-ASCII characters.
+/** Compare two characters ignoring ASCII case.
+
+ @param code1 A Unicode code point.
- @param nChar1 A Unicode scalar value (represented as a UTF-32 code unit).
- @param nChar2 A unicode scalar value (represented as a UTF-32 code unit).
+ @param code2 A unicode code point.
- @return
- 0 if both strings are equal
- < 0 - if this nChar1 is less than nChar2 argument
- > 0 - if this nChar1 is greater than the nChar2 argument
+ @return 0 if both code points are equal,
+ < 0 if code1 is less than code2,
+ > 0 if code1 is greater than code2.
@since LibreOffice 4.2
*/
-inline sal_Int32 compareAsciiIgnoreCase(sal_uInt32 nChar1, sal_uInt32 nChar2)
+inline sal_Int32 compareIgnoreAsciiCase(sal_uInt32 code1, sal_uInt32 code2)
{
- nChar1 = toAsciiLowerCase(nChar1);
- nChar2 = toAsciiLowerCase(nChar2);
-
- return ((sal_Int32) nChar1) - ((sal_Int32) nChar2);
+ assert(code1 <= 0x10FFFF);
+ assert(code2 <= 0x10FFFF);
+ return static_cast<sal_Int32>(toAsciiLowerCase(code1))
+ - static_cast<sal_Int32>(toAsciiLowerCase(code2));
}
-}//rtl namespace
+}
#endif
diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 292f744..40b8429 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -222,28 +222,6 @@ public:
*/
static bool isIMAPAtomChar(sal_uInt32 nChar);
- /** Translate an US-ASCII character to upper case.
-
- @param nChar Some UCS-4 character.
-
- @return If nChar is a US-ASCII upper case character (US-ASCII
- 'A'--'Z'), return the corresponding US-ASCII lower case character (US-
- ASCII 'a'--'z'); otherwise, return nChar unchanged.
- */
- SAL_DEPRECATED("Use rtl::toAsciiUpperCase instead")
- static inline sal_uInt32 toUpperCase(sal_uInt32 nChar);
-
- /** Translate an US-ASCII character to lower case.
-
- @param nChar Some UCS-4 character.
-
- @return If nChar is a US-ASCII lower case character (US-ASCII
- 'a'--'z'), return the corresponding US-ASCII upper case character (US-
- ASCII 'A'--'Z'); otherwise, return nChar unchanged.
- */
- SAL_DEPRECATED("Use rtl::toAsciiLowerCase instead")
- static inline sal_uInt32 toLowerCase(sal_uInt32 nChar);
-
/** Get the digit weight of a US-ASCII character.
@param nChar Some UCS-4 character.
@@ -498,18 +476,6 @@ inline bool INetMIME::isBase64Digit(sal_uInt32 nChar)
}
// static
-inline sal_uInt32 INetMIME::toUpperCase(sal_uInt32 nChar)
-{
- return rtl::toAsciiUpperCase(nChar);
-}
-
-// static
-inline sal_uInt32 INetMIME::toLowerCase(sal_uInt32 nChar)
-{
- return rtl::toAsciiLowerCase(nChar);
-}
-
-// static
inline int INetMIME::getWeight(sal_uInt32 nChar)
{
return rtl::isAsciiDigit(nChar) ? int(nChar - '0') : -1;
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 48bf05e..61103fe 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -172,24 +172,19 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase )( const IMPL_RTL_ST
const IMPL_RTL_STRCODE* pStr2 )
SAL_THROW_EXTERN_C()
{
- sal_Int32 nRet;
- sal_Int32 c1;
- sal_Int32 c2;
+ sal_uInt32 c1;
do
{
- /* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
- c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
- c1 = rtl::toAsciiLowerCase( c1 );
- c2 = rtl::toAsciiLowerCase( c2 );
- nRet = c1-c2;
+ c1 = IMPL_RTL_USTRCODE(*pStr1);
+ sal_Int32 nRet = rtl::compareIgnoreAsciiCase(
+ c1, IMPL_RTL_USTRCODE(*pStr2));
if ( nRet != 0 )
return nRet;
pStr1++;
pStr2++;
}
- while ( c2 );
+ while (c1);
return 0;
}
@@ -204,12 +199,10 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase_WithLength )( const
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
- sal_Int32 nRet;
while ( (pStr1 < pStr1End) && (pStr2 < pStr2End) )
{
- sal_uInt32 c1 = IMPL_RTL_USTRCODE( *pStr1 );
- sal_uInt32 c2 = IMPL_RTL_USTRCODE( *pStr2 );
- nRet = rtl::compareAsciiIgnoreCase(c1, c2);
+ sal_Int32 nRet = rtl::compareIgnoreAsciiCase(
+ IMPL_RTL_USTRCODE(*pStr1), IMPL_RTL_USTRCODE(*pStr2));
if ( nRet != 0 )
return nRet;
@@ -231,13 +224,11 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompareIgnoreAsciiCase_WithLength
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
- sal_Int32 nRet;
while ( (nShortenedLength > 0) &&
(pStr1 < pStr1End) && (pStr2 < pStr2End) )
{
- sal_uInt32 c1 = IMPL_RTL_USTRCODE( *pStr1 );
- sal_uInt32 c2 = IMPL_RTL_USTRCODE( *pStr2 );
- nRet = rtl::compareAsciiIgnoreCase(c1, c2);
+ sal_Int32 nRet = rtl::compareIgnoreAsciiCase(
+ IMPL_RTL_USTRCODE(*pStr1), IMPL_RTL_USTRCODE(*pStr2));
if ( nRet != 0 )
return nRet;
@@ -562,7 +553,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase )( IMPL_RTL_STRCODE* pStr )
{
while ( *pStr )
{
- *pStr = rtl::toAsciiLowerCase( *pStr );
+ *pStr = rtl::toAsciiLowerCase(IMPL_RTL_USTRCODE(*pStr));
pStr++;
}
@@ -576,7 +567,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase_WithLength )( IMPL_RTL_STRCODE*
{
while ( nLen > 0 )
{
- *pStr = rtl::toAsciiLowerCase( *pStr );
+ *pStr = rtl::toAsciiLowerCase(IMPL_RTL_USTRCODE(*pStr));
pStr++;
nLen--;
@@ -590,7 +581,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase )( IMPL_RTL_STRCODE* pStr )
{
while ( *pStr )
{
- *pStr = rtl::toAsciiUpperCase( *pStr );
+ *pStr = rtl::toAsciiUpperCase(IMPL_RTL_USTRCODE(*pStr));
pStr++;
}
@@ -604,7 +595,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase_WithLength )( IMPL_RTL_STRCODE*
{
while ( nLen > 0 )
{
- *pStr = rtl::toAsciiUpperCase( *pStr );
+ *pStr = rtl::toAsciiUpperCase(IMPL_RTL_USTRCODE(*pStr));
pStr++;
nLen--;
@@ -1568,8 +1559,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
- /* Between A-Z (65-90), than to lowercase (+32) */
- if ( rtl::isAsciiUpperCase(*pCharStr) )
+ if ( rtl::isAsciiUpperCase(IMPL_RTL_USTRCODE(*pCharStr)) )
{
/* Copy String */
IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
@@ -1577,15 +1567,14 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA**
/* replace/copy rest of the string */
if ( pNewCharStr )
{
- /* to lowercase (+32) */
- *pNewCharStr = *pCharStr+32;
+ *pNewCharStr = rtl::toAsciiLowerCase(IMPL_RTL_USTRCODE(*pCharStr));
pNewCharStr++;
pCharStr++;
nLen--;
while ( nLen > 0 )
{
- *pNewCharStr = rtl::toAsciiLowerCase( *pCharStr );
+ *pNewCharStr = rtl::toAsciiLowerCase(IMPL_RTL_USTRCODE(*pCharStr));
pNewCharStr++;
pCharStr++;
@@ -1626,8 +1615,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
- /* Between a-z (97-122), than to uppercase (-32) */
- if ( rtl::isAsciiLowerCase(*pCharStr) )
+ if ( rtl::isAsciiLowerCase(IMPL_RTL_USTRCODE(*pCharStr)) )
{
/* Copy String */
IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
@@ -1635,15 +1623,14 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA**
/* replace/copy rest of the string */
if ( pNewCharStr )
{
- /* to uppercase (-32) */
- *pNewCharStr = *pCharStr-32;
+ *pNewCharStr = rtl::toAsciiUpperCase(IMPL_RTL_USTRCODE(*pCharStr));
pNewCharStr++;
pCharStr++;
nLen--;
while ( nLen > 0 )
{
- *pNewCharStr = rtl::toAsciiUpperCase( *pCharStr );
+ *pNewCharStr = rtl::toAsciiUpperCase(IMPL_RTL_USTRCODE(*pCharStr));
pNewCharStr++;
pCharStr++;
commit 89de6ba4c65c8709e32fe636ff743d914cf56225
Author: Arnaud Versini <arnaud.versini at libreoffice.org>
Date: Sat Sep 7 17:11:44 2013 +0200
Introduce ASCII case conversion and use more/rtl/character.hxx.
Also remove all others implementations.
Change-Id: I1dc108a9103f087bd8ce591dff2ac5dd254746f8
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx
index 01350e1..2218158 100644
--- a/include/rtl/character.hxx
+++ b/include/rtl/character.hxx
@@ -139,6 +139,40 @@ inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
return isAsciiCanonicHexDigit(nUtf32) || (nUtf32 >= 'a' && nUtf32 <= 'f');
}
+/** Convert a character, if ASCII, to upper case.
+
+ @param nChar A Unicode scalar value (represented as a UTF-32 code unit).
+
+ @return
+ nChar converted to ASCII upper case
+
+ @since LibreOffice 4.2
+*/
+inline sal_uInt32 toAsciiUpperCase(sal_uInt32 nChar)
+{
+ if( isAsciiLowerCase(nChar) )
+ nChar -= 32;
+
+ return nChar;
+}
+
+/** Convert a character, if ASCII, to lower case.
+
+ @param nChar A Unicode scalar value (represented as a UTF-32 code unit).
+
+ @return
+ nChar converted to ASCII lower case
+
+ @since LibreOffice 4.2
+*/
+inline sal_uInt32 toAsciiLowerCase(sal_uInt32 nChar)
+{
+ if( isAsciiUpperCase(nChar) )
+ nChar += 32;
+
+ return nChar;
+}
+
/** Compare two US-ASCII characters.
@param nChar1 A Unicode scalar value (represented as a UTF-32 code unit).
@@ -146,21 +180,18 @@ inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
@return
0 if both strings are equal
- < 0 - if this string is less than the string argument
- > 0 - if this string is greater than the string argument
+ < 0 - if this nChar1 is less than nChar2 argument
+ > 0 - if this nChar1 is greater than the nChar2 argument
@since LibreOffice 4.2
*/
inline sal_Int32 compareAsciiIgnoreCase(sal_uInt32 nChar1, sal_uInt32 nChar2)
{
- assert(isAscii(nChar1) && isAscii(nChar2));
- if ( isAsciiUpperCase(nChar1) )
- nChar1 += 32;
- if ( isAsciiUpperCase(nChar2) )
- nChar2 += 32;
- return nChar1 - nChar2;
-}
+ nChar1 = toAsciiLowerCase(nChar1);
+ nChar2 = toAsciiLowerCase(nChar2);
+ return ((sal_Int32) nChar1) - ((sal_Int32) nChar2);
+}
}//rtl namespace
diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 256f350..292f744 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -137,14 +137,6 @@ public:
HEADER_FIELD_ADDRESS
};
- /** Check for US-ASCII character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII character (0x00--0x7F).
- */
- static inline bool isUSASCII(sal_uInt32 nChar);
-
/** Check for ISO 8859-1 character.
@param nChar Some UCS-4 character.
@@ -180,69 +172,6 @@ public:
*/
static inline bool isVisible(sal_uInt32 nChar);
- /** Check for US-ASCII digit character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII (decimal) digit character (US-
- ASCII '0'--'9').
- */
- static inline bool isDigit(sal_uInt32 nChar);
-
- /** Check for US-ASCII canonic hexadecimal digit character.
-
- @param nChar 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').
- */
- static inline bool isCanonicHexDigit(sal_uInt32 nChar);
-
- /** Check for US-ASCII hexadecimal digit character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII hexadecimal digit character (US-
- ASCII '0'--'9', 'A'--'F', 'a'--'f').
- */
- static inline bool isHexDigit(sal_uInt32 nChar);
-
- /** Check for US-ASCII upper case character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII upper case alphabetic character
- (US-ASCII 'A'--'Z').
- */
- static inline bool isUpperCase(sal_uInt32 nChar);
-
- /** Check for US-ASCII lower case character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII lower case alphabetic character
- (US-ASCII 'a'--'z').
- */
- static inline bool isLowerCase(sal_uInt32 nChar);
-
- /** Check for US-ASCII alphabetic character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII alphabetic character (US-ASCII
- 'A'--'Z' or 'a'--'z').
- */
- static inline bool isAlpha(sal_uInt32 nChar);
-
- /** Check for US-ASCII alphanumeric character.
-
- @param nChar Some UCS-4 character.
-
- @return True if nChar is a US-ASCII alphanumeric character (US-ASCII
- '0'--'9', 'A'--'Z' or 'a'--'z').
- */
- static inline bool isAlphanumeric(sal_uInt32 nChar);
-
/** Check for US-ASCII Base 64 digit character.
@param nChar Some UCS-4 character.
@@ -301,6 +230,7 @@ public:
'A'--'Z'), return the corresponding US-ASCII lower case character (US-
ASCII 'a'--'z'); otherwise, return nChar unchanged.
*/
+ SAL_DEPRECATED("Use rtl::toAsciiUpperCase instead")
static inline sal_uInt32 toUpperCase(sal_uInt32 nChar);
/** Translate an US-ASCII character to lower case.
@@ -311,6 +241,7 @@ public:
'a'--'z'), return the corresponding US-ASCII upper case character (US-
ASCII 'A'--'Z'); otherwise, return nChar unchanged.
*/
+ SAL_DEPRECATED("Use rtl::toAsciiLowerCase instead")
static inline sal_uInt32 toLowerCase(sal_uInt32 nChar);
/** Get the digit weight of a US-ASCII character.
@@ -536,12 +467,6 @@ public:
};
// static
-inline bool INetMIME::isUSASCII(sal_uInt32 nChar)
-{
- return rtl::isAscii(nChar);
-}
-
-// static
inline bool INetMIME::isISO88591(sal_uInt32 nChar)
{
return nChar <= 0xFF;
@@ -566,48 +491,6 @@ inline bool INetMIME::isVisible(sal_uInt32 nChar)
}
// static
-inline bool INetMIME::isDigit(sal_uInt32 nChar)
-{
- return rtl::isAsciiDigit(nChar);
-}
-
-// static
-inline bool INetMIME::isCanonicHexDigit(sal_uInt32 nChar)
-{
- return rtl::isAsciiCanonicHexDigit(nChar);
-}
-
-// static
-inline bool INetMIME::isHexDigit(sal_uInt32 nChar)
-{
- return rtl::isAsciiHexDigit(nChar);
-}
-
-// static
-inline bool INetMIME::isUpperCase(sal_uInt32 nChar)
-{
- return rtl::isAsciiUpperCase(nChar);
-}
-
-// static
-inline bool INetMIME::isLowerCase(sal_uInt32 nChar)
-{
- return rtl::isAsciiLowerCase(nChar);
-}
-
-// static
-inline bool INetMIME::isAlpha(sal_uInt32 nChar)
-{
- return rtl::isAsciiAlpha(nChar);
-}
-
-// static
-inline bool INetMIME::isAlphanumeric(sal_uInt32 nChar)
-{
- return rtl::isAsciiAlphanumeric(nChar);
-}
-
-// static
inline bool INetMIME::isBase64Digit(sal_uInt32 nChar)
{
return rtl::isAsciiUpperCase(nChar) || rtl::isAsciiLowerCase(nChar) || rtl::isAsciiDigit(nChar)
@@ -617,13 +500,13 @@ inline bool INetMIME::isBase64Digit(sal_uInt32 nChar)
// static
inline sal_uInt32 INetMIME::toUpperCase(sal_uInt32 nChar)
{
- return rtl::isAsciiLowerCase(nChar) ? nChar - ('a' - 'A') : nChar;
+ return rtl::toAsciiUpperCase(nChar);
}
// static
inline sal_uInt32 INetMIME::toLowerCase(sal_uInt32 nChar)
{
- return rtl::isAsciiUpperCase(nChar) ? nChar + ('a' - 'A') : nChar;
+ return rtl::toAsciiLowerCase(nChar);
}
// static
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 496216f..48bf05e 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -27,6 +27,7 @@
#include <string.h>
#include <sal/log.hxx>
+#include <rtl/character.hxx>
#include <boost/static_assert.hpp>
/*
@@ -179,10 +180,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase )( const IMPL_RTL_ST
/* If character between 'A' and 'Z', than convert it to lowercase */
c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
+ c1 = rtl::toAsciiLowerCase( c1 );
+ c2 = rtl::toAsciiLowerCase( c2 );
nRet = c1-c2;
if ( nRet != 0 )
return nRet;
@@ -205,19 +204,12 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase_WithLength )( const
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
- sal_Int32 nRet;
- sal_Int32 c1;
- sal_Int32 c2;
+ sal_Int32 nRet;
while ( (pStr1 < pStr1End) && (pStr2 < pStr2End) )
{
- /* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
- c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
- nRet = c1-c2;
+ sal_uInt32 c1 = IMPL_RTL_USTRCODE( *pStr1 );
+ sal_uInt32 c2 = IMPL_RTL_USTRCODE( *pStr2 );
+ nRet = rtl::compareAsciiIgnoreCase(c1, c2);
if ( nRet != 0 )
return nRet;
@@ -239,20 +231,13 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompareIgnoreAsciiCase_WithLength
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
- sal_Int32 nRet;
- sal_Int32 c1;
- sal_Int32 c2;
+ sal_Int32 nRet;
while ( (nShortenedLength > 0) &&
(pStr1 < pStr1End) && (pStr2 < pStr2End) )
{
- /* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
- c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
- nRet = c1-c2;
+ sal_uInt32 c1 = IMPL_RTL_USTRCODE( *pStr1 );
+ sal_uInt32 c2 = IMPL_RTL_USTRCODE( *pStr2 );
+ nRet = rtl::compareAsciiIgnoreCase(c1, c2);
if ( nRet != 0 )
return nRet;
@@ -577,9 +562,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase )( IMPL_RTL_STRCODE* pStr )
{
while ( *pStr )
{
- /* Between A-Z (65-90), than to lowercase (+32) */
- if ( (*pStr >= 65) && (*pStr <= 90) )
- *pStr += 32;
+ *pStr = rtl::toAsciiLowerCase( *pStr );
pStr++;
}
@@ -593,9 +576,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase_WithLength )( IMPL_RTL_STRCODE*
{
while ( nLen > 0 )
{
- /* Between A-Z (65-90), than to lowercase (+32) */
- if ( (*pStr >= 65) && (*pStr <= 90) )
- *pStr += 32;
+ *pStr = rtl::toAsciiLowerCase( *pStr );
pStr++;
nLen--;
@@ -609,9 +590,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase )( IMPL_RTL_STRCODE* pStr )
{
while ( *pStr )
{
- /* Between a-z (97-122), than to uppercase (-32) */
- if ( (*pStr >= 97) && (*pStr <= 122) )
- *pStr -= 32;
+ *pStr = rtl::toAsciiUpperCase( *pStr );
pStr++;
}
@@ -625,9 +604,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase_WithLength )( IMPL_RTL_STRCODE*
{
while ( nLen > 0 )
{
- /* Between a-z (97-122), than to uppercase (-32) */
- if ( (*pStr >= 97) && (*pStr <= 122) )
- *pStr -= 32;
+ *pStr = rtl::toAsciiUpperCase( *pStr );
pStr++;
nLen--;
@@ -1592,7 +1569,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
/* Between A-Z (65-90), than to lowercase (+32) */
- if ( (*pCharStr >= 65) && (*pCharStr <= 90) )
+ if ( rtl::isAsciiUpperCase(*pCharStr) )
{
/* Copy String */
IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
@@ -1608,11 +1585,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
- /* Between A-Z (65-90), than to lowercase (+32) */
- if ( (*pCharStr >= 65) && (*pCharStr <= 90) )
- *pNewCharStr = *pCharStr+32;
- else
- *pNewCharStr = *pCharStr;
+ *pNewCharStr = rtl::toAsciiLowerCase( *pCharStr );
pNewCharStr++;
pCharStr++;
@@ -1654,7 +1627,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
/* Between a-z (97-122), than to uppercase (-32) */
- if ( (*pCharStr >= 97) && (*pCharStr <= 122) )
+ if ( rtl::isAsciiLowerCase(*pCharStr) )
{
/* Copy String */
IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
@@ -1670,11 +1643,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA**
while ( nLen > 0 )
{
- /* Between a-z (97-122), than to uppercase (-32) */
- if ( (*pCharStr >= 97) && (*pCharStr <= 122) )
- *pNewCharStr = *pCharStr-32;
- else
- *pNewCharStr = *pCharStr;
+ *pNewCharStr = rtl::toAsciiUpperCase( *pCharStr );
pNewCharStr++;
pCharStr++;
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index ba5fea9..31c5a75 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -850,7 +850,7 @@ bool INetContentTypes::parse(OUString const & rMediaType,
bool bDowncase = false;
while (p != pEnd && INetMIME::isTokenChar(*p))
{
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
+ bDowncase = bDowncase || rtl::isAsciiUpperCase(*p);
++p;
}
if (p == pToken)
@@ -868,7 +868,7 @@ bool INetContentTypes::parse(OUString const & rMediaType,
bDowncase = false;
while (p != pEnd && INetMIME::isTokenChar(*p))
{
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
+ bDowncase = bDowncase || rtl::isAsciiUpperCase(*p);
++p;
}
if (p == pToken)
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 811f37f..32df0b6 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -360,7 +360,7 @@ bool checkWChar(CharClass const & rCharClass, OUString const & rStr,
bool bPipe = false)
{
sal_Unicode c = rStr[*pPos];
- if (INetMIME::isUSASCII(c))
+ if (rtl::isAscii(c))
{
static sal_uInt8 const aMap[128]
= { 0, 0, 0, 0, 0, 0, 0, 0,
@@ -515,7 +515,7 @@ OUString URIHelper::FindFirstURLInText(OUString const & rText,
sal_Unicode c = rText[nPos];
if (bBoundary1)
{
- if (INetMIME::isAlpha(c))
+ if (rtl::isAsciiAlpha(c))
{
sal_Int32 i = nPos;
INetProtocol eScheme = INetURLObject::CompareProtocolScheme(rText.copy(i, rEnd - i));
diff --git a/sw/source/ui/sidebar/PageSizeControl.cxx b/sw/source/ui/sidebar/PageSizeControl.cxx
index 1c507bf..f913d8f 100644
--- a/sw/source/ui/sidebar/PageSizeControl.cxx
+++ b/sw/source/ui/sidebar/PageSizeControl.cxx
@@ -26,7 +26,7 @@
#include <svx/sidebar/ValueSetWithTextControl.hxx>
-#include <tools/inetmime.hxx>
+#include <rtl/character.hxx>
#include <editeng/paperinf.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
@@ -71,7 +71,7 @@ PageSizeControl::PageSizeControl(
for (short i = aText.getLength() - 1; i >= 0; i--)
{
sal_Unicode c = aText[i];
- if ( INetMIME::isAlpha(c) || (c == '\'') || (c == '\"') || (c == '%') )
+ if ( rtl::isAsciiAlpha(c) || (c == '\'') || (c == '\"') || (c == '%') )
{
aMetricStr = OUString(c) + aMetricStr;
}
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index fee81b7..c1bb3cc 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -30,6 +30,8 @@
#include "rtl/ustring.hxx"
#include "sal/types.h"
+#include <rtl/character.hxx>
+
#include <algorithm>
#include <limits>
@@ -562,7 +564,7 @@ static sal_uInt32 const aMustEncodeMap[128]
inline bool mustEncode(sal_uInt32 nUTF32, INetURLObject::Part ePart)
{
- return !INetMIME::isUSASCII(nUTF32) || !(aMustEncodeMap[nUTF32] & ePart);
+ return !rtl::isAscii(nUTF32) || !(aMustEncodeMap[nUTF32] & ePart);
}
}
@@ -2209,7 +2211,7 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *&
}
if (p >= pEnd)
break;
- sal_uInt32 nChar = INetMIME::toLowerCase(*p++);
+ sal_uInt32 nChar = rtl::toAsciiLowerCase(*p++);
while (pFirst <= pLast && sal_uChar(pFirst->m_pPrefix[i]) < nChar)
++pFirst;
while (pFirst <= pLast && sal_uChar(pLast->m_pPrefix[i]) > nChar)
@@ -2219,7 +2221,7 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *&
{
sal_Char const * q = pFirst->m_pPrefix + i;
while (p < pEnd && *q != '\0'
- && INetMIME::toLowerCase(*p) == sal_uChar(*q))
+ && rtl::toAsciiLowerCase(*p) == sal_uChar(*q))
{
++p;
++q;
@@ -3229,7 +3231,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
eCharset, eEscapeType);
appendUCS4(aTheSynPath,
eEscapeType == ESCAPE_NO ?
- INetMIME::toLowerCase(nUTF32) : nUTF32,
+ rtl::toAsciiLowerCase(nUTF32) : nUTF32,
eEscapeType, bOctets, PART_VIM, '=',
eCharset, false);
}
@@ -3685,7 +3687,7 @@ OUString INetURLObject::decode(sal_Unicode const * pBegin,
case ESCAPE_UTF32:
if (
- INetMIME::isUSASCII(nUTF32) &&
+ rtl::isAscii(nUTF32) &&
(
eMechanism == DECODE_TO_IURI ||
(
@@ -5062,7 +5064,7 @@ sal_uInt32 INetURLObject::getUTF32(sal_Unicode const *& rBegin,
OSL_FAIL(
"INetURLObject::getUTF32(): Unsupported charset");
case RTL_TEXTENCODING_ASCII_US:
- rEscapeType = INetMIME::isUSASCII(nUTF32) ?
+ rEscapeType = rtl::isAscii(nUTF32) ?
ESCAPE_UTF32 : ESCAPE_OCTET;
break;
@@ -5071,7 +5073,7 @@ sal_uInt32 INetURLObject::getUTF32(sal_Unicode const *& rBegin,
break;
case RTL_TEXTENCODING_UTF8:
- if (INetMIME::isUSASCII(nUTF32))
+ if (rtl::isAscii(nUTF32))
rEscapeType = ESCAPE_UTF32;
else
{
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 3e11ca9..2152c90 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -24,6 +24,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/tencinfo.h>
#include <tools/inetmime.hxx>
+#include <rtl/character.hxx>
namespace unnamed_tools_inetmime {} using namespace unnamed_tools_inetmime;
// unnamed namespaces don't work well yet
@@ -368,7 +369,7 @@ bool INetMIME::isAtomChar(sal_uInt32 nChar)
true, true, true, true, true, true, true, true, //pqrstuvw
true, true, true, true, true, true, true, false //xyz{|}~
};
- return isUSASCII(nChar) && aMap[nChar];
+ return rtl::isAscii(nChar) && aMap[nChar];
}
// static
@@ -392,7 +393,7 @@ bool INetMIME::isTokenChar(sal_uInt32 nChar)
true, true, true, true, true, true, true, true, //pqrstuvw
true, true, true, true, true, true, true, false //xyz{|}~
};
- return isUSASCII(nChar) && aMap[nChar];
+ return rtl::isAscii(nChar) && aMap[nChar];
}
// static
@@ -416,7 +417,7 @@ bool INetMIME::isEncodedWordTokenChar(sal_uInt32 nChar)
true, true, true, true, true, true, true, true, //pqrstuvw
true, true, true, true, true, true, true, false //xyz{|}~
};
- return isUSASCII(nChar) && aMap[nChar];
+ return rtl::isAscii(nChar) && aMap[nChar];
}
// static
@@ -440,7 +441,7 @@ bool INetMIME::isIMAPAtomChar(sal_uInt32 nChar)
true, true, true, true, true, true, true, true, //pqrstuvw
true, true, true, false, true, true, true, false //xyz{|}~
};
- return isUSASCII(nChar) && aMap[nChar];
+ return rtl::isAscii(nChar) && aMap[nChar];
}
// static
@@ -465,7 +466,7 @@ bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1,
while (*pString2 != 0)
if (pBegin1 == pEnd1
- || toUpperCase(*pBegin1++) != toUpperCase(*pString2++))
+ || rtl::toAsciiUpperCase(*pBegin1++) != rtl::toAsciiUpperCase(*pString2++))
return false;
return pBegin1 == pEnd1;
}
@@ -480,7 +481,7 @@ bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1,
while (*pString2 != 0)
if (pBegin1 == pEnd1
- || toUpperCase(*pBegin1++) != toUpperCase(*pString2++))
+ || rtl::toAsciiUpperCase(*pBegin1++) != rtl::toAsciiUpperCase(*pString2++))
return false;
return pBegin1 == pEnd1;
}
@@ -725,7 +726,7 @@ const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin,
default:
++rLength;
- if (!isUSASCII(c))
+ if (!rtl::isAscii(c))
rModify = true;
break;
}
@@ -755,7 +756,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
bool bDowncaseAttribute = false;
while (p != pEnd && isTokenChar(*p) && *p != '*')
{
- bDowncaseAttribute = bDowncaseAttribute || isUpperCase(*p);
+ bDowncaseAttribute = bDowncaseAttribute || rtl::isAsciiUpperCase(*p);
++p;
}
if (p == pAttributeBegin)
@@ -770,7 +771,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
if (p != pEnd && *p == '*')
{
++p;
- if (p != pEnd && isDigit(*p)
+ if (p != pEnd && rtl::isAsciiDigit(*p)
&& !scanUnsigned(p, pEnd, false, nSection))
break;
}
@@ -805,7 +806,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
bool bDowncaseCharset = false;
while (p != pEnd && isTokenChar(*p) && *p != '\'')
{
- bDowncaseCharset = bDowncaseCharset || isUpperCase(*p);
+ bDowncaseCharset = bDowncaseCharset || rtl::isAsciiUpperCase(*p);
++p;
}
if (p == pCharsetBegin)
@@ -828,12 +829,12 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
bool bDowncaseLanguage = false;
int nLetters = 0;
for (; p != pEnd; ++p)
- if (isAlpha(*p))
+ if (rtl::isAsciiAlpha(*p))
{
if (++nLetters > 8)
break;
bDowncaseLanguage = bDowncaseLanguage
- || isUpperCase(*p);
+ || rtl::isAsciiUpperCase(*p);
}
else if (*p == '-')
{
@@ -866,7 +867,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
while (p != pEnd)
{
sal_uInt32 nChar = INetMIME::getUTF32Character(p, pEnd);
- if (isUSASCII(nChar) && !isTokenChar(nChar))
+ if (rtl::isAscii(nChar) && !isTokenChar(nChar))
break;
if (nChar == '%' && p + 1 < pEnd)
{
@@ -884,7 +885,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
aValue = aSink.takeBuffer();
}
else
- while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ while (p != pEnd && (isTokenChar(*p) || !rtl::isAscii(*p)))
++p;
}
else if (p != pEnd && *p == '"')
@@ -938,7 +939,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
else
{
sal_Unicode const * pTokenBegin = p;
- while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ while (p != pEnd && (isTokenChar(*p) || !rtl::isAscii(*p)))
++p;
if (p == pTokenBegin)
break;
@@ -1777,7 +1778,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
break;
default:
- if (isUSASCII(*pBodyPtr)
+ if (rtl::isAscii(*pBodyPtr)
&& !isAtomChar(*pBodyPtr))
{
eEntity = ENTITY_JUNK;
@@ -1826,7 +1827,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
else
while (pLookAhead != pBodyEnd
&& (isAtomChar(*pLookAhead)
- || !isUSASCII(
+ || !rtl::isAscii(
*pLookAhead)))
++pLookAhead;
while (pLookAhead != pBodyEnd)
@@ -1890,7 +1891,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
// whole entity is 'junk' rather than 'non-
// phrase':
if (eEntity == ENTITY_NON_PHRASE
- && !isUSASCII(*pBodyPtr))
+ && !rtl::isAscii(*pBodyPtr))
eEntity = ENTITY_JUNK;
break;
}
@@ -1947,7 +1948,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
default:
if (isVisible(*pBodyPtr))
bEnd = true;
- else if (isUSASCII(*pBodyPtr))
+ else if (rtl::isAscii(*pBodyPtr))
{
++nLength;
++pBodyPtr;
@@ -2090,7 +2091,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
}
else
{
- if (!isUSASCII(*pBodyPtr))
+ if (!rtl::isAscii(*pBodyPtr))
bModify = true;
bEnd = true;
}
@@ -2238,7 +2239,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
pBodyPtr, pBodyEnd);
if (pLookAhead != pBodyEnd
&& (isAtomChar(*pLookAhead)
- || !isUSASCII(*pLookAhead)
+ || !rtl::isAscii(*pLookAhead)
|| *pLookAhead == '"'))
pBodyPtr = pLookAhead;
else
@@ -2264,7 +2265,7 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
default:
if (bQuotedString
|| isAtomChar(*pBodyPtr)
- || !isUSASCII(*pBodyPtr))
+ || !rtl::isAscii(*pBodyPtr))
++pBodyPtr;
else
bEnd = true;
@@ -2483,7 +2484,7 @@ OUString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType,
default:
if (pLanguageBegin != 0
- && (!isAlpha(cChar) || ++nAlphaCount > 8))
+ && (!rtl::isAsciiAlpha(cChar) || ++nAlphaCount > 8))
pLanguageBegin = 0;
break;
}
@@ -3011,7 +3012,7 @@ static const sal_Char aEscape[128]
inline bool
INetMIMEEncodedWordOutputSink::needsEncodedWordEscape(sal_uInt32 nChar) const
{
- return !INetMIME::isUSASCII(nChar) || aEscape[nChar] & m_eContext;
+ return !rtl::isAscii(nChar) || aEscape[nChar] & m_eContext;
}
void INetMIMEEncodedWordOutputSink::finish(bool bWriteTrailer)
@@ -3698,7 +3699,7 @@ INetMIMEEncodedWordOutputSink::operator <<(sal_uInt32 nChar)
0, // '}'
0, // '~'
TENQ | CENQ | PENQ }; // DEL
- Coding eNewCoding = !INetMIME::isUSASCII(nChar) ? CODING_ENCODED :
+ Coding eNewCoding = !rtl::isAscii(nChar) ? CODING_ENCODED :
m_eContext == CONTEXT_PHRASE ?
Coding(aMinimal[nChar] >> 2) :
aMinimal[nChar] & m_eContext ? CODING_ENCODED :
More information about the Libreoffice-commits
mailing list