summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/common/unistr.cpp
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2017-04-13 16:25:08 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2017-05-09 15:20:02 -0700
commit5d0a770c129c00e3942263b429f8efa4c42efba9 (patch)
tree0766989dae39097084b6c5c8e2f75bf92812c713 /deps/icu-small/source/common/unistr.cpp
parent147048a0d3e255d2a0604f3ab7c8f62252cb8252 (diff)
downloadandroid-node-v8-5d0a770c129c00e3942263b429f8efa4c42efba9.tar.gz
android-node-v8-5d0a770c129c00e3942263b429f8efa4c42efba9.tar.bz2
android-node-v8-5d0a770c129c00e3942263b429f8efa4c42efba9.zip
deps: ICU 59.1 bump
* No feature changes. * Bug fixes. * Details: http://site.icu-project.org/download/59 Fixes: https://github.com/nodejs/node/issues/12077 PR-URL: https://github.com/nodejs/node/pull/12486 Refs: https://github.com/nodejs/node/issues/7844 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/unistr.cpp')
-rw-r--r--deps/icu-small/source/common/unistr.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/deps/icu-small/source/common/unistr.cpp b/deps/icu-small/source/common/unistr.cpp
index f825de91bb..2db2856f0b 100644
--- a/deps/icu-small/source/common/unistr.cpp
+++ b/deps/icu-small/source/common/unistr.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -218,9 +218,10 @@ UnicodeString::UnicodeString(const UChar *text,
}
UnicodeString::UnicodeString(UBool isTerminated,
- const UChar *text,
+ ConstChar16Ptr textPtr,
int32_t textLength) {
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
+ const UChar *text = textPtr;
if(text == NULL) {
// treat as an empty string, do not alias
setToEmpty();
@@ -234,7 +235,8 @@ UnicodeString::UnicodeString(UBool isTerminated,
// text is terminated, or else it would have failed the above test
textLength = u_strlen(text);
}
- setArray((UChar *)text, textLength, isTerminated ? textLength + 1 : textLength);
+ setArray(const_cast<UChar *>(text), textLength,
+ isTerminated ? textLength + 1 : textLength);
}
}
@@ -873,7 +875,7 @@ UnicodeString::doExtract(int32_t start,
}
int32_t
-UnicodeString::extract(UChar *dest, int32_t destCapacity,
+UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
UErrorCode &errorCode) const {
int32_t len = length();
if(U_SUCCESS(errorCode)) {
@@ -1215,10 +1217,10 @@ UnicodeString::unBogus() {
}
}
-const UChar *
+const char16_t *
UnicodeString::getTerminatedBuffer() {
if(!isWritable()) {
- return 0;
+ return nullptr;
}
UChar *array = getArrayStart();
int32_t len = length();
@@ -1249,14 +1251,14 @@ UnicodeString::getTerminatedBuffer() {
array[len] = 0;
return array;
} else {
- return NULL;
+ return nullptr;
}
}
// setTo() analogous to the readonly-aliasing constructor with the same signature
UnicodeString &
UnicodeString::setTo(UBool isTerminated,
- const UChar *text,
+ ConstChar16Ptr textPtr,
int32_t textLength)
{
if(fUnion.fFields.fLengthAndFlags & kOpenGetBuffer) {
@@ -1264,6 +1266,7 @@ UnicodeString::setTo(UBool isTerminated,
return *this;
}
+ const UChar *text = textPtr;
if(text == NULL) {
// treat as an empty string, do not alias
releaseArray();
@@ -1713,14 +1716,14 @@ UnicodeString::doHashCode() const
// External Buffer
//========================================
-UChar *
+char16_t *
UnicodeString::getBuffer(int32_t minCapacity) {
if(minCapacity>=-1 && cloneArrayIfNeeded(minCapacity)) {
fUnion.fFields.fLengthAndFlags|=kOpenGetBuffer;
setZeroLength();
return getArrayStart();
} else {
- return 0;
+ return nullptr;
}
}