Browse Source

deps: Intl: ICU 58 bump - small icu (BIG COMMIT)

This commit contains the ICU 58.1 delta.
It is especially large because of the ICU license change,
and, because the line endings were off previously.

* bump to ICU 58.1 - check in small ICU source
* from 58.1 final http://site.icu-project.org/download/58

Fixes: https://github.com/nodejs/node/issues/7844
PR-URL: https://github.com/nodejs/node/pull/9234
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Steven R. Loomis 8 years ago
parent
commit
40366df885
No known key found for this signature in database GPG Key ID: 3932080F4FB419E3
  1. 94
      deps/icu-small/LICENSE
  2. 4
      deps/icu-small/README-SMALL-ICU.txt
  3. 18
      deps/icu-small/license.html
  4. 2
      deps/icu-small/source/common/appendable.cpp
  5. 2
      deps/icu-small/source/common/bmpset.cpp
  6. 2
      deps/icu-small/source/common/bmpset.h
  7. 2
      deps/icu-small/source/common/brkeng.cpp
  8. 2
      deps/icu-small/source/common/brkeng.h
  9. 4
      deps/icu-small/source/common/brkiter.cpp
  10. 2
      deps/icu-small/source/common/bytestream.cpp
  11. 2
      deps/icu-small/source/common/bytestrie.cpp
  12. 10
      deps/icu-small/source/common/bytestriebuilder.cpp
  13. 10
      deps/icu-small/source/common/bytestrieiterator.cpp
  14. 2
      deps/icu-small/source/common/caniter.cpp
  15. 2
      deps/icu-small/source/common/chariter.cpp
  16. 4
      deps/icu-small/source/common/charstr.cpp
  17. 8
      deps/icu-small/source/common/charstr.h
  18. 2
      deps/icu-small/source/common/cmemory.c
  19. 12
      deps/icu-small/source/common/cmemory.h
  20. 2
      deps/icu-small/source/common/common.rc
  21. 20
      deps/icu-small/source/common/cpputils.h
  22. 24
      deps/icu-small/source/common/cstr.cpp
  23. 9
      deps/icu-small/source/common/cstr.h
  24. 2
      deps/icu-small/source/common/cstring.c
  25. 2
      deps/icu-small/source/common/cstring.h
  26. 2
      deps/icu-small/source/common/cwchar.c
  27. 2
      deps/icu-small/source/common/cwchar.h
  28. 6
      deps/icu-small/source/common/dictbe.cpp
  29. 2
      deps/icu-small/source/common/dictbe.h
  30. 2
      deps/icu-small/source/common/dictionarydata.cpp
  31. 2
      deps/icu-small/source/common/dictionarydata.h
  32. 2
      deps/icu-small/source/common/dtintrv.cpp
  33. 2
      deps/icu-small/source/common/errorcode.cpp
  34. 48
      deps/icu-small/source/common/filteredbrk.cpp
  35. 2
      deps/icu-small/source/common/filterednormalizer2.cpp
  36. 2
      deps/icu-small/source/common/hash.h
  37. 2
      deps/icu-small/source/common/icudataver.c
  38. 2
      deps/icu-small/source/common/icuplug.cpp
  39. 2
      deps/icu-small/source/common/icuplugimp.h
  40. 2
      deps/icu-small/source/common/listformatter.cpp
  41. 2
      deps/icu-small/source/common/loadednormalizer2impl.cpp
  42. 2
      deps/icu-small/source/common/localsvc.h
  43. 2
      deps/icu-small/source/common/locavailable.cpp
  44. 2
      deps/icu-small/source/common/locbased.cpp
  45. 2
      deps/icu-small/source/common/locbased.h
  46. 4
      deps/icu-small/source/common/locdispnames.cpp
  47. 117
      deps/icu-small/source/common/locdspnm.cpp
  48. 81
      deps/icu-small/source/common/locid.cpp
  49. 5
      deps/icu-small/source/common/loclikely.cpp
  50. 64
      deps/icu-small/source/common/locmap.c
  51. 2
      deps/icu-small/source/common/locmap.h
  52. 2
      deps/icu-small/source/common/locresdata.cpp
  53. 2
      deps/icu-small/source/common/locutil.cpp
  54. 2
      deps/icu-small/source/common/locutil.h
  55. 2
      deps/icu-small/source/common/messageimpl.h
  56. 4
      deps/icu-small/source/common/messagepattern.cpp
  57. 2
      deps/icu-small/source/common/msvcres.h
  58. 2
      deps/icu-small/source/common/mutex.h
  59. 1114
      deps/icu-small/source/common/norm2_nfc_data.h
  60. 2
      deps/icu-small/source/common/norm2allmodes.h
  61. 2
      deps/icu-small/source/common/normalizer2.cpp
  62. 2
      deps/icu-small/source/common/normalizer2impl.cpp
  63. 2
      deps/icu-small/source/common/normalizer2impl.h
  64. 2
      deps/icu-small/source/common/normlzr.cpp
  65. 2
      deps/icu-small/source/common/parsepos.cpp
  66. 2
      deps/icu-small/source/common/patternprops.cpp
  67. 2
      deps/icu-small/source/common/patternprops.h
  68. 2
      deps/icu-small/source/common/pluralmap.cpp
  69. 2
      deps/icu-small/source/common/pluralmap.h
  70. 2
      deps/icu-small/source/common/propname.cpp
  71. 2
      deps/icu-small/source/common/propname.h
  72. 1768
      deps/icu-small/source/common/propname_data.h
  73. 12
      deps/icu-small/source/common/propsvec.c
  74. 2
      deps/icu-small/source/common/propsvec.h
  75. 2
      deps/icu-small/source/common/punycode.cpp
  76. 2
      deps/icu-small/source/common/punycode.h
  77. 83
      deps/icu-small/source/common/putil.cpp
  78. 14
      deps/icu-small/source/common/putilimp.h
  79. 17
      deps/icu-small/source/common/rbbi.cpp
  80. 4
      deps/icu-small/source/common/rbbicst.pl
  81. 2
      deps/icu-small/source/common/rbbidata.cpp
  82. 2
      deps/icu-small/source/common/rbbidata.h
  83. 59
      deps/icu-small/source/common/rbbinode.cpp
  84. 6
      deps/icu-small/source/common/rbbinode.h
  85. 2
      deps/icu-small/source/common/rbbirb.cpp
  86. 2
      deps/icu-small/source/common/rbbirb.h
  87. 2
      deps/icu-small/source/common/rbbirpt.h
  88. 26
      deps/icu-small/source/common/rbbiscan.cpp
  89. 2
      deps/icu-small/source/common/rbbiscan.h
  90. 4
      deps/icu-small/source/common/rbbisetb.cpp
  91. 2
      deps/icu-small/source/common/rbbisetb.h
  92. 25
      deps/icu-small/source/common/rbbistbl.cpp
  93. 8
      deps/icu-small/source/common/rbbitblb.cpp
  94. 2
      deps/icu-small/source/common/rbbitblb.h
  95. 2
      deps/icu-small/source/common/resbund.cpp
  96. 2
      deps/icu-small/source/common/resbund_cnv.cpp
  97. 46
      deps/icu-small/source/common/resource.cpp
  98. 257
      deps/icu-small/source/common/resource.h
  99. 2
      deps/icu-small/source/common/ruleiter.cpp
  100. 2
      deps/icu-small/source/common/ruleiter.h

94
deps/icu-small/LICENSE

@ -1,9 +1,50 @@
ICU License - ICU 1.8.1 and later
COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
Copyright © 1991-2016 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
---------------------
Third-Party Software Licenses
This section contains third-party software notices and/or additional
terms for licensed third-party software components included within ICU
libraries.
1. ICU License - ICU 1.8.1 to ICU 57.1
COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1995-2016 International Business Machines Corporation and others
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
@ -31,58 +72,9 @@ shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
All trademarks and registered trademarks mentioned herein are the
property of their respective owners.
---------------------
Third-Party Software Licenses
This section contains third-party software notices and/or additional
terms for licensed third-party software components included within ICU
libraries.
1. Unicode Data Files and Software
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2016 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in
http://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that
(a) this copyright and permission notice appear with all copies
of the Data Files or Software,
(b) this copyright and permission notice appear in associated
documentation, and
(c) there is clear notice in each modified Data File or in the Software
as well as in the documentation associated with the Data File(s) or
Software that the data or software has been modified.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
# The Google Chrome software developed by Google is licensed under

4
deps/icu-small/README-SMALL-ICU.txt

@ -1,8 +1,8 @@
Small ICU sources - auto generated by shrink-icu-src.py
This directory contains the ICU subset used by --with-intl=small-icu (the default)
It is a strict subset of ICU 57 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt57l.dat : Reduced-size data file
It is a strict subset of ICU 58 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt58l.dat : Reduced-size data file
To rebuild this directory, see ../../tools/icu/README.md

18
deps/icu-small/license.html

@ -1,18 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ICU License - moved to LICENSE</title>
</head>
<body BGCOLOR="#ffffff">
<p>
The ICU license is now in plain text format, see <a href="./LICENSE">LICENSE</a>.
Update links and software appropriately.
</p>
<i>Copyright (c) 1995-2016 International Business Machines Corporation and others</i>
</body>
</html>

2
deps/icu-small/source/common/appendable.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011-2012, International Business Machines

2
deps/icu-small/source/common/bmpset.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/bmpset.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/brkeng.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
************************************************************************************
* Copyright (C) 2006-2016, International Business Machines Corporation

2
deps/icu-small/source/common/brkeng.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
************************************************************************************
* Copyright (C) 2006-2012, International Business Machines Corporation and others. *

4
deps/icu-small/source/common/brkiter.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 1997-2015, International Business Machines Corporation and
@ -418,6 +420,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
break;
case UBRK_SENTENCE:
result = BreakIterator::buildInstance(loc, "sentence", kind, status);
#if !UCONFIG_NO_FILTERED_BREAK_ITERATION
{
char ssKeyValue[kKeyValueLenMax] = {0};
UErrorCode kvStatus = U_ZERO_ERROR;
@ -430,6 +433,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
}
}
}
#endif
break;
case UBRK_TITLE:
result = BreakIterator::buildInstance(loc, "title", kind, status);

2
deps/icu-small/source/common/bytestream.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2011, International Business Machines
// Corporation and others. All Rights Reserved.
//

2
deps/icu-small/source/common/bytestrie.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2011, International Business Machines

10
deps/icu-small/source/common/bytestriebuilder.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2012, International Business Machines
@ -35,7 +37,7 @@ class BytesTrieElement : public UMemory {
public:
// Use compiler's default constructor, initializes nothing.
void setTo(const StringPiece &s, int32_t val, CharString &strings, UErrorCode &errorCode);
void setTo(StringPiece s, int32_t val, CharString &strings, UErrorCode &errorCode);
StringPiece getString(const CharString &strings) const {
int32_t offset=stringOffset;
@ -86,7 +88,7 @@ private:
};
void
BytesTrieElement::setTo(const StringPiece &s, int32_t val,
BytesTrieElement::setTo(StringPiece s, int32_t val,
CharString &strings, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return;
@ -143,7 +145,7 @@ BytesTrieBuilder::~BytesTrieBuilder() {
}
BytesTrieBuilder &
BytesTrieBuilder::add(const StringPiece &s, int32_t value, UErrorCode &errorCode) {
BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return *this;
}
@ -165,7 +167,7 @@ BytesTrieBuilder::add(const StringPiece &s, int32_t value, UErrorCode &errorCode
return *this; // error instead of dereferencing null
}
if(elementsLength>0) {
uprv_memcpy(newElements, elements, elementsLength*sizeof(BytesTrieElement));
uprv_memcpy(newElements, elements, (size_t)elementsLength*sizeof(BytesTrieElement));
}
delete[] elements;
elements=newElements;

10
deps/icu-small/source/common/bytestrieiterator.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2012, International Business Machines
@ -139,7 +141,6 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
} else {
pos_=skipValue(pos, node);
}
sp_.set(str_->data(), str_->length());
return TRUE;
}
if(maxLength_>0 && str_->length()==maxLength_) {
@ -167,10 +168,14 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
}
}
StringPiece
BytesTrie::Iterator::getString() const {
return str_ == NULL ? StringPiece() : str_->toStringPiece();
}
UBool
BytesTrie::Iterator::truncateAndStop() {
pos_=NULL;
sp_.set(str_->data(), str_->length());
value_=-1; // no real value for str
return TRUE;
}
@ -199,7 +204,6 @@ BytesTrie::Iterator::branchNext(const uint8_t *pos, int32_t length, UErrorCode &
str_->append((char)trieByte, errorCode);
if(isFinal) {
pos_=NULL;
sp_.set(str_->data(), str_->length());
value_=value;
return NULL;
} else {

2
deps/icu-small/source/common/caniter.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
* Copyright (C) 1996-2015, International Business Machines Corporation and

2
deps/icu-small/source/common/chariter.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1999-2011, International Business Machines

4
deps/icu-small/source/common/charstr.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2015, International Business Machines
@ -144,7 +146,7 @@ UBool CharString::ensureCapacity(int32_t capacity,
return TRUE;
}
CharString &CharString::appendPathPart(const StringPiece &s, UErrorCode &errorCode) {
CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return *this;
}

8
deps/icu-small/source/common/charstr.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2001-2015, International Business Machines
@ -39,7 +41,7 @@ template class U_COMMON_API MaybeStackArray<char, 40>;
class U_COMMON_API CharString : public UMemory {
public:
CharString() : len(0) { buffer[0]=0; }
CharString(const StringPiece &s, UErrorCode &errorCode) : len(0) {
CharString(StringPiece s, UErrorCode &errorCode) : len(0) {
buffer[0]=0;
append(s, errorCode);
}
@ -76,7 +78,7 @@ public:
CharString &truncate(int32_t newLength);
CharString &append(char c, UErrorCode &errorCode);
CharString &append(const StringPiece &s, UErrorCode &errorCode) {
CharString &append(StringPiece s, UErrorCode &errorCode) {
return append(s.data(), s.length(), errorCode);
}
CharString &append(const CharString &s, UErrorCode &errorCode) {
@ -115,7 +117,7 @@ public:
* First appends a U_FILE_SEP_CHAR if necessary.
* Does nothing if s is empty.
*/
CharString &appendPathPart(const StringPiece &s, UErrorCode &errorCode);
CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);
/**
* Appends a U_FILE_SEP_CHAR if this string is not empty

2
deps/icu-small/source/common/cmemory.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

12
deps/icu-small/source/common/cmemory.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
@ -281,7 +283,7 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le
if(length>newCapacity) {
length=newCapacity;
}
uprv_memcpy(p, LocalPointerBase<T>::ptr, length*sizeof(T));
uprv_memcpy(p, LocalPointerBase<T>::ptr, (size_t)length*sizeof(T));
}
uprv_free(LocalPointerBase<T>::ptr);
LocalPointerBase<T>::ptr=p;
@ -428,7 +430,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
if(length>newCapacity) {
length=newCapacity;
}
uprv_memcpy(p, ptr, length*sizeof(T));
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
}
releaseArray();
ptr=p;
@ -459,7 +461,7 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
if(p==NULL) {
return NULL;
}
uprv_memcpy(p, ptr, length*sizeof(T));
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
}
resultCapacity=length;
ptr=stackArray;
@ -607,7 +609,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
length=newCapacity;
}
}
uprv_memcpy(p, ptr, sizeof(H)+length*sizeof(T));
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
releaseMemory();
ptr=p;
capacity=newCapacity;
@ -638,7 +640,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
if(p==NULL) {
return NULL;
}
uprv_memcpy(p, ptr, sizeof(H)+length*sizeof(T));
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
}
resultCapacity=length;
ptr=&stackHeader;

2
deps/icu-small/source/common/common.rc

@ -1,6 +1,8 @@
// Do not edit with Microsoft Developer Studio Resource Editor.
// It will permanently substitute version numbers that are intended to be
// picked up by the pre-processor during each build.
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (c) 2001-2010 International Business Machines
// Corporation and others. All Rights Reserved.
//

20
deps/icu-small/source/common/cpputils.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
@ -24,45 +26,45 @@
static
inline void uprv_arrayCopy(const double* src, double* dst, int32_t count)
{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const double* src, int32_t srcStart,
double* dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int8_t* src, int8_t* dst, int32_t count)
{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart,
int8_t* dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count)
{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart,
int16_t* dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int32_t* src, int32_t* dst, int32_t count)
{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); }
static
inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart,
int32_t* dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
static
inline void
uprv_arrayCopy(const UChar *src, int32_t srcStart,
UChar *dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
/**
* Copy an array of UnicodeString OBJECTS (not pointers).

24
deps/icu-small/source/common/cstr.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2015-2016, International Business Machines
@ -6,22 +8,40 @@
* file name: charstr.cpp
*/
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "unicode/unistr.h"
#include "charstr.h"
#include "cstr.h"
#include "charstr.h"
#include "uinvchar.h"
U_NAMESPACE_BEGIN
CStr::CStr(const UnicodeString &in) {
UErrorCode status = U_ZERO_ERROR;
int32_t length = in.extract(0, in.length(), NULL, (uint32_t)0);
#if !UCONFIG_NO_CONVERSION || U_CHARSET_IS_UTF8
int32_t length = in.extract(0, in.length(), static_cast<char *>(NULL), static_cast<uint32_t>(0));
int32_t resultCapacity = 0;
char *buf = s.getAppendBuffer(length, length, resultCapacity, status);
if (U_SUCCESS(status)) {
in.extract(0, in.length(), buf, resultCapacity);
s.append(buf, length, status);
}
#else
// No conversion available. Convert any invariant characters; substitute '?' for the rest.
// Note: can't just call u_UCharsToChars() or CharString.appendInvariantChars() on the
// whole string because they require that the entire input be invariant.
char buf[2];
for (int i=0; i<in.length(); i = in.moveIndex32(i, 1)) {
if (uprv_isInvariantUString(in.getBuffer()+i, 1)) {
u_UCharsToChars(in.getBuffer()+i, buf, 1);
} else {
buf[0] = '?';
}
s.append(buf, 1, status);
}
#endif
}
CStr::~CStr() {

9
deps/icu-small/source/common/cstr.h

@ -1,7 +1,9 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
* Copyright (C) 2015, International Business Machines
* Copyright (C) 2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -19,13 +21,16 @@
#include "charstr.h"
/**
* ICU-internal class CStr, a small helper class to facilitate passing UnicodStrings
* ICU-internal class CStr, a small helper class to facilitate passing UnicodeStrings
* to functions needing (const char *) strings, such as printf().
*
* It is intended primarily for use in debugging or in tests. Uses platform
* default code page conversion, which will do the best job possible,
* but may be lossy, depending on the platform.
*
* If no other conversion is available, use invariant conversion and substitue
* '?' for non-invariant characters.
*
* Example Usage:
* UnicodeString s = whatever;
* printf("%s", CStr(s)());

2
deps/icu-small/source/common/cstring.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/cstring.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/cwchar.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/cwchar.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

6
deps/icu-small/source/common/dictbe.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
* Copyright (C) 2006-2016, International Business Machines Corporation
@ -1293,6 +1295,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
// ix is the corresponding string (code unit) index.
// They differ when the string contains supplementary characters.
int32_t ix = 0;
bool is_prev_katakana = false;
for (int32_t i = 0; i < numCodePts; ++i, ix = inString.moveIndex32(ix, 1)) {
if ((uint32_t)bestSnlp.elementAti(i) == kuint32max) {
continue;
@ -1306,7 +1309,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
// The NULL parameter is the ignored code unit lengths.
// if there are no single character matches found in the dictionary
// starting with this charcter, treat character as a 1-character word
// starting with this character, treat character as a 1-character word
// with the highest value possible, i.e. the least likely to occur.
// Exclude Korean characters from this treatment, as they should be left
// together by default.
@ -1331,7 +1334,6 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
// characters is considered a candidate word with a default cost
// specified in the katakanaCost table according to its length.
bool is_prev_katakana = false;
bool is_katakana = isKatakana(inString.char32At(ix));
int32_t katakanaRunLength = 1;
if (!is_prev_katakana && is_katakana) {

2
deps/icu-small/source/common/dictbe.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
* Copyright (C) 2006-2014, International Business Machines Corporation *

2
deps/icu-small/source/common/dictionarydata.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014-2016, International Business Machines

2
deps/icu-small/source/common/dictionarydata.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014, International Business Machines

2
deps/icu-small/source/common/dtintrv.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*******************************************************************************
* Copyright (C) 2008, International Business Machines Corporation and
* others. All Rights Reserved.

2
deps/icu-small/source/common/errorcode.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

48
deps/icu-small/source/common/filteredbrk.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014-2015, International Business Machines Corporation and
@ -401,7 +403,8 @@ SimpleFilteredSentenceBreakIterator::next() {
int32_t
SimpleFilteredSentenceBreakIterator::first(void) {
return internalNext(fDelegate->first());
// Don't suppress a break opportunity at the beginning of text.
return fDelegate->first();
}
int32_t
@ -415,7 +418,9 @@ SimpleFilteredSentenceBreakIterator::previous(void) {
}
UBool SimpleFilteredSentenceBreakIterator::isBoundary(int32_t offset) {
if(!fDelegate->isBoundary(offset)) return false; // no break to suppress
if (!fDelegate->isBoundary(offset)) return false; // no break to suppress
if (fData->fBackwardsTrie.isNull()) return true; // no data = no suppressions
UErrorCode status = U_ZERO_ERROR;
resetState(status);
@ -476,13 +481,42 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
: fSet(status)
{
if(U_SUCCESS(status)) {
LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &status));
LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &status));
LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &status));
if(U_FAILURE(status)) return; // leaves the builder empty, if you try to use it.
UErrorCode subStatus = U_ZERO_ERROR;
LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &subStatus));
if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open BUNDLE %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
return; // leaves the builder empty, if you try to use it.
}
LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus));
if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open EXCEPTIONS %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
return; // leaves the builder empty, if you try to use it.
}
LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &subStatus));
#if FB_DEBUG
{
UErrorCode subsub = subStatus;
fprintf(stderr, "open SentenceBreak %s => %s, %s\n", fromLocale.getBaseName(), ures_getLocale(breaks.getAlias(), &subsub), u_errorName(subStatus));
}
#endif
if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
return; // leaves the builder empty, if you try to use it.
}
LocalUResourceBundlePointer strs;
UErrorCode subStatus = status;
subStatus = status; // Pick up inherited warning status now
do {
strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus));
if(strs.isValid() && U_SUCCESS(subStatus)) {

2
deps/icu-small/source/common/filterednormalizer2.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/hash.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
* Copyright (C) 1997-2014, International Business Machines

2
deps/icu-small/source/common/icudataver.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/icuplug.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/icuplugimp.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/listformatter.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/loadednormalizer2impl.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014, International Business Machines

2
deps/icu-small/source/common/localsvc.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
* Copyright (C) 2006 International Business Machines Corporation *

2
deps/icu-small/source/common/locavailable.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/locbased.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2004-2014, International Business Machines

2
deps/icu-small/source/common/locbased.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2004-2014, International Business Machines

4
deps/icu-small/source/common/locdispnames.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@ -852,7 +854,7 @@ uloc_getDisplayKeywordValue( const char* locale,
/* now copy the dispName over if not NULL */
if(dispName != NULL){
if(dispNameLen <= destCapacity){
uprv_memcpy(dest, dispName, dispNameLen * U_SIZEOF_UCHAR);
u_memcpy(dest, dispName, dispNameLen);
return u_terminateUChars(dest, destCapacity, dispNameLen, status);
}else{
*status = U_BUFFER_OVERFLOW_ERROR;

117
deps/icu-small/source/common/locdspnm.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2016, International Business Machines Corporation and
@ -278,7 +280,11 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames {
SimpleFormatter format;
SimpleFormatter keyTypeFormat;
UDisplayContext capitalizationContext;
#if !UCONFIG_NO_BREAK_ITERATION
BreakIterator* capitalizationBrkIter;
#else
UObject* capitalizationBrkIter;
#endif
static UMutex capitalizationBrkIterLock;
UnicodeString formatOpenParen;
UnicodeString formatReplaceOpenParen;
@ -341,6 +347,8 @@ private:
UnicodeString& keyValueDisplayName(const char* key, const char* value,
UnicodeString& result, UBool skipAdjust) const;
void initialize(void);
struct CapitalizationContextSink;
};
UMutex LocaleDisplayNamesImpl::capitalizationBrkIterLock = U_MUTEX_INITIALIZER;
@ -386,6 +394,54 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
initialize();
}
struct LocaleDisplayNamesImpl::CapitalizationContextSink : public ResourceSink {
UBool hasCapitalizationUsage;
LocaleDisplayNamesImpl& parent;
CapitalizationContextSink(LocaleDisplayNamesImpl& _parent)
: hasCapitalizationUsage(FALSE), parent(_parent) {}
virtual ~CapitalizationContextSink();
virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/,
UErrorCode &errorCode) {
ResourceTable contexts = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
for (int i = 0; contexts.getKeyAndValue(i, key, value); ++i) {
CapContextUsage usageEnum;
if (uprv_strcmp(key, "key") == 0) {
usageEnum = kCapContextUsageKey;
} else if (uprv_strcmp(key, "keyValue") == 0) {
usageEnum = kCapContextUsageKeyValue;
} else if (uprv_strcmp(key, "languages") == 0) {
usageEnum = kCapContextUsageLanguage;
} else if (uprv_strcmp(key, "script") == 0) {
usageEnum = kCapContextUsageScript;
} else if (uprv_strcmp(key, "territory") == 0) {
usageEnum = kCapContextUsageTerritory;
} else if (uprv_strcmp(key, "variant") == 0) {
usageEnum = kCapContextUsageVariant;
} else {
continue;
}
int32_t len = 0;
const int32_t* intVector = value.getIntVector(len, errorCode);
if (U_FAILURE(errorCode)) { return; }
if (len < 2) { continue; }
int32_t titlecaseInt = (parent.capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU) ? intVector[0] : intVector[1];
if (titlecaseInt == 0) { continue; }
parent.fCapitalization[usageEnum] = TRUE;
hasCapitalizationUsage = TRUE;
}
}
};
// Virtual destructors must be defined out of line.
LocaleDisplayNamesImpl::CapitalizationContextSink::~CapitalizationContextSink() {}
void
LocaleDisplayNamesImpl::initialize(void) {
LocaleDisplayNamesImpl *nonConstThis = (LocaleDisplayNamesImpl *)this;
@ -428,58 +484,21 @@ LocaleDisplayNamesImpl::initialize(void) {
uprv_memset(fCapitalization, 0, sizeof(fCapitalization));
#if !UCONFIG_NO_BREAK_ITERATION
// The following is basically copied from DateFormatSymbols::initializeData
typedef struct {
const char * usageName;
LocaleDisplayNamesImpl::CapContextUsage usageEnum;
} ContextUsageNameToEnum;
const ContextUsageNameToEnum contextUsageTypeMap[] = {
// Entries must be sorted by usageTypeName; entry with NULL name terminates list.
{ "key", kCapContextUsageKey },
{ "keyValue", kCapContextUsageKeyValue },
{ "languages", kCapContextUsageLanguage },
{ "script", kCapContextUsageScript },
{ "territory", kCapContextUsageTerritory },
{ "variant", kCapContextUsageVariant },
{ NULL, (CapContextUsage)0 },
};
// Only get the context data if we need it! This is a const object so we know now...
// Also check whether we will need a break iterator (depends on the data)
UBool needBrkIter = FALSE;
if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE) {
int32_t len = 0;
UResourceBundle *localeBundle = ures_open(NULL, locale.getName(), &status);
if (U_SUCCESS(status)) {
UResourceBundle *contextTransforms = ures_getByKeyWithFallback(localeBundle, "contextTransforms", NULL, &status);
if (U_SUCCESS(status)) {
UResourceBundle *contextTransformUsage;
while ( (contextTransformUsage = ures_getNextResource(contextTransforms, NULL, &status)) != NULL ) {
const int32_t * intVector = ures_getIntVector(contextTransformUsage, &len, &status);
if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
const char* usageKey = ures_getKey(contextTransformUsage);
if (usageKey != NULL) {
const ContextUsageNameToEnum * typeMapPtr = contextUsageTypeMap;
int32_t compResult = 0;
// linear search; list is short and we cannot be sure that bsearch is available
while ( typeMapPtr->usageName != NULL && (compResult = uprv_strcmp(usageKey, typeMapPtr->usageName)) > 0 ) {
++typeMapPtr;
}
if (typeMapPtr->usageName != NULL && compResult == 0) {
int32_t titlecaseInt = (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU)? intVector[0]: intVector[1];
if (titlecaseInt != 0) {
fCapitalization[typeMapPtr->usageEnum] = TRUE;;
needBrkIter = TRUE;
}
}
}
}
status = U_ZERO_ERROR;
ures_close(contextTransformUsage);
}
ures_close(contextTransforms);
}
ures_close(localeBundle);
LocalUResourceBundlePointer resource(ures_open(NULL, locale.getName(), &status));
if (U_FAILURE(status)) { return; }
CapitalizationContextSink sink(*this);
ures_getAllItemsWithFallback(resource.getAlias(), "contextTransforms", sink, status);
if (status == U_MISSING_RESOURCE_ERROR) {
// Silently ignore. Not every locale has contextTransforms.
status = U_ZERO_ERROR;
} else if (U_FAILURE(status)) {
return;
}
needBrkIter = sink.hasCapitalizationUsage;
}
// Get a sentence break iterator if we will need it
if (needBrkIter || capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE) {
@ -494,8 +513,10 @@ LocaleDisplayNamesImpl::initialize(void) {
}
LocaleDisplayNamesImpl::~LocaleDisplayNamesImpl() {
#if !UCONFIG_NO_BREAK_ITERATION
delete capitalizationBrkIter;
}
#endif
}
const Locale&
LocaleDisplayNamesImpl::getLocale() const {

81
deps/icu-small/source/common/locid.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1997-2016, International Business Machines
@ -42,6 +44,7 @@
#include "uhash.h"
#include "ucln_cmn.h"
#include "ustr_imp.h"
#include "charstr.h"
U_CDECL_BEGIN
static UBool U_CALLCONV locale_cleanup(void);
@ -57,6 +60,12 @@ static UMutex gDefaultLocaleMutex = U_MUTEX_INITIALIZER;
static UHashtable *gDefaultLocalesHashT = NULL;
static Locale *gDefaultLocale = NULL;
/**
* \def ULOC_STRING_LIMIT
* strings beyond this value crash in CharString
*/
#define ULOC_STRING_LIMIT 357913941
U_NAMESPACE_END
typedef enum ELocalePos {
@ -283,13 +292,12 @@ Locale::Locale( const char * newLanguage,
}
else
{
MaybeStackArray<char, ULOC_FULLNAME_CAPACITY> togo;
UErrorCode status = U_ZERO_ERROR;
int32_t size = 0;
int32_t lsize = 0;
int32_t csize = 0;
int32_t vsize = 0;
int32_t ksize = 0;
char *p;
// Calculate the size of the resulting string.
@ -297,13 +305,23 @@ Locale::Locale( const char * newLanguage,
if ( newLanguage != NULL )
{
lsize = (int32_t)uprv_strlen(newLanguage);
if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap
setToBogus();
return;
}
size = lsize;
}
CharString togo(newLanguage, lsize, status); // start with newLanguage
// _Country
if ( newCountry != NULL )
{
csize = (int32_t)uprv_strlen(newCountry);
if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap
setToBogus();
return;
}
size += csize;
}
@ -318,6 +336,10 @@ Locale::Locale( const char * newLanguage,
// remove trailing _'s
vsize = (int32_t)uprv_strlen(newVariant);
if ( vsize < 0 || vsize > ULOC_STRING_LIMIT ) { // int32 wrap
setToBogus();
return;
}
while( (vsize>1) && (newVariant[vsize-1] == SEP_CHAR) )
{
vsize--;
@ -342,70 +364,56 @@ Locale::Locale( const char * newLanguage,
if ( newKeywords != NULL)
{
ksize = (int32_t)uprv_strlen(newKeywords);
if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) {
setToBogus();
return;
}
size += ksize + 1;
}
// NOW we have the full locale string..
/*if the whole string is longer than our internal limit, we need
to go to the heap for temporary buffers*/
if (size >= togo.getCapacity())
{
// If togo_heap could not be created, initialize with default settings.
if (togo.resize(size+1) == NULL) {
init(NULL, FALSE);
}
}
togo[0] = 0;
// Now, copy it back.
p = togo.getAlias();
if ( lsize != 0 )
{
uprv_strcpy(p, newLanguage);
p += lsize;
}
// newLanguage is already copied
if ( ( vsize != 0 ) || (csize != 0) ) // at least: __v
{ // ^
*p++ = SEP_CHAR;
togo.append(SEP_CHAR, status);
}
if ( csize != 0 )
{
uprv_strcpy(p, newCountry);
p += csize;
togo.append(newCountry, status);
}
if ( vsize != 0)
{
*p++ = SEP_CHAR; // at least: __v
uprv_strncpy(p, newVariant, vsize); // Must use strncpy because
p += vsize; // of trimming (above).
*p = 0; // terminate
togo.append(SEP_CHAR, status)
.append(newVariant, vsize, status);
}
if ( ksize != 0)
{
if (uprv_strchr(newKeywords, '=')) {
*p++ = '@'; /* keyword parsing */
togo.append('@', status); /* keyword parsing */
}
else {
*p++ = '_'; /* Variant parsing with a script */
togo.append('_', status); /* Variant parsing with a script */
if ( vsize == 0) {
*p++ = '_'; /* No country found */
togo.append('_', status); /* No country found */
}
}
uprv_strcpy(p, newKeywords);
p += ksize;
togo.append(newKeywords, status);
}
if (U_FAILURE(status)) {
// Something went wrong with appending, etc.
setToBogus();
return;
}
// Parse it, because for example 'language' might really be a complete
// string.
init(togo.getAlias(), FALSE);
init(togo.data(), FALSE);
}
}
@ -662,6 +670,7 @@ Locale::setToBogus() {
*script = 0;
*country = 0;
fIsBogus = TRUE;
variantBegin = 0;
}
const Locale& U_EXPORT2

5
deps/icu-small/source/common/loclikely.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@ -1330,6 +1332,8 @@ Locale::isRightToLeft() const {
return uloc_isRightToLeft(getBaseName());
}
U_NAMESPACE_END
// The following must at least allow for rg key value (6) plus terminator (1).
#define ULOC_RG_BUFLEN 8
@ -1379,4 +1383,3 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
return u_terminateChars(region, regionCapacity, rgLen, status);
}
U_NAMESPACE_END

64
deps/icu-small/source/common/locmap.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1996-2016, International Business Machines
@ -213,11 +215,8 @@ ILCID_POSIX_ELEMENT_ARRAY(0x045c, chr,chr_US)
ILCID_POSIX_SUBTABLE(ckb) {
{0x92, "ckb"},
{0x92, "ku"},
{0x7c92, "ckb_Arab"},
{0x7c92, "ku_Arab"},
{0x0492, "ckb_Arab_IQ"},
{0x0492, "ku_Arab_IQ"}
{0x0492, "ckb_Arab_IQ"}
};
/* Declared as cs_CZ to get around compiler errors on z/OS, which defines cs as a function */
@ -1019,33 +1018,40 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
const char *pPosixID = NULL;
#ifdef USE_WINDOWS_LOCALE_API
int32_t tmpLen = 0;
char locName[157]; /* ULOC_FULLNAME_CAPACITY */
tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName));
if (tmpLen > 1) {
/* Windows locale name may contain sorting variant, such as "es-ES_tradnl".
In such case, we need special mapping data found in the hardcoded table
in this source file. */
char *p = uprv_strchr(locName, '_');
if (p) {
/* Keep the base locale, without variant */
*p = 0;
tmpLen = uprv_strlen(locName);
} else {
/* No hardcoded table lookup necessary */
bLookup = FALSE;
}
/* Change the tag separator from '-' to '_' */
p = locName;
while (*p) {
if (*p == '-') {
*p = '_';
// Note: Windows primary lang ID 0x92 in LCID is used for Central Kurdish and
// GetLocaleInfo() maps such LCID to "ku". However, CLDR uses "ku" for
// Northern Kurdish and "ckb" for Central Kurdish. For this reason, we cannot
// use the Windows API to resolve locale ID for this specific case.
if (hostid & 0x3FF != 0x92) {
int32_t tmpLen = 0;
char locName[157]; /* ULOC_FULLNAME_CAPACITY */
tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName));
if (tmpLen > 1) {
/* Windows locale name may contain sorting variant, such as "es-ES_tradnl".
In such case, we need special mapping data found in the hardcoded table
in this source file. */
char *p = uprv_strchr(locName, '_');
if (p) {
/* Keep the base locale, without variant */
*p = 0;
tmpLen = uprv_strlen(locName);
}
else {
/* No hardcoded table lookup necessary */
bLookup = FALSE;
}
/* Change the tag separator from '-' to '_' */
p = locName;
while (*p) {
if (*p == '-') {
*p = '_';
}
p++;
}
p++;
FIX_LANGUAGE_ID_TAG(locName, tmpLen);
pPosixID = locName;
}
FIX_LANGUAGE_ID_TAG(locName, tmpLen);
pPosixID = locName;
}
#endif
if (bLookup) {

2
deps/icu-small/source/common/locmap.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

2
deps/icu-small/source/common/locresdata.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/locutil.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2002-2014, International Business Machines Corporation and

2
deps/icu-small/source/common/locutil.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
* Copyright (C) 2002-2005, International Business Machines Corporation and *

2
deps/icu-small/source/common/messageimpl.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011, International Business Machines

4
deps/icu-small/source/common/messagepattern.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011-2012, International Business Machines
@ -114,7 +116,7 @@ MessagePatternList<T, stackCapacity>::copyFrom(
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memcpy(a.getAlias(), other.a.getAlias(), length*sizeof(T));
uprv_memcpy(a.getAlias(), other.a.getAlias(), (size_t)length*sizeof(T));
}
}

2
deps/icu-small/source/common/msvcres.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//{{NO_DEPENDENCIES}}
// Copyright (c) 2003-2010 International Business Machines
// Corporation and others. All Rights Reserved.

2
deps/icu-small/source/common/mutex.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*

1114
deps/icu-small/source/common/norm2_nfc_data.h

File diff suppressed because it is too large

2
deps/icu-small/source/common/norm2allmodes.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014, International Business Machines

2
deps/icu-small/source/common/normalizer2.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/normalizer2impl.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/normalizer2impl.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/normlzr.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*************************************************************************
* COPYRIGHT:

2
deps/icu-small/source/common/parsepos.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 2003-2003, International Business Machines

2
deps/icu-small/source/common/patternprops.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011, International Business Machines

2
deps/icu-small/source/common/patternprops.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011, International Business Machines

2
deps/icu-small/source/common/pluralmap.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2015, International Business Machines Corporation and
* others. All Rights Reserved.

2
deps/icu-small/source/common/pluralmap.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
* Copyright (C) 2015, International Business Machines Corporation and

2
deps/icu-small/source/common/propname.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2002-2014, International Business Machines

2
deps/icu-small/source/common/propname.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2002-2011, International Business Machines

1768
deps/icu-small/source/common/propname_data.h

File diff suppressed because it is too large

12
deps/icu-small/source/common/propsvec.c

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@ -218,7 +220,7 @@ upvec_setValue(UPropsVectors *pv,
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memcpy(newVectors, pv->v, rows*columns*4);
uprv_memcpy(newVectors, pv->v, (size_t)rows*columns*4);
firstRow=newVectors+(firstRow-pv->v);
lastRow=newVectors+(lastRow-pv->v);
uprv_free(pv->v);
@ -240,7 +242,7 @@ upvec_setValue(UPropsVectors *pv,
if(splitFirstRow) {
/* copy all affected rows up one and move the lastRow pointer */
count = (int32_t)((lastRow-firstRow)+columns);
uprv_memmove(firstRow+columns, firstRow, count*4);
uprv_memmove(firstRow+columns, firstRow, (size_t)count*4);
lastRow+=columns;
/* split the range and move the firstRow pointer */
@ -251,7 +253,7 @@ upvec_setValue(UPropsVectors *pv,
/* split the last row */
if(splitLastRow) {
/* copy the last row data */
uprv_memcpy(lastRow+columns, lastRow, columns*4);
uprv_memcpy(lastRow+columns, lastRow, (size_t)columns*4);
/* split the range and move the firstRow pointer */
lastRow[1]=lastRow[columns]=(uint32_t)limit;
@ -415,7 +417,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE
/* add a new values vector if it is different from the current one */
if(count<0 || 0!=uprv_memcmp(row+2, pv->v+count, valueColumns*4)) {
count+=valueColumns;
uprv_memmove(pv->v+count, row+2, valueColumns*4);
uprv_memmove(pv->v+count, row+2, (size_t)valueColumns*4);
}
if(start<UPVEC_FIRST_SPECIAL_CP) {
@ -477,7 +479,7 @@ upvec_cloneArray(const UPropsVectors *pv,
U_CAPI UTrie2 * U_EXPORT2
upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) {
UPVecToUTrie2Context toUTrie2={ NULL };
UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 };
upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode);
utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode);
if(U_FAILURE(*pErrorCode)) {

2
deps/icu-small/source/common/propsvec.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/punycode.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

2
deps/icu-small/source/common/punycode.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

83
deps/icu-small/source/common/putil.cpp

@ -1,7 +1,9 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
* Copyright (C) 1997-2015, International Business Machines
* Copyright (C) 1997-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -832,7 +834,6 @@ static const char* remapShortTimeZone(const char *stdID, const char *dstID, int3
#endif
#ifdef SEARCH_TZFILE
#define MAX_PATH_SIZE PATH_MAX /* Set the limit for the size of the path. */
#define MAX_READ_SIZE 512
typedef struct DefaultTZInfo {
@ -908,15 +909,19 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
return result;
}
/*
* This method recursively traverses the directory given for a matching TZ file and returns the first match.
*/
/* dirent also lists two entries: "." and ".." that we can safely ignore. */
#define SKIP1 "."
#define SKIP2 ".."
static char SEARCH_TZFILE_RESULT[MAX_PATH_SIZE] = "";
static UBool U_CALLCONV putil_cleanup(void);
static CharString *gSearchTZFileResult = NULL;
/*
* This method recursively traverses the directory given for a matching TZ file and returns the first match.
* This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results.
*/
static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
char curpath[MAX_PATH_SIZE];
DIR* dirp = opendir(path);
DIR* subDirp = NULL;
struct dirent* dirEntry = NULL;
@ -926,24 +931,40 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
return result;
}
if (gSearchTZFileResult == NULL) {
gSearchTZFileResult = new CharString;
if (gSearchTZFileResult == NULL) {
return NULL;
}
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
}
/* Save the current path */
uprv_memset(curpath, 0, MAX_PATH_SIZE);
uprv_strcpy(curpath, path);
UErrorCode status = U_ZERO_ERROR;
CharString curpath(path, -1, status);
if (U_FAILURE(status)) {
return NULL;
}
/* Check each entry in the directory. */
while((dirEntry = readdir(dirp)) != NULL) {
const char* dirName = dirEntry->d_name;
if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0) {
/* Create a newpath with the new entry to test each entry in the directory. */
char newpath[MAX_PATH_SIZE];
uprv_strcpy(newpath, curpath);
uprv_strcat(newpath, dirName);
CharString newpath(curpath, status);
newpath.append(dirName, -1, status);
if (U_FAILURE(status)) {
return NULL;
}
if ((subDirp = opendir(newpath)) != NULL) {
if ((subDirp = opendir(newpath.data())) != NULL) {
/* If this new path is a directory, make a recursive call with the newpath. */
closedir(subDirp);
uprv_strcat(newpath, "/");
result = searchForTZFile(newpath, tzInfo);
newpath.append('/', status);
if (U_FAILURE(status)) {
return NULL;
}
result = searchForTZFile(newpath.data(), tzInfo);
/*
Have to get out here. Otherwise, we'd keep looking
and return the first match in the top-level directory
@ -955,11 +976,19 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
if (result != NULL)
break;
} else if (uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) {
if(compareBinaryFiles(TZDEFAULT, newpath, tzInfo)) {
const char* zoneid = newpath + (sizeof(TZZONEINFO)) - 1;
if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) {
int32_t amountToSkip = sizeof(TZZONEINFO) - 1;
if (amountToSkip > newpath.length()) {
amountToSkip = newpath.length();
}
const char* zoneid = newpath.data() + amountToSkip;
skipZoneIDPrefix(&zoneid);
uprv_strcpy(SEARCH_TZFILE_RESULT, zoneid);
result = SEARCH_TZFILE_RESULT;
gSearchTZFileResult->clear();
gSearchTZFileResult->append(zoneid, -1, status);
if (U_FAILURE(status)) {
return NULL;
}
result = gSearchTZFileResult->data();
/* Get out after the first one found. */
break;
}
@ -970,6 +999,15 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
return result;
}
#endif
U_CAPI void U_EXPORT2
uprv_tzname_clear_cache()
{
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
gTimeZoneBufferPtr = NULL;
#endif
}
U_CAPI const char* U_EXPORT2
uprv_tzname(int n)
{
@ -1019,7 +1057,7 @@ uprv_tzname(int n)
because the tzfile contents is underspecified.
This isn't guaranteed to work because it may not be a symlink.
*/
int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer));
int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
if (0 < ret) {
int32_t tzZoneInfoLen = uprv_strlen(TZZONEINFO);
gTimeZoneBuffer[ret] = 0;
@ -1139,6 +1177,11 @@ static UBool U_CALLCONV putil_cleanup(void)
gTimeZoneFilesDirectory = NULL;
gTimeZoneFilesInitOnce.reset();
#ifdef SEARCH_TZFILE
delete gSearchTZFileResult;
gSearchTZFileResult = NULL;
#endif
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
if (gCorrectedPOSIXLocale) {
uprv_free(gCorrectedPOSIXLocale);

14
deps/icu-small/source/common/putilimp.h

@ -1,7 +1,9 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
* Copyright (C) 1997-2015, International Business Machines
* Copyright (C) 1997-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -148,7 +150,7 @@ typedef size_t uintptr_t;
#ifdef U_HAVE_MMAP
/* Use the predefined value. */
#elif U_PLATFORM_HAS_WIN32_API
#elif U_PLATFORM_USES_ONLY_WIN32_API
# define U_HAVE_MMAP 0
#else
# define U_HAVE_MMAP 1
@ -171,7 +173,7 @@ typedef size_t uintptr_t;
*/
#ifdef U_HAVE_DIRENT_H
/* Use the predefined value. */
#elif U_PLATFORM_HAS_WIN32_API
#elif U_PLATFORM_USES_ONLY_WIN32_API
# define U_HAVE_DIRENT_H 0
#else
# define U_HAVE_DIRENT_H 1
@ -478,6 +480,12 @@ U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
*/
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
/**
* Reset the global tzname cache.
* @internal
*/
U_INTERNAL void uprv_tzname_clear_cache();
/**
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
* This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.

17
deps/icu-small/source/common/rbbi.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
* Copyright (C) 1999-2016 International Business Machines Corporation
@ -72,21 +74,6 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode
}
}
/**
* Same as above but does not adopt memory
*/
RuleBasedBreakIterator::RuleBasedBreakIterator(const RBBIDataHeader* data, enum EDontAdopt, UErrorCode &status)
{
init();
fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
//
// Construct from precompiled binary rules (tables). This constructor is public API,
// taking the rules as a (const uint8_t *) to match the type produced by getBinaryRules().

4
deps/icu-small/source/common/rbbicst.pl

@ -1,4 +1,8 @@
#**************************************************************************
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html#License
#**************************************************************************
#**************************************************************************
# Copyright (C) 2002-2016 International Business Machines Corporation
# and others. All rights reserved.
#**************************************************************************

2
deps/icu-small/source/common/rbbidata.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
* Copyright (C) 1999-2014 International Business Machines Corporation *

2
deps/icu-small/source/common/rbbidata.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

59
deps/icu-small/source/common/rbbinode.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
* Copyright (C) 2002-2016 International Business Machines Corporation *
@ -23,6 +25,8 @@
#include "unicode/uniset.h"
#include "unicode/uchar.h"
#include "unicode/parsepos.h"
#include "cstr.h"
#include "uvector.h"
#include "rbbirb.h"
@ -165,8 +169,6 @@ RBBINode *RBBINode::cloneTree() {
}
}
}
n->fRuleRoot = this->fRuleRoot;
n->fChainIn = this->fChainIn;
return n;
}
@ -192,8 +194,12 @@ RBBINode *RBBINode::cloneTree() {
//-------------------------------------------------------------------------
RBBINode *RBBINode::flattenVariables() {
if (fType == varRef) {
RBBINode *retNode = fLeftChild->cloneTree();
delete this;
RBBINode *retNode = fLeftChild->cloneTree();
if (retNode != NULL) {
retNode->fRuleRoot = this->fRuleRoot;
retNode->fChainIn = this->fChainIn;
}
delete this; // TODO: undefined behavior. Fix.
return retNode;
}
@ -284,7 +290,7 @@ static int32_t serial(const RBBINode *node) {
}
void RBBINode::printNode() {
void RBBINode::printNode(const RBBINode *node) {
static const char * const nodeTypeNames[] = {
"setRef",
"uset",
@ -304,15 +310,16 @@ void RBBINode::printNode() {
"opLParen"
};
if (this==NULL) {
RBBIDebugPrintf("%10p", (void *)this);
if (node==NULL) {
RBBIDebugPrintf("%10p", (void *)node);
} else {
RBBIDebugPrintf("%10p %5d %12s %c%c %5d %5d %5d %6d %d ",
(void *)this, fSerialNum, nodeTypeNames[fType], fRuleRoot?'R':' ', fChainIn?'C':' ',
serial(fLeftChild), serial(fRightChild), serial(fParent),
fFirstPos, fVal);
if (fType == varRef) {
RBBI_DEBUG_printUnicodeString(fText);
(void *)node, node->fSerialNum, nodeTypeNames[node->fType],
node->fRuleRoot?'R':' ', node->fChainIn?'C':' ',
serial(node->fLeftChild), serial(node->fRightChild), serial(node->fParent),
node->fFirstPos, node->fVal);
if (node->fType == varRef) {
RBBI_DEBUG_printUnicodeString(node->fText);
}
}
RBBIDebugPrintf("\n");
@ -321,16 +328,8 @@ void RBBINode::printNode() {
#ifdef RBBI_DEBUG
U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth)
{
int i;
for (i=0; i<s.length(); i++) {
RBBIDebugPrintf("%c", s.charAt(i));
// putc(s.charAt(i), stdout);
}
for (i=s.length(); i<minWidth; i++) {
RBBIDebugPrintf(" ");
}
U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth) {
RBBIDebugPrintf("%*s", minWidth, CStr(s)());
}
#endif
@ -345,21 +344,21 @@ void RBBINode::printNodeHeader() {
RBBIDebugPrintf(" Address serial type LeftChild RightChild Parent position value\n");
}
void RBBINode::printTree(UBool printHeading) {
void RBBINode::printTree(const RBBINode *node, UBool printHeading) {
if (printHeading) {
printNodeHeader();
}
this->printNode();
if (this != NULL) {
printNode(node);
if (node != NULL) {
// Only dump the definition under a variable reference if asked to.
// Unconditinally dump children of all other node types.
if (fType != varRef) {
if (fLeftChild != NULL) {
fLeftChild->printTree(FALSE);
if (node->fType != varRef) {
if (node->fLeftChild != NULL) {
printTree(node->fLeftChild, FALSE);
}
if (fRightChild != NULL) {
fRightChild->printTree(FALSE);
if (node->fRightChild != NULL) {
printTree(node->fRightChild, FALSE);
}
}
}

6
deps/icu-small/source/common/rbbinode.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2001-2016, International Business Machines Corporation and
@ -100,8 +102,8 @@ class RBBINode : public UMemory {
#ifdef RBBI_DEBUG
static void printNodeHeader();
void printNode();
void printTree(UBool withHeading);
static void printNode(const RBBINode *n);
static void printTree(const RBBINode *n, UBool withHeading);
#endif
private:

2
deps/icu-small/source/common/rbbirb.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbirb.cpp
//

2
deps/icu-small/source/common/rbbirb.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbirb.h
//

2
deps/icu-small/source/common/rbbirpt.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//---------------------------------------------------------------------------------
//
// Generated Header File. Do not edit by hand.

26
deps/icu-small/source/common/rbbiscan.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbiscan.cpp
//
@ -1103,6 +1105,17 @@ void RBBIRuleScanner::parse() {
}
if (U_FAILURE(*fRB->fStatus)) {
return;
}
// If there are no forward rules set an error.
//
if (fRB->fForwardTree == NULL) {
error(U_BRK_RULE_SYNTAX);
return;
}
//
// If there were NO user specified reverse rules, set up the equivalent of ".*;"
//
@ -1126,16 +1139,15 @@ void RBBIRuleScanner::parse() {
//
#ifdef RBBI_DEBUG
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "symbols")) {fSymbolTable->rbbiSymtablePrint();}
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree"))
{
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree")) {
RBBIDebugPrintf("Completed Forward Rules Parse Tree...\n");
fRB->fForwardTree->printTree(TRUE);
RBBINode::printTree(fRB->fForwardTree, TRUE);
RBBIDebugPrintf("\nCompleted Reverse Rules Parse Tree...\n");
fRB->fReverseTree->printTree(TRUE);
RBBINode::printTree(fRB->fReverseTree, TRUE);
RBBIDebugPrintf("\nCompleted Safe Point Forward Rules Parse Tree...\n");
fRB->fSafeFwdTree->printTree(TRUE);
RBBINode::printTree(fRB->fSafeFwdTree, TRUE);
RBBIDebugPrintf("\nCompleted Safe Point Reverse Rules Parse Tree...\n");
fRB->fSafeRevTree->printTree(TRUE);
RBBINode::printTree(fRB->fSafeRevTree, TRUE);
}
#endif
}
@ -1150,7 +1162,7 @@ void RBBIRuleScanner::parse() {
void RBBIRuleScanner::printNodeStack(const char *title) {
int i;
RBBIDebugPrintf("%s. Dumping node stack...\n", title);
for (i=fNodeStackPtr; i>0; i--) {fNodeStack[i]->printTree(TRUE);}
for (i=fNodeStackPtr; i>0; i--) {RBBINode::printTree(fNodeStack[i], TRUE);}
}
#endif

2
deps/icu-small/source/common/rbbiscan.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbiscan.h
//

4
deps/icu-small/source/common/rbbisetb.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbisetb.cpp
//
@ -546,7 +548,7 @@ void RBBISetBuilder::printSets() {
RBBI_DEBUG_printUnicodeString(usetNode->fText);
RBBIDebugPrintf("\n");
if (usetNode->fLeftChild != NULL) {
usetNode->fLeftChild->printTree(TRUE);
RBBINode::printTree(usetNode->fLeftChild, TRUE);
}
}
RBBIDebugPrintf("\n");

2
deps/icu-small/source/common/rbbisetb.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbisetb.h
/*

25
deps/icu-small/source/common/rbbistbl.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbistbl.cpp Implementation of the ICU RBBISymbolTable class
//
@ -17,10 +19,10 @@
#include "unicode/uchar.h"
#include "unicode/parsepos.h"
#include "umutex.h"
#include "rbbirb.h"
#include "cstr.h"
#include "rbbinode.h"
#include "rbbirb.h"
#include "umutex.h"
//
@ -226,9 +228,9 @@ RBBISymbolTableEntry::~RBBISymbolTableEntry() {
//
#ifdef RBBI_DEBUG
void RBBISymbolTable::rbbiSymtablePrint() const {
RBBIDebugPrintf("Variable Definitions\n"
"Name Node Val String Val\n"
"----------------------------------------------------------------------\n");
RBBIDebugPrintf("Variable Definitions Symbol Table\n"
"Name Node serial String Val\n"
"-------------------------------------------------------------------\n");
int32_t pos = UHASH_FIRST;
const UHashElement *e = NULL;
@ -239,10 +241,8 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
}
RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer;
RBBI_DEBUG_printUnicodeString(s->key, 15);
RBBIDebugPrintf(" %8p ", (void *)s->val);
RBBI_DEBUG_printUnicodeString(s->val->fLeftChild->fText);
RBBIDebugPrintf("\n");
RBBIDebugPrintf("%-19s %8p %7d ", CStr(s->key)(), (void *)s->val, s->val->fSerialNum);
RBBIDebugPrintf(" %s\n", CStr(s->val->fLeftChild->fText)());
}
RBBIDebugPrintf("\nParsed Variable Definitions\n");
@ -253,8 +253,9 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
break;
}
RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer;
RBBI_DEBUG_printUnicodeString(s->key);
s->val->fLeftChild->printTree(TRUE);
RBBIDebugPrintf("%s\n", CStr(s->key)());
RBBINode::printTree(s->val, TRUE);
RBBINode::printTree(s->val->fLeftChild, FALSE);
RBBIDebugPrintf("\n");
}
}

8
deps/icu-small/source/common/rbbitblb.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2002-2016, International Business Machines
@ -79,7 +81,7 @@ void RBBITableBuilder::build() {
#ifdef RBBI_DEBUG
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ftree")) {
RBBIDebugPuts("\nParse tree after flattening variable references.");
fTree->printTree(TRUE);
RBBINode::printTree(fTree, TRUE);
}
#endif
@ -137,7 +139,7 @@ void RBBITableBuilder::build() {
#ifdef RBBI_DEBUG
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "stree")) {
RBBIDebugPuts("\nParse tree after flattening Unicode Set references.");
fTree->printTree(TRUE);
RBBINode::printTree(fTree, TRUE);
}
#endif
@ -1058,7 +1060,7 @@ void RBBITableBuilder::printPosSets(RBBINode *n) {
}
printf("\n");
RBBINode::printNodeHeader();
n->printNode();
RBBINode::printNode(n);
RBBIDebugPrintf(" Nullable: %s\n", n->fNullable?"TRUE":"FALSE");
RBBIDebugPrintf(" firstpos: ");

2
deps/icu-small/source/common/rbbitblb.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbitblb.h
//

2
deps/icu-small/source/common/resbund.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1997-2013, International Business Machines

2
deps/icu-small/source/common/resbund_cnv.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*

46
deps/icu-small/source/common/resource.cpp

@ -1,6 +1,8 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2015, International Business Machines
* Copyright (C) 2015-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* resource.cpp
@ -11,50 +13,10 @@
#include "resource.h"
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/ures.h"
U_NAMESPACE_BEGIN
ResourceValue::~ResourceValue() {}
ResourceArraySink::~ResourceArraySink() {}
void ResourceArraySink::put(
int32_t /*index*/, const ResourceValue & /*value*/, UErrorCode & /*errorCode*/) {}
ResourceArraySink *ResourceArraySink::getOrCreateArraySink(
int32_t /*index*/, int32_t /*size*/, UErrorCode & /*errorCode*/) {
return NULL;
}
ResourceTableSink *ResourceArraySink::getOrCreateTableSink(
int32_t /*index*/, int32_t /*initialSize*/, UErrorCode & /*errorCode*/) {
return NULL;
}
void ResourceArraySink::leave(UErrorCode & /*errorCode*/) {}
ResourceTableSink::~ResourceTableSink() {}
void ResourceTableSink::put(
const char * /*key*/, const ResourceValue & /*value*/, UErrorCode & /*errorCode*/) {}
void ResourceTableSink::putNoFallback(const char * /*key*/, UErrorCode & /*errorCode*/) {}
ResourceArraySink *ResourceTableSink::getOrCreateArraySink(
const char * /*key*/, int32_t /*size*/, UErrorCode & /*errorCode*/) {
return NULL;
}
ResourceTableSink *ResourceTableSink::getOrCreateTableSink(
const char * /*key*/, int32_t /*initialSize*/, UErrorCode & /*errorCode*/) {
return NULL;
}
void ResourceTableSink::leave(UErrorCode & /*errorCode*/) {}
ResourceSink::~ResourceSink() {}
U_NAMESPACE_END

257
deps/icu-small/source/common/resource.h

@ -1,6 +1,8 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2015, International Business Machines
* Copyright (C) 2015-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* resource.h
@ -27,13 +29,80 @@
#include "unicode/unistr.h"
#include "unicode/ures.h"
struct ResourceData;
U_NAMESPACE_BEGIN
class ResourceTableSink;
class ResourceValue;
// Note: In C++, we use const char * pointers for keys,
// rather than an abstraction like Java UResource.Key.
/**
* Interface for iterating over a resource bundle array resource.
*/
class U_COMMON_API ResourceArray {
public:
/** Constructs an empty array object. */
ResourceArray() : items16(NULL), items32(NULL), length(0) {}
/** Only for implementation use. @internal */
ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len) :
items16(i16), items32(i32), length(len) {}
/**
* @return The number of items in the array resource.
*/
int32_t getSize() const { return length; }
/**
* @param i Array item index.
* @param value Output-only, receives the value of the i'th item.
* @return TRUE if i is non-negative and less than getSize().
*/
UBool getValue(int32_t i, ResourceValue &value) const;
/** Only for implementation use. @internal */
uint32_t internalGetResource(const ResourceData *pResData, int32_t i) const;
private:
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
};
/**
* Interface for iterating over a resource bundle table resource.
*/
class U_COMMON_API ResourceTable {
public:
/** Constructs an empty table object. */
ResourceTable() : keys16(NULL), keys32(NULL), items16(NULL), items32(NULL), length(0) {}
/** Only for implementation use. @internal */
ResourceTable(const uint16_t *k16, const int32_t *k32,
const uint16_t *i16, const uint32_t *i32, int32_t len) :
keys16(k16), keys32(k32), items16(i16), items32(i32), length(len) {}
/**
* @return The number of items in the array resource.
*/
int32_t getSize() const { return length; }
/**
* @param i Array item index.
* @param key Output-only, receives the key of the i'th item.
* @param value Output-only, receives the value of the i'th item.
* @return TRUE if i is non-negative and less than getSize().
*/
UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const;
private:
const uint16_t *keys16;
const int32_t *keys32;
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
};
/**
* Represents a resource bundle item's value.
* Avoids object creations as much as possible.
@ -100,147 +169,109 @@ public:
*/
virtual const uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const = 0;
protected:
ResourceValue() {}
private:
ResourceValue(const ResourceValue &); // no copy constructor
ResourceValue &operator=(const ResourceValue &); // no assignment operator
};
/**
* Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource
*/
virtual ResourceArray getArray(UErrorCode &errorCode) const = 0;
/**
* Sink for ICU resource array contents.
* The base class does nothing.
*
* Nested arrays and tables are stored as nested sinks,
* never put() as ResourceValue items.
*/
class U_COMMON_API ResourceArraySink : public UObject {
public:
ResourceArraySink() {}
virtual ~ResourceArraySink();
/**
* Sets U_RESOURCE_TYPE_MISMATCH if this is not a table resource
*/
virtual ResourceTable getTable(UErrorCode &errorCode) const = 0;
/**
* Adds a value from a resource array.
* Is this a no-fallback/no-inheritance marker string?
* Such a marker is used for
* CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205}
* when enumerating tables with fallback from the specific resource bundle to root.
*
* @param index of the resource array item
* @param value resource value
* @return TRUE if this is a no-inheritance marker string
*/
virtual void put(int32_t index, const ResourceValue &value, UErrorCode &errorCode);
virtual UBool isNoInheritanceMarker() const = 0;
/**
* Returns a nested resource array at the array index as another sink.
* Creates the sink if none exists for the key.
* Returns NULL if nested arrays are not supported.
* The default implementation always returns NULL.
* Sets the dest strings from the string values in this array resource.
*
* This sink (not the caller) owns the nested sink.
* @return the number of strings in this array resource.
* If greater than capacity, then an overflow error is set.
*
* @param index of the resource array item
* @param size number of array items
* @return nested-array sink, or NULL
* Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource
* or if any of the array items is not a string
*/
virtual ResourceArraySink *getOrCreateArraySink(
int32_t index, int32_t size, UErrorCode &errorCode);
virtual int32_t getStringArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const = 0;
/**
* Returns a nested resource table at the array index as another sink.
* Creates the sink if none exists for the key.
* Returns NULL if nested tables are not supported.
* The default implementation always returns NULL.
*
* This sink (not the caller) owns the nested sink.
* Same as
* <pre>
* if (getType() == URES_STRING) {
* return new String[] { getString(); }
* } else {
* return getStringArray();
* }
* </pre>
*
* @param index of the resource array item
* @param initialSize size hint for creating the sink if necessary
* @return nested-table sink, or NULL
* Sets U_RESOURCE_TYPE_MISMATCH if this is
* neither a string resource nor an array resource containing strings
* @see getString()
* @see getStringArray()
*/
virtual ResourceTableSink *getOrCreateTableSink(
int32_t index, int32_t initialSize, UErrorCode &errorCode);
virtual int32_t getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const = 0;
/**
* "Leaves" the array.
* Indicates that all of the resources and sub-resources of the current array
* have been enumerated.
* Same as
* <pre>
* if (getType() == URES_STRING) {
* return getString();
* } else {
* return getStringArray()[0];
* }
* </pre>
*
* Sets U_RESOURCE_TYPE_MISMATCH if this is
* neither a string resource nor an array resource containing strings
* @see getString()
* @see getStringArray()
*/
virtual void leave(UErrorCode &errorCode);
virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const = 0;
protected:
ResourceValue() {}
private:
ResourceArraySink(const ResourceArraySink &); // no copy constructor
ResourceArraySink &operator=(const ResourceArraySink &); // no assignment operator
ResourceValue(const ResourceValue &); // no copy constructor
ResourceValue &operator=(const ResourceValue &); // no assignment operator
};
/**
* Sink for ICU resource table contents.
* The base class does nothing.
*
* Nested arrays and tables are stored as nested sinks,
* never put() as ResourceValue items.
* Sink for ICU resource bundle contents.
*/
class U_COMMON_API ResourceTableSink : public UObject {
class U_COMMON_API ResourceSink : public UObject {
public:
ResourceTableSink() {}
virtual ~ResourceTableSink();
/**
* Adds a key-value pair from a resource table.
*
* @param key resource key string
* @param value resource value
*/
virtual void put(const char *key, const ResourceValue &value, UErrorCode &errorCode);
ResourceSink() {}
virtual ~ResourceSink();
/**
* Adds a no-fallback/no-inheritance marker for this key.
* Used for CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205}
* when enumerating tables with fallback from the specific resource bundle to root.
*
* The default implementation does nothing.
*
* @param key to be removed
*/
virtual void putNoFallback(const char *key, UErrorCode &errorCode);
/**
* Returns a nested resource array for the key as another sink.
* Creates the sink if none exists for the key.
* Returns NULL if nested arrays are not supported.
* The default implementation always returns NULL.
*
* This sink (not the caller) owns the nested sink.
* Called once for each bundle (child-parent-...-root).
* The value is normally an array or table resource,
* and implementations of this method normally iterate over the
* tree of resource items stored there.
*
* @param key resource key string
* @param size number of array items
* @return nested-array sink, or NULL
*/
virtual ResourceArraySink *getOrCreateArraySink(
const char *key, int32_t size, UErrorCode &errorCode);
/**
* Returns a nested resource table for the key as another sink.
* Creates the sink if none exists for the key.
* Returns NULL if nested tables are not supported.
* The default implementation always returns NULL.
*
* This sink (not the caller) owns the nested sink.
*
* @param key resource key string
* @param initialSize size hint for creating the sink if necessary
* @return nested-table sink, or NULL
*/
virtual ResourceTableSink *getOrCreateTableSink(
const char *key, int32_t initialSize, UErrorCode &errorCode);
/**
* "Leaves" the table.
* Indicates that all of the resources and sub-resources of the current table
* have been enumerated.
* @param key The key string of the enumeration-start resource.
* Empty if the enumeration starts at the top level of the bundle.
* @param value Call getArray() or getTable() as appropriate.
* Then reuse for output values from Array and Table getters.
* @param noFallback true if the bundle has no parent;
* that is, its top-level table has the nofallback attribute,
* or it is the root bundle of a locale tree.
*/
virtual void leave(UErrorCode &errorCode);
virtual void put(const char *key, ResourceValue &value, UBool noFallback,
UErrorCode &errorCode) = 0;
private:
ResourceTableSink(const ResourceTableSink &); // no copy constructor
ResourceTableSink &operator=(const ResourceTableSink &); // no assignment operator
ResourceSink(const ResourceSink &); // no copy constructor
ResourceSink &operator=(const ResourceSink &); // no assignment operator
};
U_NAMESPACE_END

2
deps/icu-small/source/common/ruleiter.cpp

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2003-2011, International Business Machines

2
deps/icu-small/source/common/ruleiter.h

@ -1,3 +1,5 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2003-2011, International Business Machines

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save