diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2016-04-08 19:03:16 -0700 |
---|---|---|
committer | Steven R. Loomis <srloomis@us.ibm.com> | 2016-05-04 16:02:45 -0700 |
commit | 2bbd1cd6004b3e1467e30d860385a85dad01fe24 (patch) | |
tree | b812046e89e46e0de09bc858e0b128787cbc0632 /deps/icu-small/source/common/ures_cnv.c | |
parent | cd752e8463fad7c4805951d9ba47cd2f39691f2d (diff) | |
download | android-node-v8-2bbd1cd6004b3e1467e30d860385a85dad01fe24.tar.gz android-node-v8-2bbd1cd6004b3e1467e30d860385a85dad01fe24.tar.bz2 android-node-v8-2bbd1cd6004b3e1467e30d860385a85dad01fe24.zip |
deps: Intl: Check in "small-icu" 57.1
* this commit has "small" ICU 57.1.
See other related commit for tools to generate this commit.
Fixes: https://github.com/nodejs/node/issues/3476
PR-URL: https://github.com/nodejs/node/pull/6088
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/ures_cnv.c')
-rw-r--r-- | deps/icu-small/source/common/ures_cnv.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/deps/icu-small/source/common/ures_cnv.c b/deps/icu-small/source/common/ures_cnv.c new file mode 100644 index 0000000000..6a16c50b62 --- /dev/null +++ b/deps/icu-small/source/common/ures_cnv.c @@ -0,0 +1,76 @@ +/* +******************************************************************************* +* +* Copyright (C) 1997-2006, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ures_cnv.c +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004aug25 +* created by: Markus W. Scherer +* +* Character conversion functions moved here from uresbund.c +*/ + +#include "unicode/utypes.h" +#include "unicode/putil.h" +#include "unicode/ustring.h" +#include "unicode/ucnv.h" +#include "unicode/ures.h" +#include "uinvchar.h" +#include "ustr_cnv.h" + +U_CAPI UResourceBundle * U_EXPORT2 +ures_openU(const UChar *myPath, + const char *localeID, + UErrorCode *status) +{ + char pathBuffer[1024]; + int32_t length; + char *path = pathBuffer; + + if(status==NULL || U_FAILURE(*status)) { + return NULL; + } + if(myPath==NULL) { + path = NULL; + } + else { + length=u_strlen(myPath); + if(length>=sizeof(pathBuffer)) { + *status=U_ILLEGAL_ARGUMENT_ERROR; + return NULL; + } else if(uprv_isInvariantUString(myPath, length)) { + /* + * the invariant converter is sufficient for package and tree names + * and is more efficient + */ + u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */ + } else { +#if !UCONFIG_NO_CONVERSION + /* use the default converter to support variant-character paths */ + UConverter *cnv=u_getDefaultConverter(status); + length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status); + u_releaseDefaultConverter(cnv); + if(U_FAILURE(*status)) { + return NULL; + } + if(length>=sizeof(pathBuffer)) { + /* not NUL-terminated - path too long */ + *status=U_ILLEGAL_ARGUMENT_ERROR; + return NULL; + } +#else + /* the default converter is not available */ + *status=U_UNSUPPORTED_ERROR; + return NULL; +#endif + } + } + + return ures_open(path, localeID, status); +} |