summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/io/uscanf.c
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2016-04-08 19:03:16 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2016-05-04 16:02:45 -0700
commit2bbd1cd6004b3e1467e30d860385a85dad01fe24 (patch)
treeb812046e89e46e0de09bc858e0b128787cbc0632 /deps/icu-small/source/io/uscanf.c
parentcd752e8463fad7c4805951d9ba47cd2f39691f2d (diff)
downloadandroid-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/io/uscanf.c')
-rw-r--r--deps/icu-small/source/io/uscanf.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/deps/icu-small/source/io/uscanf.c b/deps/icu-small/source/io/uscanf.c
new file mode 100644
index 0000000000..2919305f9e
--- /dev/null
+++ b/deps/icu-small/source/io/uscanf.c
@@ -0,0 +1,105 @@
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File uscanf.c
+*
+* Modification History:
+*
+* Date Name Description
+* 12/02/98 stephen Creation.
+* 03/13/99 stephen Modified for new C API.
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/putil.h"
+#include "unicode/ustdio.h"
+#include "unicode/ustring.h"
+#include "uscanf.h"
+#include "ufile.h"
+#include "ufmt_cmn.h"
+
+#include "cmemory.h"
+#include "cstring.h"
+
+
+U_CAPI int32_t U_EXPORT2
+u_fscanf(UFILE *f,
+ const char *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vfscanf(f, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_fscanf_u(UFILE *f,
+ const UChar *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vfscanf_u(f, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vfscanf(UFILE *f,
+ const char *patternSpecification,
+ va_list ap)
+{
+ int32_t converted;
+ UChar *pattern;
+ UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
+ int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;
+
+ /* convert from the default codepage to Unicode */
+ if (size >= MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
+ pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
+ if(pattern == 0) {
+ return 0;
+ }
+ }
+ else {
+ pattern = patBuffer;
+ }
+ u_charsToUChars(patternSpecification, pattern, size);
+
+ /* do the work */
+ converted = u_vfscanf_u(f, pattern, ap);
+
+ /* clean up */
+ if (pattern != patBuffer) {
+ uprv_free(pattern);
+ }
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vfscanf_u(UFILE *f,
+ const UChar *patternSpecification,
+ va_list ap)
+{
+ return u_scanf_parse(f, patternSpecification, ap);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */