summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-04-20 13:50:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-04-20 13:51:19 +0200
commit9561c2f6793bede6e5092c36a4f1c8dbb782c4f4 (patch)
treecb448ab79c6075f9109120f678da78267891bb7b /sal
parentd0d8e0a2a7244814f783f16c6c8b342fe6d16e79 (diff)
Clean up new rtl/surrogates.h
Change-Id: Iec781bdbbf216cb14c9ba5be5955123273d7699c
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/string.cxx8
-rw-r--r--sal/rtl/uri.cxx18
-rw-r--r--sal/rtl/ustring.cxx21
3 files changed, 23 insertions, 24 deletions
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index 68a85f0ae841..3647908c3ada 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -32,7 +32,7 @@
#include <rtl/tencinfo.h>
#include "strimp.hxx"
-#include <rtl/surrogates.h>
+#include <rtl/character.hxx>
#include <rtl/string.h>
#include "rtl/math.h"
@@ -154,7 +154,7 @@ static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
n += 2;
else
{
- if ( !isHighSurrogate(c) )
+ if ( !rtl::isHighSurrogate(c) )
n += 3;
else
{
@@ -163,9 +163,9 @@ static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
if ( pStr+1 < pEndStr )
{
c = *(pStr+1);
- if ( isLowSurrogate(c) )
+ if ( rtl::isLowSurrogate(c) )
{
- nUCS4Char = combineSurrogates(nUCS4Char, c);
+ nUCS4Char = rtl::combineSurrogates(nUCS4Char, c);
pStr++;
}
}
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index a90b40ba83d3..ea895e5a8906 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -20,7 +20,6 @@
#include "osl/diagnose.h"
#include "rtl/character.hxx"
#include "rtl/strbuf.hxx"
-#include "rtl/surrogates.h"
#include "rtl/textenc.h"
#include "rtl/textcvt.h"
#include "rtl/uri.h"
@@ -133,8 +132,9 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
p += 3;
nEncoded |= ((nWeight1 & 3) << 4 | nWeight2) << nShift;
}
- if (bUTF8 && nEncoded >= nMin && !isHighSurrogate(nEncoded)
- && !isLowSurrogate(nEncoded) && nEncoded <= 0x10FFFF)
+ if (bUTF8 && nEncoded >= nMin && nEncoded <= 0x10FFFF
+ && !rtl::isHighSurrogate(nEncoded)
+ && !rtl::isLowSurrogate(nEncoded))
{
*pBegin = p;
*pType = EscapeChar;
@@ -171,10 +171,10 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
*pBegin = p;
*pType = EscapeChar;
assert( nDstSize == 1
- || (nDstSize == 2 && isHighSurrogate(aDst[0])
- && isLowSurrogate(aDst[1])));
+ || (nDstSize == 2 && rtl::isHighSurrogate(aDst[0])
+ && rtl::isLowSurrogate(aDst[1])));
return nDstSize == 1
- ? aDst[0] : combineSurrogates(aDst[0], aDst[1]);
+ ? aDst[0] : rtl::combineSurrogates(aDst[0], aDst[1]);
}
else if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL
&& pEnd - p >= 3 && p[0] == cEscapePrefix
@@ -205,9 +205,9 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
else
{
*pType = EscapeNo;
- return isHighSurrogate(nChar) && *pBegin < pEnd
- && isLowSurrogate(**pBegin) ?
- combineSurrogates(nChar, *(*pBegin)++) : nChar;
+ return rtl::isHighSurrogate(nChar) && *pBegin < pEnd
+ && rtl::isLowSurrogate(**pBegin) ?
+ rtl::combineSurrogates(nChar, *(*pBegin)++) : nChar;
}
}
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index a418c6ad5841..3c9c8b750a1f 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -39,7 +39,7 @@
#include "hash.hxx"
#include "strimp.hxx"
-#include <rtl/surrogates.h>
+#include <rtl/character.hxx>
#include <rtl/ustring.h>
#include "rtl/math.h"
@@ -588,9 +588,8 @@ void SAL_CALL rtl_uString_newFromCodePoints(
if (c < 0x10000) {
*p++ = (sal_Unicode) c;
} else {
- c -= 0x10000;
- *p++ = (sal_Unicode) ((c >> 10) | SAL_RTL_FIRST_HIGH_SURROGATE);
- *p++ = (sal_Unicode) ((c & 0x3FF) | SAL_RTL_FIRST_LOW_SURROGATE);
+ *p++ = rtl::getHighSurrogate(c);
+ *p++ = rtl::getLowSurrogate(c);
}
}
RTL_LOG_STRING_NEW( *newString );
@@ -1049,8 +1048,8 @@ sal_uInt32 SAL_CALL rtl_uString_iterateCodePoints(
while (incrementCodePoints < 0) {
assert(n > 0);
cu = string->buffer[--n];
- if (isLowSurrogate(cu) && n != 0 &&
- isHighSurrogate(string->buffer[n - 1]))
+ if (rtl::isLowSurrogate(cu) && n != 0 &&
+ rtl::isHighSurrogate(string->buffer[n - 1]))
{
--n;
}
@@ -1058,18 +1057,18 @@ sal_uInt32 SAL_CALL rtl_uString_iterateCodePoints(
}
assert(n >= 0 && n < string->length);
cu = string->buffer[n];
- if (isHighSurrogate(cu) && string->length - n >= 2 &&
- isLowSurrogate(string->buffer[n + 1]))
+ if (rtl::isHighSurrogate(cu) && string->length - n >= 2 &&
+ rtl::isLowSurrogate(string->buffer[n + 1]))
{
- cp = combineSurrogates(cu, string->buffer[n + 1]);
+ cp = rtl::combineSurrogates(cu, string->buffer[n + 1]);
} else {
cp = cu;
}
while (incrementCodePoints > 0) {
assert(n < string->length);
cu = string->buffer[n++];
- if (isHighSurrogate(cu) && n != string->length &&
- isLowSurrogate(string->buffer[n]))
+ if (rtl::isHighSurrogate(cu) && n != string->length &&
+ rtl::isLowSurrogate(string->buffer[n]))
{
++n;
}