diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-02-15 12:36:11 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-02-15 12:36:11 +0100 |
commit | 3210bc85ae1276350f18f4795efefe491c2206c2 (patch) | |
tree | 75c8d5831620cdc1d0c9145ca4579197e5cf0d94 /sal/rtl | |
parent | a0acad42105bc3f0304121a86f755958e38aeaac (diff) |
Rename rtl::isValidCodePoint -> rtl::isUnicodeCodePoint
...and fix its documentation, and use it throughout the code base.
Change-Id: I349bc2009b1b0aa7115ea90bc6ecd0a812f63698
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/uri.cxx | 8 | ||||
-rw-r--r-- | sal/rtl/ustrbuf.cxx | 4 | ||||
-rw-r--r-- | sal/rtl/ustring.cxx | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx index b028b3cf6664..0f3d6df52194 100644 --- a/sal/rtl/uri.cxx +++ b/sal/rtl/uri.cxx @@ -132,8 +132,8 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd, p += 3; nEncoded |= ((nWeight1 & 3) << 4 | nWeight2) << nShift; } - if (bUTF8 && nEncoded >= nMin && nEncoded <= 0x10FFFF - && !rtl::isHighSurrogate(nEncoded) + if (bUTF8 && rtl::isUnicodeCodePoint(nEncoded) + && nEncoded >= nMin && !rtl::isHighSurrogate(nEncoded) && !rtl::isLowSurrogate(nEncoded)) { *pBegin = p; @@ -213,7 +213,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd, void writeUcs4(rtl_uString ** pBuffer, sal_Int32 * pCapacity, sal_uInt32 nUtf32) { - assert(nUtf32 <= 0x10FFFF); // bad UTF-32 char + assert(rtl::isUnicodeCodePoint(nUtf32)); if (nUtf32 <= 0xFFFF) { writeUnicode( pBuffer, pCapacity, static_cast< sal_Unicode >(nUtf32)); @@ -245,7 +245,7 @@ void writeEscapeOctet(rtl_uString ** pBuffer, sal_Int32 * pCapacity, bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity, sal_uInt32 nUtf32, rtl_TextEncoding eCharset, bool bStrict) { - assert(nUtf32 <= 0x10FFFF); // bad UTF-32 char + assert(rtl::isUnicodeCodePoint(nUtf32)); if (eCharset == RTL_TEXTENCODING_UTF8) { if (nUtf32 < 0x80) writeEscapeOctet(pBuffer, pCapacity, nUtf32); diff --git a/sal/rtl/ustrbuf.cxx b/sal/rtl/ustrbuf.cxx index 89b897f21573..b73318b6e5f4 100644 --- a/sal/rtl/ustrbuf.cxx +++ b/sal/rtl/ustrbuf.cxx @@ -21,7 +21,7 @@ #include <osl/interlck.h> #include <osl/diagnose.h> - +#include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> #include <strimp.hxx> @@ -169,7 +169,7 @@ void rtl_uStringbuffer_insertUtf32( { sal_Unicode buf[2]; sal_Int32 len; - OSL_ASSERT(c <= 0x10FFFF && !(c >= 0xD800 && c <= 0xDFFF)); + OSL_ASSERT(rtl::isUnicodeCodePoint(c) && !(c >= 0xD800 && c <= 0xDFFF)); if (c <= 0xFFFF) { buf[0] = (sal_Unicode) c; len = 1; diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index 16e9b87b6288..db07cabb396b 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -578,7 +578,7 @@ void SAL_CALL rtl_uString_newFromCodePoints( } n = codePointCount; for (i = 0; i < codePointCount; ++i) { - OSL_ASSERT(codePoints[i] <= 0x10FFFF); + OSL_ASSERT(rtl::isUnicodeCodePoint(codePoints[i])); if (codePoints[i] >= 0x10000) { ++n; } |